purescript-0.11.6: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Types

Description

Data types for types

Synopsis

Documentation

newtype SkolemScope #

An identifier for the scope of a skolem variable

Constructors

SkolemScope 

Fields

data Type #

The type of types

Constructors

TUnknown Int

A unification variable of type Type

TypeVar Text

A named type variable

TypeLevelString PSString

A type-level string

TypeWildcard SourceSpan

A type wildcard, as would appear in a partial type synonym

TypeConstructor (Qualified (ProperName TypeName))

A type constructor

TypeOp (Qualified (OpName TypeOpName))

A type operator. This will be desugared into a type constructor during the "operators" phase of desugaring.

TypeApp Type Type

A type application

ForAll Text Type (Maybe SkolemScope)

Forall quantifier

ConstrainedType Constraint Type

A type with a set of type class constraints

Skolem Text Int SkolemScope (Maybe SourceSpan)

A skolem constant

REmpty

An empty row

RCons Label Type Type

A non-empty row

KindedType Type Kind

A type with a kind annotation

PrettyPrintFunction Type Type

A placeholder used in pretty printing

PrettyPrintObject Type

A placeholder used in pretty printing

PrettyPrintForAll [Text] Type

A placeholder used in pretty printing

BinaryNoParensType Type Type Type

Binary operator application. During the rebracketing phase of desugaring, this data constructor will be removed.

ParensInType Type

Explicit parentheses. During the rebracketing phase of desugaring, this data constructor will be removed.

Note: although it seems this constructor is not used, it _is_ useful, since it prevents certain traversals from matching.

Instances

Eq Type # 

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type # 

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Show Type # 

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Generic Type # 

Associated Types

type Rep Type :: * -> * #

Methods

from :: Type -> Rep Type x #

to :: Rep Type x -> Type #

ToJSON Type # 
FromJSON Type # 
NFData Type # 

Methods

rnf :: Type -> () #

type Rep Type # 
type Rep Type = D1 (MetaData "Type" "Language.PureScript.Types" "purescript-0.11.6-FH7waWkD6GQKRwiG3siRFE" False) ((:+:) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "TUnknown" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int))) (C1 (MetaCons "TypeVar" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))) ((:+:) (C1 (MetaCons "TypeLevelString" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PSString))) (C1 (MetaCons "TypeWildcard" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan))))) ((:+:) ((:+:) (C1 (MetaCons "TypeConstructor" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Qualified (ProperName TypeName))))) (C1 (MetaCons "TypeOp" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Qualified (OpName TypeOpName)))))) ((:+:) (C1 (MetaCons "TypeApp" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)))) ((:+:) (C1 (MetaCons "ForAll" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe SkolemScope)))))) (C1 (MetaCons "ConstrainedType" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Constraint)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)))))))) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "Skolem" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SkolemScope)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe SourceSpan)))))) (C1 (MetaCons "REmpty" PrefixI False) U1)) ((:+:) (C1 (MetaCons "RCons" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Label)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type))))) (C1 (MetaCons "KindedType" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Kind)))))) ((:+:) ((:+:) (C1 (MetaCons "PrettyPrintFunction" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)))) (C1 (MetaCons "PrettyPrintObject" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)))) ((:+:) (C1 (MetaCons "PrettyPrintForAll" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Text])) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)))) ((:+:) (C1 (MetaCons "BinaryNoParensType" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type))))) (C1 (MetaCons "ParensInType" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type))))))))

data ConstraintData #

Additional data relevant to type class constraints

Constructors

PartialConstraintData [[Text]] Bool

Data to accompany a Partial constraint generated by the exhaustivity checker. It contains (rendered) binder information for those binders which were not matched, and a flag indicating whether the list was truncated or not. Note: we use Text here because using Binder would introduce a cyclic dependency in the module graph.

Instances

Eq ConstraintData # 
Ord ConstraintData # 
Show ConstraintData # 
Generic ConstraintData # 

Associated Types

type Rep ConstraintData :: * -> * #

ToJSON ConstraintData # 
FromJSON ConstraintData # 
NFData ConstraintData # 

Methods

rnf :: ConstraintData -> () #

type Rep ConstraintData # 
type Rep ConstraintData = D1 (MetaData "ConstraintData" "Language.PureScript.Types" "purescript-0.11.6-FH7waWkD6GQKRwiG3siRFE" False) (C1 (MetaCons "PartialConstraintData" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [[Text]])) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))))

data Constraint #

A typeclass constraint

Constructors

Constraint 

Fields

Instances

Eq Constraint # 
Ord Constraint # 
Show Constraint # 
Generic Constraint # 

Associated Types

type Rep Constraint :: * -> * #

ToJSON Constraint # 
FromJSON Constraint # 
NFData Constraint # 

Methods

rnf :: Constraint -> () #

type Rep Constraint # 
type Rep Constraint = D1 (MetaData "Constraint" "Language.PureScript.Types" "purescript-0.11.6-FH7waWkD6GQKRwiG3siRFE" False) (C1 (MetaCons "Constraint" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "constraintClass") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Qualified (ProperName ClassName)))) ((:*:) (S1 (MetaSel (Just Symbol "constraintArgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Type])) (S1 (MetaSel (Just Symbol "constraintData") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe ConstraintData))))))

rowToList :: Type -> ([(Label, Type)], Type) #

Convert a row to a list of pairs of labels and types

rowToSortedList :: Type -> ([(Label, Type)], Type) #

Convert a row to a list of pairs of labels and types, sorted by the labels.

rowFromList :: ([(Label, Type)], Type) -> Type #

Convert a list of labels and types to a row

isMonoType :: Type -> Bool #

Check whether a type is a monotype

mkForAll :: [Text] -> Type -> Type #

Universally quantify a type

replaceTypeVars :: Text -> Type -> Type -> Type #

Replace a type variable, taking into account variable shadowing

replaceAllTypeVars :: [(Text, Type)] -> Type -> Type #

Replace named type variables with types

usedTypeVariables :: Type -> [Text] #

Collect all type variables appearing in a type

freeTypeVariables :: Type -> [Text] #

Collect all free type variables appearing in a type

quantify :: Type -> Type #

Universally quantify over all type variables appearing free in a type

moveQuantifiersToFront :: Type -> Type #

Move all universal quantifiers to the front of a type

containsWildcards :: Type -> Bool #

Check if a type contains wildcards

containsForAll :: Type -> Bool #

Check if a type contains forall

everywhereOnTypesM :: Monad m => (Type -> m Type) -> Type -> m Type #

everythingOnTypes :: (r -> r -> r) -> (Type -> r) -> Type -> r #

everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type -> (s, r)) -> Type -> r #