purescript-0.15.6: PureScript Programming Language Compiler
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.PureScript.TypeChecker.Roles

Description

Role inference

Synopsis

Documentation

lookupRoles :: Environment -> Qualified (ProperName 'TypeName) -> [Role] Source #

Lookup the roles for a type in the environment. If the type does not have roles (e.g. is a type synonym or a type variable), then this function returns an empty list.

checkRoles Source #

Arguments

:: forall m. MonadError MultipleErrors m 
=> [(Text, Maybe SourceType, Role)]

type parameters for the data type whose roles we are checking

-> [Role]

roles declared for the data type

-> m () 

Compares the inferred roles to the explicitly declared roles and ensures that the explicitly declared roles are not more permissive than the inferred ones.

inferRoles Source #

Arguments

:: Environment 
-> ModuleName 
-> ProperName 'TypeName

The name of the data type whose roles we are checking

-> [(Text, Maybe SourceType)]

type parameters for the data type whose roles we are checking

-> [DataConstructorDeclaration]

constructors of the data type whose roles we are checking

-> [Role] 

Infers roles for the given data type declaration.