unison-core1-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.DataDeclaration

Synopsis

Documentation

data DataDeclaration v a Source #

Constructors

DataDeclaration 

Fields

Instances

Instances details
Functor (DataDeclaration v) Source # 
Instance details

Defined in Unison.DataDeclaration

Methods

fmap :: (a -> b) -> DataDeclaration v a -> DataDeclaration v b #

(<$) :: a -> DataDeclaration v b -> DataDeclaration v a #

Generic (DataDeclaration v a) Source # 
Instance details

Defined in Unison.DataDeclaration

Associated Types

type Rep (DataDeclaration v a) :: Type -> Type #

Methods

from :: DataDeclaration v a -> Rep (DataDeclaration v a) x #

to :: Rep (DataDeclaration v a) x -> DataDeclaration v a #

(Show a, Show v) => Show (DataDeclaration v a) Source # 
Instance details

Defined in Unison.DataDeclaration

(Eq a, Var v) => Eq (DataDeclaration v a) Source # 
Instance details

Defined in Unison.DataDeclaration

(Var v, Ord a) => Ord (DataDeclaration v a) Source # 
Instance details

Defined in Unison.DataDeclaration

type Rep (DataDeclaration v a) Source # 
Instance details

Defined in Unison.DataDeclaration

type Rep (DataDeclaration v a) = D1 ('MetaData "DataDeclaration" "Unison.DataDeclaration" "unison-core1-0.0.0-Kp7ZcNnt5XdB8ImvFwyntI" 'False) (C1 ('MetaCons "DataDeclaration" 'PrefixI 'True) ((S1 ('MetaSel ('Just "modifier") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Modifier) :*: S1 ('MetaSel ('Just "annotation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :*: (S1 ('MetaSel ('Just "bound") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [v]) :*: S1 ('MetaSel ('Just "constructors'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(a, v, Type v a)]))))

newtype EffectDeclaration v a Source #

Constructors

EffectDeclaration 

Instances

Instances details
Functor (EffectDeclaration v) Source # 
Instance details

Defined in Unison.DataDeclaration

Methods

fmap :: (a -> b) -> EffectDeclaration v a -> EffectDeclaration v b #

(<$) :: a -> EffectDeclaration v b -> EffectDeclaration v a #

(Show a, Show v) => Show (EffectDeclaration v a) Source # 
Instance details

Defined in Unison.DataDeclaration

(Var v, Eq a) => Eq (EffectDeclaration v a) Source # 
Instance details

Defined in Unison.DataDeclaration

(Var v, Ord a) => Ord (EffectDeclaration v a) Source # 
Instance details

Defined in Unison.DataDeclaration

data DeclOrBuiltin v a Source #

Constructors

Builtin ConstructorType 
Decl (Decl v a) 

Instances

Instances details
(Show a, Show v) => Show (DeclOrBuiltin v a) Source # 
Instance details

Defined in Unison.DataDeclaration

(Var v, Eq a) => Eq (DeclOrBuiltin v a) Source # 
Instance details

Defined in Unison.DataDeclaration

Methods

(==) :: DeclOrBuiltin v a -> DeclOrBuiltin v a -> Bool #

(/=) :: DeclOrBuiltin v a -> DeclOrBuiltin v a -> Bool #

(Var v, Ord a) => Ord (DeclOrBuiltin v a) Source # 
Instance details

Defined in Unison.DataDeclaration

data Modifier Source #

Constructors

Structural 
Unique Text 

Instances

Instances details
Show Modifier Source # 
Instance details

Defined in Unison.DataDeclaration

Eq Modifier Source # 
Instance details

Defined in Unison.DataDeclaration

Ord Modifier Source # 
Instance details

Defined in Unison.DataDeclaration

allVars :: Ord v => DataDeclaration v a -> Set v Source #

All variables mentioned in the given data declaration. Includes both term and type variables, both free and bound.

constructorIds :: DataDeclaration v a -> [ConstructorId] Source #

The constructor ids for the given data declaration.

labeledDeclDependenciesIncludingSelf :: Ord v => TypeReference -> Decl v a -> Set LabeledDependency Source #

Compute the dependencies of a data declaration, including the type itself and references for each of its constructors.

NOTE: You may prefer labeledDeclDependenciesIncludingSelfAndFieldAccessors in Unison.DataDeclaration.Dependencies, it also includes Referents for accessors of record fields.

declFields :: Var v => Decl v a -> Either [Int] [Int] Source #

typeDependencies :: Ord v => DataDeclaration v a -> Set TypeReference Source #

All references to types mentioned in the given data declaration's fields/constructors Note: Does not include references to the constructors or the decl itself (unless the decl is self-referential) Note: Does NOT include the referents for fields and field accessors. Those must be computed separately because we need access to the typechecker to do so.

unhashComponent :: forall v a. Var v => Map Id (Decl v a) -> Map Id (v, Decl v a) Source #

This converts References it finds that are in the input Map back to free variables.

In the result map, any of the references inside the Decls which are keys of the input map; have been replaced with the corresponding output vs in the output Decls, which are fresh with respect to all input Decls.

mkDataDecl' :: Modifier -> a -> [v] -> [(a, v, Type v a)] -> DataDeclaration v a Source #

mkEffectDecl' :: Modifier -> a -> [v] -> [(a, v, Type v a)] -> EffectDeclaration v a Source #

amap :: (a -> a2) -> Decl v a -> Decl v a2 Source #

setConstructorNames :: [v] -> Decl v a -> Decl v a Source #

Overwrite the constructor names with the given list, given in canonical order, which is assumed to be of the correct length.

Presumably this is called because the decl was loaded from the database outside of the context of a namespace, since it's not stored with names there, so we had plugged in dummy names like Constructor1, Constructor2, ...

Then, at some point, we discover the constructors' names in a namespace, and now we'd like to combine the two together to get a Decl structure in memory with good/correct names for constructors.