purescript-0.15.12: PureScript Programming Language Compiler

Safe Haskell | Safe-Inferred
Language | Haskell2010

Language.PureScript.Environment

Synopsis

- data Environment = Environment {
  - names :: Map (Qualified Ident) (SourceType, NameKind, NameVisibility)
  - types :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
  - dataConstructors :: Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident])
  - typeSynonyms :: Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType)
  - typeClassDictionaries :: Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))
  - typeClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
  }
- data TypeClassData = TypeClassData {
  - typeClassArguments :: [(Text, Maybe SourceType)]
  - typeClassMembers :: [(Ident, SourceType)]
  - typeClassSuperclasses :: [SourceConstraint]
  - typeClassDependencies :: [FunctionalDependency]
  - typeClassDeterminedArguments :: Set Int
  - typeClassCoveringSets :: Set (Set Int)
  - typeClassIsEmpty :: Bool
  }
- data FunctionalDependency = FunctionalDependency {
  - fdDeterminers :: [Int]
  - fdDetermined :: [Int]
  }
- initEnvironment :: Environment
- makeTypeClassData :: [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Bool -> TypeClassData
- type Frontier = Map IntSet (First (IntMap (NonEmpty IntSet)))
- computeCoveringSets :: Int -> [FunctionalDependency] -> (Set Int, Set (Set Int))
- data NameVisibility
  - = Undefined
  - | Defined
- data NameKind
  - = Private
  - | Public
  - | External
- data TypeKind
  - = DataType DataDeclType [(Text, Maybe SourceType, Role)] [(ProperName 'ConstructorName, [SourceType])]
  - | TypeSynonym
  - | ExternData [Role]
  - | LocalTypeVariable
  - | ScopedTypeVar
- data DataDeclType
  - = Data
  - | Newtype
- showDataDeclType :: DataDeclType -> Text
- kindType :: SourceType
- kindConstraint :: SourceType
- kindSymbol :: SourceType
- kindDoc :: SourceType
- kindOrdering :: SourceType
- kindRowList :: SourceType -> SourceType
- kindRow :: SourceType -> SourceType
- kindOfREmpty :: SourceType
- tyFunction :: SourceType
- tyString :: SourceType
- tyChar :: SourceType
- tyNumber :: SourceType
- tyInt :: SourceType
- tyBoolean :: SourceType
- tyArray :: SourceType
- tyRecord :: SourceType
- tyVar :: Text -> SourceType
- tyForall :: Text -> SourceType -> SourceType -> SourceType
- function :: SourceType -> SourceType -> SourceType
- (-:>) :: SourceType -> SourceType -> SourceType
- primClass :: Qualified (ProperName 'ClassName) -> (SourceType -> SourceType) -> [(Qualified (ProperName 'TypeName), (SourceType, TypeKind))]
- primTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- allPrimTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primBooleanTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primCoerceTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primOrderingTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primRowTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primRowListTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primSymbolTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primIntTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primTypeErrorTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)
- primClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
- allPrimClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
- primCoerceClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
- primRowClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
- primRowListClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
- primSymbolClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
- primIntClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
- primTypeErrorClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData
- lookupConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> (DataDeclType, ProperName 'TypeName, SourceType, [Ident])
- lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility)
- dictTypeName' :: Text -> Text
- dictTypeName :: ProperName a -> ProperName a
- isDictTypeName :: ProperName a -> Bool
- nominalRolesForKind :: Type a -> [Role]
- kindArity :: Type a -> Int
- unapplyKinds :: Type a -> ([Type a], Type a)

# Documentation

data Environment #

The `Environment` defines all values and types which are currently in scope:

Constructors

Environment |
Fields names :: Map (Qualified Ident) (SourceType, NameKind, NameVisibility) Values currently in scope types :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) Type names currently in scope dataConstructors :: Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) Data constructors currently in scope, along with their associated type constructor name, argument types and return type. typeSynonyms :: Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) Type synonyms currently in scope typeClassDictionaries :: Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) Available type class dictionaries. When looking up `Nothing` in the outer map, this returns the map of type class dictionaries in local scope (ie dictionaries brought in by a constrained type). typeClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData Type classes

#### Instances

Instances details

Generic Environment # |
Instance details Defined in Language.PureScript.Environment Associated Types type Rep Environment :: Type -> Type # Methods from :: Environment -> Rep Environment x # to :: Rep Environment x -> Environment #
Show Environment # |
Instance details Defined in Language.PureScript.Environment Methods showsPrec :: Int -> Environment -> ShowS # show :: Environment -> String # showList :: [Environment] -> ShowS #
NFData Environment # |
Instance details Defined in Language.PureScript.Environment Methods rnf :: Environment -> () #
type Rep Environment # |
Instance details Defined in Language.PureScript.Environment type Rep Environment = D1 ('MetaData "Environment" "Language.PureScript.Environment" "purescript-0.15.12-5l1zT9m1jq0GgrLEUvYibC" 'False) (C1 ('MetaCons "Environment" 'PrefixI 'True) ((S1 ('MetaSel ('Just "names") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (Qualified Ident) (SourceType, NameKind, NameVisibility))) :*: (S1 ('MetaSel ('Just "types") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind))) :*: S1 ('MetaSel ('Just "dataConstructors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident]))))) :*: (S1 ('MetaSel ('Just "typeSynonyms") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType))) :*: (S1 ('MetaSel ('Just "typeClassDictionaries") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))))) :*: S1 ('MetaSel ('Just "typeClasses") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (Qualified (ProperName 'ClassName)) TypeClassData))))))

data TypeClassData #

Information about a type class

Constructors

TypeClassData |
Fields typeClassArguments :: [(Text, Maybe SourceType)] A list of type argument names, and their kinds, where kind annotations were provided. typeClassMembers :: [(Ident, SourceType)] A list of type class members and their types. Type arguments listed above are considered bound in these types. typeClassSuperclasses :: [SourceConstraint] A list of superclasses of this type class. Type arguments listed above are considered bound in the types appearing in these constraints. typeClassDependencies :: [FunctionalDependency] A list of functional dependencies for the type arguments of this class. typeClassDeterminedArguments :: Set Int A set of indexes of type argument that are fully determined by other arguments via functional dependencies. This can be computed from both typeClassArguments and typeClassDependencies. typeClassCoveringSets :: Set (Set Int) A sets of arguments that can be used to infer all other arguments. typeClassIsEmpty :: Bool Whether or not dictionaries for this type class are necessarily empty.

#### Instances

Instances details

Generic TypeClassData # |
Instance details Defined in Language.PureScript.Environment Associated Types type Rep TypeClassData :: Type -> Type # Methods from :: TypeClassData -> Rep TypeClassData x # to :: Rep TypeClassData x -> TypeClassData #
Show TypeClassData # |
Instance details Defined in Language.PureScript.Environment Methods showsPrec :: Int -> TypeClassData -> ShowS # show :: TypeClassData -> String # showList :: [TypeClassData] -> ShowS #
NFData TypeClassData # |
Instance details Defined in Language.PureScript.Environment Methods rnf :: TypeClassData -> () #
type Rep TypeClassData # |
Instance details Defined in Language.PureScript.Environment type Rep TypeClassData = D1 ('MetaData "TypeClassData" "Language.PureScript.Environment" "purescript-0.15.12-5l1zT9m1jq0GgrLEUvYibC" 'False) (C1 ('MetaCons "TypeClassData" 'PrefixI 'True) ((S1 ('MetaSel ('Just "typeClassArguments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Text, Maybe SourceType)]) :*: (S1 ('MetaSel ('Just "typeClassMembers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Ident, SourceType)]) :*: S1 ('MetaSel ('Just "typeClassSuperclasses") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [SourceConstraint]))) :*: ((S1 ('MetaSel ('Just "typeClassDependencies") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FunctionalDependency]) :*: S1 ('MetaSel ('Just "typeClassDeterminedArguments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set Int))) :*: (S1 ('MetaSel ('Just "typeClassCoveringSets") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set (Set Int))) :*: S1 ('MetaSel ('Just "typeClassIsEmpty") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))))

data FunctionalDependency #

A functional dependency indicates a relationship between two sets of type arguments in a class declaration.

Constructors

FunctionalDependency |
Fields fdDeterminers :: [Int] the type arguments which determine the determined type arguments fdDetermined :: [Int] the determined type arguments

#### Instances

Instances details

FromJSON FunctionalDependency # |
Instance details Defined in Language.PureScript.Environment Methods parseJSON :: Value -> Parser FunctionalDependency # parseJSONList :: Value -> Parser [FunctionalDependency] # omittedField :: Maybe FunctionalDependency #
ToJSON FunctionalDependency # |
Instance details Defined in Language.PureScript.Environment Methods toJSON :: FunctionalDependency -> Value # toEncoding :: FunctionalDependency -> Encoding # toJSONList :: [FunctionalDependency] -> Value # toEncodingList :: [FunctionalDependency] -> Encoding # omitField :: FunctionalDependency -> Bool #
Generic FunctionalDependency # |
Instance details Defined in Language.PureScript.Environment Associated Types type Rep FunctionalDependency :: Type -> Type # Methods from :: FunctionalDependency -> Rep FunctionalDependency x # to :: Rep FunctionalDependency x -> FunctionalDependency #
Show FunctionalDependency # |
Instance details Defined in Language.PureScript.Environment Methods showsPrec :: Int -> FunctionalDependency -> ShowS # show :: FunctionalDependency -> String # showList :: [FunctionalDependency] -> ShowS #
NFData FunctionalDependency # |
Instance details Defined in Language.PureScript.Environment Methods rnf :: FunctionalDependency -> () #
Serialise FunctionalDependency # |
Instance details Defined in Language.PureScript.Environment Methods encode :: FunctionalDependency -> Encoding # decode :: Decoder s FunctionalDependency # encodeList :: [FunctionalDependency] -> Encoding # decodeList :: Decoder s [FunctionalDependency] #
type Rep FunctionalDependency # |
Instance details Defined in Language.PureScript.Environment type Rep FunctionalDependency = D1 ('MetaData "FunctionalDependency" "Language.PureScript.Environment" "purescript-0.15.12-5l1zT9m1jq0GgrLEUvYibC" 'False) (C1 ('MetaCons "FunctionalDependency" 'PrefixI 'True) (S1 ('MetaSel ('Just "fdDeterminers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int]) :*: S1 ('MetaSel ('Just "fdDetermined") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int])))

initEnvironment :: Environment #

The initial environment with no values and only the default javascript types defined

makeTypeClassData :: [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Bool -> TypeClassData #

A constructor for TypeClassData that computes which type class arguments are fully determined and argument covering sets. Fully determined means that this argument cannot be used when selecting a type class instance. A covering set is a minimal collection of arguments that can be used to find an instance and therefore determine all other type arguments.

An example of the difference between determined and fully determined would be with the class: ```class C a b c | a -> b, b -> a, b -> c``` In this case, `a` must differ when `b` differs, and vice versa - each is determined by the other. Both `a` and `b` can be used in selecting a type class instance. However, `c` cannot - it is fully determined by `a` and `b`.

Define a graph of type class arguments with edges being fundep determiners to determined. Each argument also has a self looping edge. An argument is fully determined if doesn't appear at the start of a path of strongly connected components. An argument is not fully determined otherwise.

The way we compute this is by saying: an argument X is fully determined if there are arguments that determine X that X does not determine. This is the same thing: everything X determines includes everything in its SCC, and everything determining X is either before it in an SCC path, or in the same SCC.

type Frontier = Map IntSet (First (IntMap (NonEmpty IntSet))) #

computeCoveringSets :: Int -> [FunctionalDependency] -> (Set Int, Set (Set Int)) #

data NameVisibility #

The visibility of a name in scope

Constructors

Undefined | The name is defined in the current binding group, but is not visible
Defined | The name is defined in the another binding group, or has been made visible by a function binder

#### Instances

Instances details

Generic NameVisibility # |
Instance details Defined in Language.PureScript.Environment Associated Types type Rep NameVisibility :: Type -> Type # Methods from :: NameVisibility -> Rep NameVisibility x # to :: Rep NameVisibility x -> NameVisibility #
Show NameVisibility # |
Instance details Defined in Language.PureScript.Environment Methods showsPrec :: Int -> NameVisibility -> ShowS # show :: NameVisibility -> String # showList :: [NameVisibility] -> ShowS #
NFData NameVisibility # |
Instance details Defined in Language.PureScript.Environment Methods rnf :: NameVisibility -> () #
Eq NameVisibility # |
Instance details Defined in Language.PureScript.Environment Methods (==) :: NameVisibility -> NameVisibility -> Bool # (/=) :: NameVisibility -> NameVisibility -> Bool #
Serialise NameVisibility # |
Instance details Defined in Language.PureScript.Environment Methods encode :: NameVisibility -> Encoding # decode :: Decoder s NameVisibility # encodeList :: [NameVisibility] -> Encoding # decodeList :: Decoder s [NameVisibility] #
type Rep NameVisibility # |
Instance details Defined in Language.PureScript.Environment type Rep NameVisibility = D1 ('MetaData "NameVisibility" "Language.PureScript.Environment" "purescript-0.15.12-5l1zT9m1jq0GgrLEUvYibC" 'False) (C1 ('MetaCons "Undefined" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Defined" 'PrefixI 'False) (U1 :: Type -> Type))

data NameKind #

A flag for whether a name is for an private or public value - only public values will be included in a generated externs file.

Constructors

Private | A private value introduced as an artifact of code generation (class instances, class member accessors, etc.)
Public | A public value for a module member or foreign import declaration
External | A name for member introduced by foreign import

#### Instances

Instances details

Generic NameKind # |
Instance details Defined in Language.PureScript.Environment Associated Types type Rep NameKind :: Type -> Type # Methods from :: NameKind -> Rep NameKind x # to :: Rep NameKind x -> NameKind #
Show NameKind # |
Instance details Defined in Language.PureScript.Environment Methods showsPrec :: Int -> NameKind -> ShowS # show :: NameKind -> String # showList :: [NameKind] -> ShowS #
NFData NameKind # |
Instance details Defined in Language.PureScript.Environment Methods rnf :: NameKind -> () #
Eq NameKind # |
Instance details Defined in Language.PureScript.Environment Methods (==) :: NameKind -> NameKind -> Bool # (/=) :: NameKind -> NameKind -> Bool #
Serialise NameKind # |
Instance details Defined in Language.PureScript.Environment Methods encode :: NameKind -> Encoding # decode :: Decoder s NameKind # encodeList :: [NameKind] -> Encoding # decodeList :: Decoder s [NameKind] #
type Rep NameKind # |
Instance details Defined in Language.PureScript.Environment type Rep NameKind = D1 ('MetaData "NameKind" "Language.PureScript.Environment" "purescript-0.15.12-5l1zT9m1jq0GgrLEUvYibC" 'False) (C1 ('MetaCons "Private" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Public" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "External" 'PrefixI 'False) (U1 :: Type -> Type)))

data TypeKind #

The kinds of a type

Constructors

DataType DataDeclType [(Text, Maybe SourceType, Role)] [(ProperName 'ConstructorName, [SourceType])] | Data type
TypeSynonym | Type synonym
ExternData [Role] | Foreign data
LocalTypeVariable | A local type variable
ScopedTypeVar | A scoped type variable

#### Instances

Instances details

Generic TypeKind # |
Instance details Defined in Language.PureScript.Environment Associated Types type Rep TypeKind :: Type -> Type # Methods from :: TypeKind -> Rep TypeKind x # to :: Rep TypeKind x -> TypeKind #
Show TypeKind # |
Instance details Defined in Language.PureScript.Environment Methods showsPrec :: Int -> TypeKind -> ShowS # show :: TypeKind -> String # showList :: [TypeKind] -> ShowS #
NFData TypeKind # |
Instance details Defined in Language.PureScript.Environment Methods rnf :: TypeKind -> () #
Eq TypeKind # |
Instance details Defined in Language.PureScript.Environment Methods (==) :: TypeKind -> TypeKind -> Bool # (/=) :: TypeKind -> TypeKind -> Bool #
Serialise TypeKind # |
Instance details Defined in Language.PureScript.Environment Methods encode :: TypeKind -> Encoding # decode :: Decoder s TypeKind # encodeList :: [TypeKind] -> Encoding # decodeList :: Decoder s [TypeKind] #
type Rep TypeKind # |
Instance details Defined in Language.PureScript.Environment type Rep TypeKind = D1 ('MetaData "TypeKind" "Language.PureScript.Environment" "purescript-0.15.12-5l1zT9m1jq0GgrLEUvYibC" 'False) ((C1 ('MetaCons "DataType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DataDeclType) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Text, Maybe SourceType, Role)]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(ProperName 'ConstructorName, [SourceType])]))) :+: C1 ('MetaCons "TypeSynonym" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ExternData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Role])) :+: (C1 ('MetaCons "LocalTypeVariable" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ScopedTypeVar" 'PrefixI 'False) (U1 :: Type -> Type))))

data DataDeclType #

The type ('data' or 'newtype') of a data type declaration

Constructors

Data | A standard data constructor
Newtype | A newtype constructor

#### Instances

Instances details

FromJSON DataDeclType # |
Instance details Defined in Language.PureScript.Environment Methods parseJSON :: Value -> Parser DataDeclType # parseJSONList :: Value -> Parser [DataDeclType] # omittedField :: Maybe DataDeclType #
ToJSON DataDeclType # |
Instance details Defined in Language.PureScript.Environment Methods toJSON :: DataDeclType -> Value # toEncoding :: DataDeclType -> Encoding # toJSONList :: [DataDeclType] -> Value # toEncodingList :: [DataDeclType] -> Encoding # omitField :: DataDeclType -> Bool #
Generic DataDeclType # |
Instance details Defined in Language.PureScript.Environment Associated Types type Rep DataDeclType :: Type -> Type # Methods from :: DataDeclType -> Rep DataDeclType x # to :: Rep DataDeclType x -> DataDeclType #
Show DataDeclType # |
Instance details Defined in Language.PureScript.Environment Methods showsPrec :: Int -> DataDeclType -> ShowS # show :: DataDeclType -> String # showList :: [DataDeclType] -> ShowS #
NFData DataDeclType # |
Instance details Defined in Language.PureScript.Environment Methods rnf :: DataDeclType -> () #
Eq DataDeclType # |
Instance details Defined in Language.PureScript.Environment Methods (==) :: DataDeclType -> DataDeclType -> Bool # (/=) :: DataDeclType -> DataDeclType -> Bool #
Ord DataDeclType # |
Instance details Defined in Language.PureScript.Environment Methods compare :: DataDeclType -> DataDeclType -> Ordering # (<) :: DataDeclType -> DataDeclType -> Bool # (<=) :: DataDeclType -> DataDeclType -> Bool # (>) :: DataDeclType -> DataDeclType -> Bool # (>=) :: DataDeclType -> DataDeclType -> Bool # max :: DataDeclType -> DataDeclType -> DataDeclType # min :: DataDeclType -> DataDeclType -> DataDeclType #
Serialise DataDeclType # |
Instance details Defined in Language.PureScript.Environment Methods encode :: DataDeclType -> Encoding # decode :: Decoder s DataDeclType # encodeList :: [DataDeclType] -> Encoding # decodeList :: Decoder s [DataDeclType] #
type Rep DataDeclType # |
Instance details Defined in Language.PureScript.Environment type Rep DataDeclType = D1 ('MetaData "DataDeclType" "Language.PureScript.Environment" "purescript-0.15.12-5l1zT9m1jq0GgrLEUvYibC" 'False) (C1 ('MetaCons "Data" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Newtype" 'PrefixI 'False) (U1 :: Type -> Type))

showDataDeclType :: DataDeclType -> Text #

kindType :: SourceType #

Kind of ground types

kindConstraint :: SourceType #

kindSymbol :: SourceType #

kindDoc :: SourceType #

kindOrdering :: SourceType #

kindRowList :: SourceType -> SourceType #

kindRow :: SourceType -> SourceType #

kindOfREmpty :: SourceType #

tyFunction :: SourceType #

Type constructor for functions

tyString :: SourceType #

Type constructor for strings

tyChar :: SourceType #

Type constructor for strings

tyNumber :: SourceType #

Type constructor for numbers

tyInt :: SourceType #

Type constructor for integers

tyBoolean :: SourceType #

Type constructor for booleans

tyArray :: SourceType #

Type constructor for arrays

tyRecord :: SourceType #

Type constructor for records

tyVar :: Text -> SourceType #

tyForall :: Text -> SourceType -> SourceType -> SourceType #

function :: SourceType -> SourceType -> SourceType #

Smart constructor for function types

(-:>) :: SourceType -> SourceType -> SourceType infixr 4 #

primClass :: Qualified (ProperName 'ClassName) -> (SourceType -> SourceType) -> [(Qualified (ProperName 'TypeName), (SourceType, TypeKind))] #

primTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

The primitive types in the external environment with their associated kinds. There are also pseudo `Fail`, `Warn`, and `Partial` types that correspond to the classes with the same names.

allPrimTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

This `Map` contains all of the prim types from all Prim modules.

primBooleanTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

primCoerceTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

primOrderingTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

primRowTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

primRowListTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

primSymbolTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

primIntTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

primTypeErrorTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) #

primClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData #

The primitive class map. This just contains the `Partial` class. `Partial` is used as a kind of magic constraint for partial functions.

allPrimClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData #

This contains all of the type classes from all Prim modules.

primCoerceClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData #

primRowClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData #

primRowListClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData #

primSymbolClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData #

primIntClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData #

primTypeErrorClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData #

lookupConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) #

Finds information about data constructors from the current environment.

lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility) #

Finds information about values from the current environment.

dictTypeName' :: Text -> Text #

dictTypeName :: ProperName a -> ProperName a #

isDictTypeName :: ProperName a -> Bool #

nominalRolesForKind :: Type a -> [Role] #

Given the kind of a type, generate a list `Nominal` roles. This is used for opaque foreign types as well as type classes.

kindArity :: Type a -> Int #

unapplyKinds :: Type a -> ([Type a], Type a) #