purescript-0.13.0: 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

Instances
Eq SkolemScope Source # 
Instance details

Defined in Language.PureScript.Types

Ord SkolemScope Source # 
Instance details

Defined in Language.PureScript.Types

Show SkolemScope Source # 
Instance details

Defined in Language.PureScript.Types

Generic SkolemScope Source # 
Instance details

Defined in Language.PureScript.Types

Associated Types

type Rep SkolemScope :: Type -> Type #

NFData SkolemScope Source # 
Instance details

Defined in Language.PureScript.Types

Methods

rnf :: SkolemScope -> () #

ToJSON SkolemScope Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON SkolemScope Source # 
Instance details

Defined in Language.PureScript.Types

type Rep SkolemScope Source # 
Instance details

Defined in Language.PureScript.Types

type Rep SkolemScope = D1 (MetaData "SkolemScope" "Language.PureScript.Types" "purescript-0.13.0-1whdl2565Nb1wvlLK7uK18" True) (C1 (MetaCons "SkolemScope" PrefixI True) (S1 (MetaSel (Just "runSkolemScope") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data Type a Source #

The type of types

Constructors

TUnknown a Int

A unification variable of type Type

TypeVar a Text

A named type variable

TypeLevelString a PSString

A type-level string

TypeWildcard a (Maybe Text)

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

TypeConstructor a (Qualified (ProperName TypeName))

A type constructor

TypeOp a (Qualified (OpName TypeOpName))

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

TypeApp a (Type a) (Type a)

A type application

ForAll a Text (Maybe (Kind a)) (Type a) (Maybe SkolemScope)

Forall quantifier

ConstrainedType a (Constraint a) (Type a)

A type with a set of type class constraints

Skolem a Text Int SkolemScope

A skolem constant

REmpty a

An empty row

RCons a Label (Type a) (Type a)

A non-empty row

KindedType a (Type a) (Kind a)

A type with a kind annotation

BinaryNoParensType a (Type a) (Type a) (Type a)

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

ParensInType a (Type a)

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
Functor Type Source # 
Instance details

Defined in Language.PureScript.Types

Methods

fmap :: (a -> b) -> Type a -> Type b #

(<$) :: a -> Type b -> Type a #

Foldable Type Source # 
Instance details

Defined in Language.PureScript.Types

Methods

fold :: Monoid m => Type m -> m #

foldMap :: Monoid m => (a -> m) -> Type a -> m #

foldr :: (a -> b -> b) -> b -> Type a -> b #

foldr' :: (a -> b -> b) -> b -> Type a -> b #

foldl :: (b -> a -> b) -> b -> Type a -> b #

foldl' :: (b -> a -> b) -> b -> Type a -> b #

foldr1 :: (a -> a -> a) -> Type a -> a #

foldl1 :: (a -> a -> a) -> Type a -> a #

toList :: Type a -> [a] #

null :: Type a -> Bool #

length :: Type a -> Int #

elem :: Eq a => a -> Type a -> Bool #

maximum :: Ord a => Type a -> a #

minimum :: Ord a => Type a -> a #

sum :: Num a => Type a -> a #

product :: Num a => Type a -> a #

Traversable Type Source # 
Instance details

Defined in Language.PureScript.Types

Methods

traverse :: Applicative f => (a -> f b) -> Type a -> f (Type b) #

sequenceA :: Applicative f => Type (f a) -> f (Type a) #

mapM :: Monad m => (a -> m b) -> Type a -> m (Type b) #

sequence :: Monad m => Type (m a) -> m (Type a) #

Eq (Type a) Source # 
Instance details

Defined in Language.PureScript.Types

Methods

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

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

Ord (Type a) Source # 
Instance details

Defined in Language.PureScript.Types

Methods

compare :: Type a -> Type a -> Ordering #

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

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

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

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

max :: Type a -> Type a -> Type a #

min :: Type a -> Type a -> Type a #

Show a => Show (Type a) Source # 
Instance details

Defined in Language.PureScript.Types

Methods

showsPrec :: Int -> Type a -> ShowS #

show :: Type a -> String #

showList :: [Type a] -> ShowS #

Generic (Type a) Source # 
Instance details

Defined in Language.PureScript.Types

Associated Types

type Rep (Type a) :: Type -> Type #

Methods

from :: Type a -> Rep (Type a) x #

to :: Rep (Type a) x -> Type a #

NFData a => NFData (Type a) Source # 
Instance details

Defined in Language.PureScript.Types

Methods

rnf :: Type a -> () #

ToJSON a => ToJSON (Type a) Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON (Type ()) Source # 
Instance details

Defined in Language.PureScript.Types

Methods

parseJSON :: Value -> Parser (Type ()) #

parseJSONList :: Value -> Parser [Type ()] #

FromJSON a => FromJSON (Type a) Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON (Type SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Types

type Rep (Type a) Source # 
Instance details

Defined in Language.PureScript.Types

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

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 # 
Instance details

Defined in Language.PureScript.Types

Ord ConstraintData Source # 
Instance details

Defined in Language.PureScript.Types

Show ConstraintData Source # 
Instance details

Defined in Language.PureScript.Types

Generic ConstraintData Source # 
Instance details

Defined in Language.PureScript.Types

Associated Types

type Rep ConstraintData :: Type -> Type #

NFData ConstraintData Source # 
Instance details

Defined in Language.PureScript.Types

Methods

rnf :: ConstraintData -> () #

ToJSON ConstraintData Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON ConstraintData Source # 
Instance details

Defined in Language.PureScript.Types

type Rep ConstraintData Source # 
Instance details

Defined in Language.PureScript.Types

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

data Constraint a Source #

A typeclass constraint

Constructors

Constraint 

Fields

Instances
Functor Constraint Source # 
Instance details

Defined in Language.PureScript.Types

Methods

fmap :: (a -> b) -> Constraint a -> Constraint b #

(<$) :: a -> Constraint b -> Constraint a #

Foldable Constraint Source # 
Instance details

Defined in Language.PureScript.Types

Methods

fold :: Monoid m => Constraint m -> m #

foldMap :: Monoid m => (a -> m) -> Constraint a -> m #

foldr :: (a -> b -> b) -> b -> Constraint a -> b #

foldr' :: (a -> b -> b) -> b -> Constraint a -> b #

foldl :: (b -> a -> b) -> b -> Constraint a -> b #

foldl' :: (b -> a -> b) -> b -> Constraint a -> b #

foldr1 :: (a -> a -> a) -> Constraint a -> a #

foldl1 :: (a -> a -> a) -> Constraint a -> a #

toList :: Constraint a -> [a] #

null :: Constraint a -> Bool #

length :: Constraint a -> Int #

elem :: Eq a => a -> Constraint a -> Bool #

maximum :: Ord a => Constraint a -> a #

minimum :: Ord a => Constraint a -> a #

sum :: Num a => Constraint a -> a #

product :: Num a => Constraint a -> a #

Traversable Constraint Source # 
Instance details

Defined in Language.PureScript.Types

Methods

traverse :: Applicative f => (a -> f b) -> Constraint a -> f (Constraint b) #

sequenceA :: Applicative f => Constraint (f a) -> f (Constraint a) #

mapM :: Monad m => (a -> m b) -> Constraint a -> m (Constraint b) #

sequence :: Monad m => Constraint (m a) -> m (Constraint a) #

Eq (Constraint a) Source # 
Instance details

Defined in Language.PureScript.Types

Methods

(==) :: Constraint a -> Constraint a -> Bool #

(/=) :: Constraint a -> Constraint a -> Bool #

Ord (Constraint a) Source # 
Instance details

Defined in Language.PureScript.Types

Show a => Show (Constraint a) Source # 
Instance details

Defined in Language.PureScript.Types

Generic (Constraint a) Source # 
Instance details

Defined in Language.PureScript.Types

Associated Types

type Rep (Constraint a) :: Type -> Type #

Methods

from :: Constraint a -> Rep (Constraint a) x #

to :: Rep (Constraint a) x -> Constraint a #

NFData a => NFData (Constraint a) Source # 
Instance details

Defined in Language.PureScript.Types

Methods

rnf :: Constraint a -> () #

ToJSON a => ToJSON (Constraint a) Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON (Constraint ()) Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON a => FromJSON (Constraint a) Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON (Constraint SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Types

type Rep (Constraint a) Source # 
Instance details

Defined in Language.PureScript.Types

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

overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) Source #

typeToJSON :: forall a. (a -> Value) -> Type a -> Value Source #

constraintFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Constraint a) Source #

typeFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Type a) Source #

data RowListItem a Source #

Constructors

RowListItem 
Instances
Functor RowListItem Source # 
Instance details

Defined in Language.PureScript.Types

Methods

fmap :: (a -> b) -> RowListItem a -> RowListItem b #

(<$) :: a -> RowListItem b -> RowListItem a #

Foldable RowListItem Source # 
Instance details

Defined in Language.PureScript.Types

Methods

fold :: Monoid m => RowListItem m -> m #

foldMap :: Monoid m => (a -> m) -> RowListItem a -> m #

foldr :: (a -> b -> b) -> b -> RowListItem a -> b #

foldr' :: (a -> b -> b) -> b -> RowListItem a -> b #

foldl :: (b -> a -> b) -> b -> RowListItem a -> b #

foldl' :: (b -> a -> b) -> b -> RowListItem a -> b #

foldr1 :: (a -> a -> a) -> RowListItem a -> a #

foldl1 :: (a -> a -> a) -> RowListItem a -> a #

toList :: RowListItem a -> [a] #

null :: RowListItem a -> Bool #

length :: RowListItem a -> Int #

elem :: Eq a => a -> RowListItem a -> Bool #

maximum :: Ord a => RowListItem a -> a #

minimum :: Ord a => RowListItem a -> a #

sum :: Num a => RowListItem a -> a #

product :: Num a => RowListItem a -> a #

Traversable RowListItem Source # 
Instance details

Defined in Language.PureScript.Types

Methods

traverse :: Applicative f => (a -> f b) -> RowListItem a -> f (RowListItem b) #

sequenceA :: Applicative f => RowListItem (f a) -> f (RowListItem a) #

mapM :: Monad m => (a -> m b) -> RowListItem a -> m (RowListItem b) #

sequence :: Monad m => RowListItem (m a) -> m (RowListItem a) #

Show a => Show (RowListItem a) Source # 
Instance details

Defined in Language.PureScript.Types

Generic (RowListItem a) Source # 
Instance details

Defined in Language.PureScript.Types

Associated Types

type Rep (RowListItem a) :: Type -> Type #

Methods

from :: RowListItem a -> Rep (RowListItem a) x #

to :: Rep (RowListItem a) x -> RowListItem a #

type Rep (RowListItem a) Source # 
Instance details

Defined in Language.PureScript.Types

type Rep (RowListItem a) = D1 (MetaData "RowListItem" "Language.PureScript.Types" "purescript-0.13.0-1whdl2565Nb1wvlLK7uK18" False) (C1 (MetaCons "RowListItem" PrefixI True) (S1 (MetaSel (Just "rowListAnn") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a) :*: (S1 (MetaSel (Just "rowListLabel") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Label) :*: S1 (MetaSel (Just "rowListType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Type a)))))

rowToList :: Type a -> ([RowListItem a], Type a) Source #

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

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

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

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

Convert a list of labels and types to a row

isMonoType :: Type a -> Bool Source #

Check whether a type is a monotype

mkForAll :: [(a, (Text, Maybe (Kind a)))] -> Type a -> Type a Source #

Universally quantify a type

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

Replace a type variable, taking into account variable shadowing

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

Replace named type variables with types

usedTypeVariables :: Type a -> [Text] Source #

Collect all type variables appearing in a type

freeTypeVariables :: Type a -> [Text] Source #

Collect all free type variables appearing in a type

quantify :: Type a -> Type a Source #

Universally quantify over all type variables appearing free in a type

moveQuantifiersToFront :: Type a -> Type a Source #

Move all universal quantifiers to the front of a type

containsWildcards :: Type a -> Bool Source #

Check if a type contains wildcards

containsForAll :: Type a -> Bool Source #

Check if a type contains forall

everywhereOnTypes :: (Type a -> Type a) -> Type a -> Type a Source #

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

everywhereOnTypesTopDownM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) Source #

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

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

setAnnForType :: a -> Type a -> Type a Source #

eqType :: Type a -> Type b -> Bool Source #