purescript-0.8.5.0: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell98

Language.PureScript.Environment

Synopsis

Documentation

data Environment Source

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

Constructors

Environment 

Fields

names :: Map (ModuleName, Ident) (Type, NameKind, NameVisibility)

Value names currently in scope

types :: Map (Qualified (ProperName TypeName)) (Kind, TypeKind)

Type names currently in scope

dataConstructors :: Map (Qualified (ProperName ConstructorName)) (DataDeclType, ProperName TypeName, Type, [Ident])

Data constructors currently in scope, along with their associated type constructor name, argument types and return type.

typeSynonyms :: Map (Qualified (ProperName TypeName)) ([(String, Maybe Kind)], Type)

Type synonyms currently in scope

typeClassDictionaries :: Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) TypeClassDictionaryInScope))

Available type class dictionaries

typeClasses :: Map (Qualified (ProperName ClassName)) ([(String, Maybe Kind)], [(Ident, Type)], [Constraint])

Type classes

initEnvironment :: Environment Source

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

data NameVisibility Source

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

data NameKind Source

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 foreing import declaration

External

A name for member introduced by foreign import

data TypeKind Source

The kinds of a type

Constructors

DataType [(String, Maybe Kind)] [(ProperName ConstructorName, [Type])]

Data type

TypeSynonym

Type synonym

ExternData

Foreign data

LocalTypeVariable

A local type variable

ScopedTypeVar

A scoped type variable

data DataDeclType Source

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

Constructors

Data

A standard data constructor

Newtype

A newtype constructor

primName :: String -> Qualified (ProperName a) Source

Construct a ProperName in the Prim module

primTy :: String -> Type Source

Construct a type in the Prim module

tyFunction :: Type Source

Type constructor for functions

tyString :: Type Source

Type constructor for strings

tyChar :: Type Source

Type constructor for strings

tyNumber :: Type Source

Type constructor for numbers

tyInt :: Type Source

Type constructor for integers

tyBoolean :: Type Source

Type constructor for booleans

tyArray :: Type Source

Type constructor for arrays

tyObject :: Type Source

Type constructor for objects

isObject :: Type -> Bool Source

Check whether a type is an object

isFunction :: Type -> Bool Source

Check whether a type is a function

function :: Type -> Type -> Type Source

Smart constructor for function types

primTypes :: Map (Qualified (ProperName TypeName)) (Kind, TypeKind) Source

The primitive types in the external javascript environment with their associated kinds. There is also a pseudo Partial type that corresponds to the class with the same name.

primClasses :: Map (Qualified (ProperName ClassName)) ([(String, Maybe Kind)], [(Ident, Type)], [Constraint]) Source

The primitive class map. This just contains to Partial class, used as a kind of magic constraint for partial functions.

lookupConstructor :: Environment -> Qualified (ProperName ConstructorName) -> (DataDeclType, ProperName TypeName, Type, [Ident]) Source

Finds information about data constructors from the current environment.

isNewtypeConstructor :: Environment -> Qualified (ProperName ConstructorName) -> Bool Source

Checks whether a data constructor is for a newtype.

lookupValue :: Environment -> Qualified Ident -> Maybe (Type, NameKind, NameVisibility) Source

Finds information about values from the current environment.