purescript-0.11.7: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Types

Description

Data types for types

Synopsis

Documentation

newtype SkolemScope Source #

An identifier for the scope of a skolem variable

Constructors

SkolemScope 

Fields

data Type Source #

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 Source # 

Methods

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

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

Ord Type Source # 

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 Source # 

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Generic Type Source # 

Associated Types

type Rep Type :: * -> * #

Methods

from :: Type -> Rep Type x #

to :: Rep Type x -> Type #

FromJSON Type Source # 
ToJSON Type Source # 
NFData Type Source # 

Methods

rnf :: Type -> () #

type Rep Type Source # 
type Rep Type = D1 (MetaData "Type" "Language.PureScript.Types" "purescript-0.11.7-LYkkdaNPe76o3Ss2KvZX" 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 Source #

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 Source # 
Ord ConstraintData Source # 
Show ConstraintData Source # 
Generic ConstraintData Source # 

Associated Types

type Rep ConstraintData :: * -> * #

FromJSON ConstraintData Source # 
ToJSON ConstraintData Source # 
NFData ConstraintData Source # 

Methods

rnf :: ConstraintData -> () #

type Rep ConstraintData Source # 
type Rep ConstraintData = D1 (MetaData "ConstraintData" "Language.PureScript.Types" "purescript-0.11.7-LYkkdaNPe76o3Ss2KvZX" 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 Source #

A typeclass constraint

Constructors

Constraint 

Fields

Instances

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

Associated Types

type Rep Constraint :: * -> * #

FromJSON Constraint Source # 
ToJSON Constraint Source # 
NFData Constraint Source # 

Methods

rnf :: Constraint -> () #

type Rep Constraint Source # 
type Rep Constraint = D1 (MetaData "Constraint" "Language.PureScript.Types" "purescript-0.11.7-LYkkdaNPe76o3Ss2KvZX" 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) Source #

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

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

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

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

Convert a list of labels and types to a row

isMonoType :: Type -> Bool Source #

Check whether a type is a monotype

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

Universally quantify a type

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

Replace a type variable, taking into account variable shadowing

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

Replace named type variables with types

usedTypeVariables :: Type -> [Text] Source #

Collect all type variables appearing in a type

freeTypeVariables :: Type -> [Text] Source #

Collect all free type variables appearing in a type

quantify :: Type -> Type Source #

Universally quantify over all type variables appearing free in a type

moveQuantifiersToFront :: Type -> Type Source #

Move all universal quantifiers to the front of a type

containsWildcards :: Type -> Bool Source #

Check if a type contains wildcards

containsForAll :: Type -> Bool Source #

Check if a type contains forall

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

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