purescript-0.12.4: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript

Description

The main compiler module

Synopsis

Documentation

data Text #

A space efficient, packed, unboxed Unicode text type.

Instances
Hashable Text 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Text -> Int #

hash :: Text -> Int #

ToJSON Text 
Instance details

Defined in Data.Aeson.Types.ToJSON

KeyValue Object

Constructs a singleton HashMap. For calling functions that demand an Object for constructing objects. To be used in conjunction with mconcat. Prefer to use object where possible.

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

(.=) :: ToJSON v => Text -> v -> Object #

KeyValue Pair 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

(.=) :: ToJSON v => Text -> v -> Pair #

ToJSONKey Text 
Instance details

Defined in Data.Aeson.Types.ToJSON

FromJSON Text 
Instance details

Defined in Data.Aeson.Types.FromJSON

FromJSONKey Text 
Instance details

Defined in Data.Aeson.Types.FromJSON

Chunk Text 
Instance details

Defined in Data.Attoparsec.Internal.Types

Associated Types

type ChunkElem Text :: Type #

ToValue Text 
Instance details

Defined in Text.Blaze

ToMarkup Text 
Instance details

Defined in Text.Blaze

ToLogStr Text 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Text -> LogStr #

Print Text 
Instance details

Defined in Protolude.Show

Methods

hPutStr :: MonadIO m => Handle -> Text -> m () #

putStr :: MonadIO m => Text -> m () #

hPutStrLn :: MonadIO m => Handle -> Text -> m () #

putStrLn :: MonadIO m => Text -> m () #

putErrLn :: MonadIO m => Text -> m () #

StringConv ByteString Text 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> ByteString -> Text #

StringConv ByteString Text 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> ByteString -> Text #

StringConv String Text 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> String -> Text #

StringConv Text ByteString 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> Text -> ByteString #

StringConv Text ByteString 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> Text -> ByteString #

StringConv Text String 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> Text -> String #

StringConv Text Text 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> Text -> Text #

StringConv Text Text 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> Text0 -> Text #

StringConv Text Text 
Instance details

Defined in Protolude.Conv

Methods

strConv :: Leniency -> Text -> Text0 #

Monad m => Stream Text m Char 
Instance details

Defined in Text.Parsec.Prim

Methods

uncons :: Text -> m (Maybe (Char, Text)) #

FromPairs Value (DList Pair) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

fromPairs :: DList Pair -> Value

v ~ Value => KeyValuePair v (DList Pair) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

pair :: String -> v -> DList Pair

type State Text 
Instance details

Defined in Data.Attoparsec.Internal.Types

type State Text = Buffer
type ChunkElem Text 
Instance details

Defined in Data.Attoparsec.Internal.Types

type Item Text 
Instance details

Defined in Data.Text

type Item Text = Char
type Index Text 
Instance details

Defined in Lens.Micro.Platform

type Index Text = Int
type IxValue Text 
Instance details

Defined in Lens.Micro.Platform

newtype SupplyT m a Source #

Constructors

SupplyT 

Fields

Instances
MonadTrans SupplyT Source # 
Instance details

Defined in Control.Monad.Supply

Methods

lift :: Monad m => m a -> SupplyT m a #

MonadError e m => MonadError e (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply

Methods

throwError :: e -> SupplyT m a #

catchError :: SupplyT m a -> (e -> SupplyT m a) -> SupplyT m a #

MonadReader r m => MonadReader r (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply

Methods

ask :: SupplyT m r #

local :: (r -> r) -> SupplyT m a -> SupplyT m a #

reader :: (r -> a) -> SupplyT m a #

MonadWriter w m => MonadWriter w (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply

Methods

writer :: (a, w) -> SupplyT m a #

tell :: w -> SupplyT m () #

listen :: SupplyT m a -> SupplyT m (a, w) #

pass :: SupplyT m (a, w -> w) -> SupplyT m a #

Monad m => Monad (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply

Methods

(>>=) :: SupplyT m a -> (a -> SupplyT m b) -> SupplyT m b #

(>>) :: SupplyT m a -> SupplyT m b -> SupplyT m b #

return :: a -> SupplyT m a #

fail :: String -> SupplyT m a #

Functor m => Functor (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply

Methods

fmap :: (a -> b) -> SupplyT m a -> SupplyT m b #

(<$) :: a -> SupplyT m b -> SupplyT m a #

Monad m => Applicative (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply

Methods

pure :: a -> SupplyT m a #

(<*>) :: SupplyT m (a -> b) -> SupplyT m a -> SupplyT m b #

liftA2 :: (a -> b -> c) -> SupplyT m a -> SupplyT m b -> SupplyT m c #

(*>) :: SupplyT m a -> SupplyT m b -> SupplyT m b #

(<*) :: SupplyT m a -> SupplyT m b -> SupplyT m a #

MonadPlus m => MonadPlus (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply

Methods

mzero :: SupplyT m a #

mplus :: SupplyT m a -> SupplyT m a -> SupplyT m a #

MonadPlus m => Alternative (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply

Methods

empty :: SupplyT m a #

(<|>) :: SupplyT m a -> SupplyT m a -> SupplyT m a #

some :: SupplyT m a -> SupplyT m [a] #

many :: SupplyT m a -> SupplyT m [a] #

Monad m => MonadSupply (SupplyT m) Source # 
Instance details

Defined in Control.Monad.Supply.Class

evalSupplyT :: Functor m => Integer -> SupplyT m a -> m a Source #

data Comment Source #

Instances
Eq Comment Source # 
Instance details

Defined in Language.PureScript.Comments

Methods

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

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

Ord Comment Source # 
Instance details

Defined in Language.PureScript.Comments

Show Comment Source # 
Instance details

Defined in Language.PureScript.Comments

Generic Comment Source # 
Instance details

Defined in Language.PureScript.Comments

Associated Types

type Rep Comment :: Type -> Type #

Methods

from :: Comment -> Rep Comment x #

to :: Rep Comment x -> Comment #

NFData Comment Source # 
Instance details

Defined in Language.PureScript.Comments

Methods

rnf :: Comment -> () #

ToJSON Comment Source # 
Instance details

Defined in Language.PureScript.Comments

FromJSON Comment Source # 
Instance details

Defined in Language.PureScript.Comments

FromJSON (Kind SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Kinds

FromJSON (Constraint SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON (Type SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Types

type Rep Comment Source # 
Instance details

Defined in Language.PureScript.Comments

type Rep Comment = D1 (MetaData "Comment" "Language.PureScript.Comments" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "LineComment" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: C1 (MetaCons "BlockComment" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data SourceSpan Source #

Constructors

SourceSpan 

Fields

Instances
Eq SourceSpan Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Ord SourceSpan Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Show SourceSpan Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Generic SourceSpan Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Associated Types

type Rep SourceSpan :: Type -> Type #

NFData SourceSpan Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Methods

rnf :: SourceSpan -> () #

ToJSON SourceSpan Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

FromJSON SourceSpan Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

FromJSON (Kind SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Kinds

FromJSON (Constraint SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Types

FromJSON (Type SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Types

type Rep SourceSpan Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

type Rep SourceSpan = D1 (MetaData "SourceSpan" "Language.PureScript.AST.SourcePos" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "SourceSpan" PrefixI True) (S1 (MetaSel (Just "spanName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: (S1 (MetaSel (Just "spanStart") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourcePos) :*: S1 (MetaSel (Just "spanEnd") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourcePos))))

data SourcePos Source #

Source position information

Constructors

SourcePos 

Fields

Instances
Eq SourcePos Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Ord SourcePos Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Show SourcePos Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Generic SourcePos Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Associated Types

type Rep SourcePos :: Type -> Type #

NFData SourcePos Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

Methods

rnf :: SourcePos -> () #

ToJSON SourcePos Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

FromJSON SourcePos Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

type Rep SourcePos Source # 
Instance details

Defined in Language.PureScript.AST.SourcePos

type Rep SourcePos = D1 (MetaData "SourcePos" "Language.PureScript.AST.SourcePos" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "SourcePos" PrefixI True) (S1 (MetaSel (Just "sourcePosLine") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int) :*: S1 (MetaSel (Just "sourcePosColumn") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

type SourceAnn = (SourceSpan, [Comment]) Source #

Source annotation - position information and comments.

type HasCallStack = HasCallStack Source #

A compatibility wrapper for the GHC.Stack.HasCallStack constraint.

internalError :: HasCallStack => String -> a Source #

Exit with an error message and a crash report link.

data Fixity Source #

Fixity data for infix operators

Instances
Eq Fixity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Methods

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

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

Ord Fixity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Show Fixity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Generic Fixity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Associated Types

type Rep Fixity :: Type -> Type #

Methods

from :: Fixity -> Rep Fixity x #

to :: Rep Fixity x -> Fixity #

NFData Fixity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Methods

rnf :: Fixity -> () #

ToJSON Fixity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

type Rep Fixity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

type Rep Fixity = D1 (MetaData "Fixity" "Language.PureScript.AST.Operators" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "Fixity" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Associativity) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Precedence)))

data Associativity Source #

Associativity for infix operators

Constructors

Infixl 
Infixr 
Infix 
Instances
Eq Associativity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Ord Associativity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Show Associativity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Generic Associativity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Associated Types

type Rep Associativity :: Type -> Type #

NFData Associativity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

Methods

rnf :: Associativity -> () #

ToJSON Associativity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

FromJSON Associativity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

type Rep Associativity Source # 
Instance details

Defined in Language.PureScript.AST.Operators

type Rep Associativity = D1 (MetaData "Associativity" "Language.PureScript.AST.Operators" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "Infixl" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Infixr" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Infix" PrefixI False) (U1 :: Type -> Type)))

type Precedence = Integer Source #

A precedence level for an infix operator

data Qualified a Source #

A qualified name, i.e. a name with an optional module name

Constructors

Qualified (Maybe ModuleName) a 
Instances
Functor Qualified Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

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

Foldable Qualified Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

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

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

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

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

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

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

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

toList :: Qualified a -> [a] #

null :: Qualified a -> Bool #

length :: Qualified a -> Int #

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

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

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

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

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

Traversable Qualified Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

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

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

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

Eq a => Eq (Qualified a) Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

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

Ord a => Ord (Qualified a) Source # 
Instance details

Defined in Language.PureScript.Names

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

Defined in Language.PureScript.Names

Generic (Qualified a) Source # 
Instance details

Defined in Language.PureScript.Names

Associated Types

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

Methods

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

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

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

Defined in Language.PureScript.Names

Methods

rnf :: Qualified a -> () #

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

Defined in Language.PureScript.Names

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

Defined in Language.PureScript.Names

type Rep (Qualified a) Source # 
Instance details

Defined in Language.PureScript.Names

type Rep (Qualified a) = D1 (MetaData "Qualified" "Language.PureScript.Names" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "Qualified" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe ModuleName)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))

newtype ModuleName Source #

Module names

Instances
Eq ModuleName Source # 
Instance details

Defined in Language.PureScript.Names

Ord ModuleName Source # 
Instance details

Defined in Language.PureScript.Names

Show ModuleName Source # 
Instance details

Defined in Language.PureScript.Names

Generic ModuleName Source # 
Instance details

Defined in Language.PureScript.Names

Associated Types

type Rep ModuleName :: Type -> Type #

NFData ModuleName Source # 
Instance details

Defined in Language.PureScript.Names

Methods

rnf :: ModuleName -> () #

ToJSON ModuleName Source # 
Instance details

Defined in Language.PureScript.Names

FromJSON ModuleName Source # 
Instance details

Defined in Language.PureScript.Names

type Rep ModuleName Source # 
Instance details

Defined in Language.PureScript.Names

type Rep ModuleName = D1 (MetaData "ModuleName" "Language.PureScript.Names" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" True) (C1 (MetaCons "ModuleName" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [ProperName Namespace])))

data ProperNameType Source #

The closed set of proper name types.

newtype ProperName (a :: ProperNameType) Source #

Proper names, i.e. capitalized names for e.g. module names, type//data constructors.

Constructors

ProperName 

Fields

Instances
Eq (ProperName a) Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

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

Ord (ProperName a) Source # 
Instance details

Defined in Language.PureScript.Names

Show (ProperName a) Source # 
Instance details

Defined in Language.PureScript.Names

Generic (ProperName a) Source # 
Instance details

Defined in Language.PureScript.Names

Associated Types

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

Methods

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

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

NFData (ProperName a) Source # 
Instance details

Defined in Language.PureScript.Names

Methods

rnf :: ProperName a -> () #

ToJSON (ProperName a) Source # 
Instance details

Defined in Language.PureScript.Names

FromJSON (ProperName a) Source # 
Instance details

Defined in Language.PureScript.Names

type Rep (ProperName a) Source # 
Instance details

Defined in Language.PureScript.Names

type Rep (ProperName a) = D1 (MetaData "ProperName" "Language.PureScript.Names" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" True) (C1 (MetaCons "ProperName" PrefixI True) (S1 (MetaSel (Just "runProperName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data OpNameType Source #

The closed set of operator alias types.

newtype OpName (a :: OpNameType) Source #

Operator alias names.

Constructors

OpName 

Fields

Instances
Eq (OpName a) Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

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

Ord (OpName a) Source # 
Instance details

Defined in Language.PureScript.Names

Methods

compare :: OpName a -> OpName a -> Ordering #

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

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

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

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

max :: OpName a -> OpName a -> OpName a #

min :: OpName a -> OpName a -> OpName a #

Show (OpName a) Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

show :: OpName a -> String #

showList :: [OpName a] -> ShowS #

Generic (OpName a) Source # 
Instance details

Defined in Language.PureScript.Names

Associated Types

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

Methods

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

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

NFData (OpName a) Source # 
Instance details

Defined in Language.PureScript.Names

Methods

rnf :: OpName a -> () #

ToJSON (OpName a) Source # 
Instance details

Defined in Language.PureScript.Names

FromJSON (OpName a) Source # 
Instance details

Defined in Language.PureScript.Names

type Rep (OpName a) Source # 
Instance details

Defined in Language.PureScript.Names

type Rep (OpName a) = D1 (MetaData "OpName" "Language.PureScript.Names" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" True) (C1 (MetaCons "OpName" PrefixI True) (S1 (MetaSel (Just "runOpName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data Ident Source #

Names for value identifiers

Constructors

Ident Text

An alphanumeric identifier

GenIdent (Maybe Text) Integer

A generated name for an identifier

UnusedIdent

A generated name used only for type-checking

Instances
Eq Ident Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

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

Ord Ident Source # 
Instance details

Defined in Language.PureScript.Names

Methods

compare :: Ident -> Ident -> Ordering #

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

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

(>) :: Ident -> Ident -> Bool #

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

max :: Ident -> Ident -> Ident #

min :: Ident -> Ident -> Ident #

Show Ident Source # 
Instance details

Defined in Language.PureScript.Names

Methods

showsPrec :: Int -> Ident -> ShowS #

show :: Ident -> String #

showList :: [Ident] -> ShowS #

Generic Ident Source # 
Instance details

Defined in Language.PureScript.Names

Associated Types

type Rep Ident :: Type -> Type #

Methods

from :: Ident -> Rep Ident x #

to :: Rep Ident x -> Ident #

NFData Ident Source # 
Instance details

Defined in Language.PureScript.Names

Methods

rnf :: Ident -> () #

ToJSON Ident Source # 
Instance details

Defined in Language.PureScript.Names

FromJSON Ident Source # 
Instance details

Defined in Language.PureScript.Names

type Rep Ident Source # 
Instance details

Defined in Language.PureScript.Names

data Name Source #

A sum of the possible name types, useful for error and lint messages.

Instances
Eq Name Source # 
Instance details

Defined in Language.PureScript.Names

Methods

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

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

Ord Name Source # 
Instance details

Defined in Language.PureScript.Names

Methods

compare :: Name -> Name -> Ordering #

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

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

(>) :: Name -> Name -> Bool #

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

max :: Name -> Name -> Name #

min :: Name -> Name -> Name #

Show Name Source # 
Instance details

Defined in Language.PureScript.Names

Methods

showsPrec :: Int -> Name -> ShowS #

show :: Name -> String #

showList :: [Name] -> ShowS #

Generic Name Source # 
Instance details

Defined in Language.PureScript.Names

Associated Types

type Rep Name :: Type -> Type #

Methods

from :: Name -> Rep Name x #

to :: Rep Name x -> Name #

NFData Name Source # 
Instance details

Defined in Language.PureScript.Names

Methods

rnf :: Name -> () #

type Rep Name Source # 
Instance details

Defined in Language.PureScript.Names

coerceProperName :: ProperName a -> ProperName b Source #

Coerces a ProperName from one ProperNameType to another. This should be used with care, and is primarily used to convert ClassNames into TypeNames after classes have been desugared.

qualify :: ModuleName -> Qualified a -> (ModuleName, a) Source #

Provide a default module name, if a name is unqualified

mkQualified :: a -> ModuleName -> Qualified a Source #

Makes a qualified value from a name and module name.

disqualify :: Qualified a -> a Source #

Remove the module name from a qualified name

disqualifyFor :: Maybe ModuleName -> Qualified a -> Maybe a Source #

Remove the qualification from a value when it is qualified with a particular module name.

isQualified :: Qualified a -> Bool Source #

Checks whether a qualified value is actually qualified with a module reference

isUnqualified :: Qualified a -> Bool Source #

Checks whether a qualified value is not actually qualified with a module reference

isQualifiedWith :: ModuleName -> Qualified a -> Bool Source #

Checks whether a qualified value is qualified with a particular module

data Kind a Source #

The data type of kinds

Constructors

KUnknown a Int

Unification variable of type Kind

Row a (Kind a)

Kinds for labelled, unordered rows without duplicates

FunKind a (Kind a) (Kind a)

Function kinds

NamedKind a (Qualified (ProperName KindName))

A named kind

Instances
Functor Kind Source # 
Instance details

Defined in Language.PureScript.Kinds

Methods

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

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

Foldable Kind Source # 
Instance details

Defined in Language.PureScript.Kinds

Methods

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

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

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

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

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

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

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

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

toList :: Kind a -> [a] #

null :: Kind a -> Bool #

length :: Kind a -> Int #

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

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

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

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

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

Traversable Kind Source # 
Instance details

Defined in Language.PureScript.Kinds

Methods

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

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

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

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

Eq (Kind a) Source # 
Instance details

Defined in Language.PureScript.Kinds

Methods

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

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

Ord (Kind a) Source # 
Instance details

Defined in Language.PureScript.Kinds

Methods

compare :: Kind a -> Kind a -> Ordering #

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

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

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

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

max :: Kind a -> Kind a -> Kind a #

min :: Kind a -> Kind a -> Kind a #

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

Defined in Language.PureScript.Kinds

Methods

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

show :: Kind a -> String #

showList :: [Kind a] -> ShowS #

Generic (Kind a) Source # 
Instance details

Defined in Language.PureScript.Kinds

Associated Types

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

Methods

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

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

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

Defined in Language.PureScript.Kinds

Methods

rnf :: Kind a -> () #

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

Defined in Language.PureScript.Kinds

FromJSON (Kind ()) Source # 
Instance details

Defined in Language.PureScript.Kinds

Methods

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

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

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

Defined in Language.PureScript.Kinds

FromJSON (Kind SourceAnn) Source # 
Instance details

Defined in Language.PureScript.Kinds

type Rep (Kind a) Source # 
Instance details

Defined in Language.PureScript.Kinds

kindToJSON :: forall a. (a -> Value) -> Kind a -> Value Source #

kindFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Kind a) Source #

everywhereOnKinds :: (Kind a -> Kind a) -> Kind a -> Kind a Source #

everywhereOnKindsM :: Monad m => (Kind a -> m (Kind a)) -> Kind a -> m (Kind a) Source #

everythingOnKinds :: (r -> r -> r) -> (Kind a -> r) -> Kind a -> r Source #

setAnnForKind :: a -> Kind a -> Kind a Source #

eqKind :: Kind a -> Kind b -> Bool Source #

data Options Source #

The data type of compiler options

Constructors

Options 

Fields

Instances
Show Options Source # 
Instance details

Defined in Language.PureScript.Options

MonadReader Options Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

Methods

ask :: Make Options #

local :: (Options -> Options) -> Make a -> Make a #

reader :: (Options -> a) -> Make a #

prettyPrintString :: PSString -> Text Source #

Pretty print a PSString, using Haskell/PureScript escape sequences. This is identical to the Show instance except that we get a Text out instead of a String.

data Literal a Source #

Data type for literal values. Parameterised so it can be used for Exprs and Binders.

Constructors

NumericLiteral (Either Integer Double)

A numeric literal

StringLiteral PSString

A string literal

CharLiteral Char

A character literal

BooleanLiteral Bool

A boolean literal

ArrayLiteral [a]

An array literal

ObjectLiteral [(PSString, a)]

An object literal

Instances
Functor Literal Source # 
Instance details

Defined in Language.PureScript.AST.Literals

Methods

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

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

Eq a => Eq (Literal a) Source # 
Instance details

Defined in Language.PureScript.AST.Literals

Methods

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

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

Ord a => Ord (Literal a) Source # 
Instance details

Defined in Language.PureScript.AST.Literals

Methods

compare :: Literal a -> Literal a -> Ordering #

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

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

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

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

max :: Literal a -> Literal a -> Literal a #

min :: Literal a -> Literal a -> Literal a #

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

Defined in Language.PureScript.AST.Literals

Methods

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

show :: Literal a -> String #

showList :: [Literal a] -> ShowS #

data ParseState Source #

State for the parser monad

Constructors

ParseState 

Fields

data PositionedToken Source #

Constructors

PositionedToken 

Fields

data Token Source #

Instances
Eq Token Source # 
Instance details

Defined in Language.PureScript.Parser.Lexer

Methods

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

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

Ord Token Source # 
Instance details

Defined in Language.PureScript.Parser.Lexer

Methods

compare :: Token -> Token -> Ordering #

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

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

(>) :: Token -> Token -> Bool #

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

max :: Token -> Token -> Token #

min :: Token -> Token -> Token #

Show Token Source # 
Instance details

Defined in Language.PureScript.Parser.Lexer

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

lexLenient :: FilePath -> Text -> Either ParseError [PositionedToken] Source #

Lexes the given file, and on encountering a parse error, returns the progress made up to that point, instead of returning an error

semiSep :: TokenParser a -> TokenParser [a] Source #

Parse zero or more values separated by semicolons

semiSep1 :: TokenParser a -> TokenParser [a] Source #

Parse one or more values separated by semicolons

commaSep :: TokenParser a -> TokenParser [a] Source #

Parse zero or more values separated by commas

commaSep1 :: TokenParser a -> TokenParser [a] Source #

Parse one or more values separated by commas

reservedPsNames :: [Text] Source #

A list of purescript reserved identifiers

isSymbolChar :: Char -> Bool Source #

The characters allowed for use in operators

isUnquotedKey :: Text -> Bool Source #

Strings allowed to be left unquoted in a record key

properName :: TokenParser (ProperName a) Source #

Parse a general proper name.

typeName :: TokenParser (ProperName TypeName) Source #

Parse a proper name for a type.

kindName :: TokenParser (ProperName KindName) Source #

Parse a proper name for a kind.

dataConstructorName :: TokenParser (ProperName ConstructorName) Source #

Parse a proper name for a data constructor.

moduleName :: TokenParser ModuleName Source #

Parse a module name

parseQualified :: TokenParser a -> TokenParser (Qualified a) Source #

Parse a qualified name, i.e. M.name or just name

parseIdent :: TokenParser Ident Source #

Parse an identifier.

parseLabel :: TokenParser PSString Source #

Parse a label, which may look like an identifier or a string

parseOperator :: TokenParser (OpName a) Source #

Parse an operator.

augment :: Stream s m t => ParsecT s u m a -> ParsecT s u m b -> (a -> b -> a) -> ParsecT s u m a Source #

Run the first parser, then match the second if possible, applying the specified function on a successful match

fold :: ParsecT s u m a -> ParsecT s u m b -> (a -> b -> a) -> ParsecT s u m a Source #

Run the first parser, then match the second zero or more times, applying the specified function for each match

buildPostfixParser :: Stream s m t => [a -> ParsecT s u m a] -> ParsecT s u m a -> ParsecT s u m a Source #

Build a parser from a smaller parser and a list of parsers for postfix operators

mark :: Parsec s ParseState a -> Parsec s ParseState a Source #

Mark the current indentation level

checkIndentation :: (Column -> Text) -> (Column -> Column -> Bool) -> Parsec s ParseState () Source #

Check that the current identation level matches a predicate

indented :: Parsec s ParseState () Source #

Check that the current indentation level is past the current mark

same :: Parsec s ParseState () Source #

Check that the current indentation level is at the same indentation as the current mark

readComments :: Parsec [PositionedToken] u [Comment] Source #

Read the comments from the the next token, without consuming it

toSourcePos :: SourcePos -> SourcePos Source #

Convert from Parsec sourcepos

withSourceSpan :: (SourceSpan -> [Comment] -> a -> b) -> Parsec [PositionedToken] u a -> Parsec [PositionedToken] u b Source #

Read source position information and comments

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.12.4-4431FMqBZsLBJwEgpbTTth" 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)))))

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.12.4-4431FMqBZsLBJwEgpbTTth" 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)))))

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.12.4-4431FMqBZsLBJwEgpbTTth" 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 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 (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.12.4-4431FMqBZsLBJwEgpbTTth" 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 (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)))))))

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.12.4-4431FMqBZsLBJwEgpbTTth" True) (C1 (MetaCons "SkolemScope" PrefixI True) (S1 (MetaSel (Just "runSkolemScope") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

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 #

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)] -> 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 #

data DataDeclType Source #

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

Constructors

Data

A standard data constructor

Newtype

A newtype constructor

Instances
Eq DataDeclType Source # 
Instance details

Defined in Language.PureScript.Environment

Ord DataDeclType Source # 
Instance details

Defined in Language.PureScript.Environment

Show DataDeclType Source # 
Instance details

Defined in Language.PureScript.Environment

Generic DataDeclType Source # 
Instance details

Defined in Language.PureScript.Environment

Associated Types

type Rep DataDeclType :: Type -> Type #

NFData DataDeclType Source # 
Instance details

Defined in Language.PureScript.Environment

Methods

rnf :: DataDeclType -> () #

ToJSON DataDeclType Source # 
Instance details

Defined in Language.PureScript.Environment

FromJSON DataDeclType Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep DataDeclType Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep DataDeclType = D1 (MetaData "DataDeclType" "Language.PureScript.Environment" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "Data" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Newtype" PrefixI False) (U1 :: Type -> Type))

data TypeKind Source #

The kinds of a type

Constructors

DataType [(Text, Maybe SourceKind)] [(ProperName ConstructorName, [SourceType])]

Data type

TypeSynonym

Type synonym

ExternData

Foreign data

LocalTypeVariable

A local type variable

ScopedTypeVar

A scoped type variable

Instances
Eq TypeKind Source # 
Instance details

Defined in Language.PureScript.Environment

Show TypeKind Source # 
Instance details

Defined in Language.PureScript.Environment

Generic TypeKind Source # 
Instance details

Defined in Language.PureScript.Environment

Associated Types

type Rep TypeKind :: Type -> Type #

Methods

from :: TypeKind -> Rep TypeKind x #

to :: Rep TypeKind x -> TypeKind #

NFData TypeKind Source # 
Instance details

Defined in Language.PureScript.Environment

Methods

rnf :: TypeKind -> () #

ToJSON TypeKind Source # 
Instance details

Defined in Language.PureScript.Environment

FromJSON TypeKind Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep TypeKind Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep TypeKind = D1 (MetaData "TypeKind" "Language.PureScript.Environment" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) ((C1 (MetaCons "DataType" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(Text, Maybe SourceKind)]) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(ProperName ConstructorName, [SourceType])])) :+: C1 (MetaCons "TypeSynonym" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "ExternData" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "LocalTypeVariable" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "ScopedTypeVar" PrefixI False) (U1 :: Type -> Type))))

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

Instances
Eq NameKind Source # 
Instance details

Defined in Language.PureScript.Environment

Show NameKind Source # 
Instance details

Defined in Language.PureScript.Environment

Generic NameKind Source # 
Instance details

Defined in Language.PureScript.Environment

Associated Types

type Rep NameKind :: Type -> Type #

Methods

from :: NameKind -> Rep NameKind x #

to :: Rep NameKind x -> NameKind #

NFData NameKind Source # 
Instance details

Defined in Language.PureScript.Environment

Methods

rnf :: NameKind -> () #

type Rep NameKind Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep NameKind = D1 (MetaData "NameKind" "Language.PureScript.Environment" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "Private" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Public" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "External" PrefixI False) (U1 :: Type -> Type)))

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

Instances
Eq NameVisibility Source # 
Instance details

Defined in Language.PureScript.Environment

Show NameVisibility Source # 
Instance details

Defined in Language.PureScript.Environment

Generic NameVisibility Source # 
Instance details

Defined in Language.PureScript.Environment

Associated Types

type Rep NameVisibility :: Type -> Type #

NFData NameVisibility Source # 
Instance details

Defined in Language.PureScript.Environment

Methods

rnf :: NameVisibility -> () #

type Rep NameVisibility Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep NameVisibility = D1 (MetaData "NameVisibility" "Language.PureScript.Environment" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "Undefined" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Defined" PrefixI False) (U1 :: Type -> Type))

data FunctionalDependency Source #

A functional dependency indicates a relationship between two sets of type arguments in a class declaration.

Constructors

FunctionalDependency 

Fields

Instances
Show FunctionalDependency Source # 
Instance details

Defined in Language.PureScript.Environment

Generic FunctionalDependency Source # 
Instance details

Defined in Language.PureScript.Environment

Associated Types

type Rep FunctionalDependency :: Type -> Type #

NFData FunctionalDependency Source # 
Instance details

Defined in Language.PureScript.Environment

Methods

rnf :: FunctionalDependency -> () #

ToJSON FunctionalDependency Source # 
Instance details

Defined in Language.PureScript.Environment

FromJSON FunctionalDependency Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep FunctionalDependency Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep FunctionalDependency = D1 (MetaData "FunctionalDependency" "Language.PureScript.Environment" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "FunctionalDependency" PrefixI True) (S1 (MetaSel (Just "fdDeterminers") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Int]) :*: S1 (MetaSel (Just "fdDetermined") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Int])))

data TypeClassData Source #

Information about a type class

Constructors

TypeClassData 

Fields

Instances
Show TypeClassData Source # 
Instance details

Defined in Language.PureScript.Environment

Generic TypeClassData Source # 
Instance details

Defined in Language.PureScript.Environment

Associated Types

type Rep TypeClassData :: Type -> Type #

NFData TypeClassData Source # 
Instance details

Defined in Language.PureScript.Environment

Methods

rnf :: TypeClassData -> () #

type Rep TypeClassData Source # 
Instance details

Defined in Language.PureScript.Environment

type Rep TypeClassData = D1 (MetaData "TypeClassData" "Language.PureScript.Environment" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "TypeClassData" PrefixI True) ((S1 (MetaSel (Just "typeClassArguments") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(Text, Maybe SourceKind)]) :*: (S1 (MetaSel (Just "typeClassMembers") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(Ident, SourceType)]) :*: S1 (MetaSel (Just "typeClassSuperclasses") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [SourceConstraint]))) :*: (S1 (MetaSel (Just "typeClassDependencies") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FunctionalDependency]) :*: (S1 (MetaSel (Just "typeClassDeterminedArguments") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set Int)) :*: S1 (MetaSel (Just "typeClassCoveringSets") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set (Set Int)))))))

data Environment Source #

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

Constructors

Environment 

Fields

Instances
Show Environment Source # 
Instance details

Defined in Language.PureScript.Environment

Generic Environment Source # 
Instance details

Defined in Language.PureScript.Environment

Associated Types

type Rep Environment :: Type -> Type #

NFData Environment Source # 
Instance details

Defined in Language.PureScript.Environment

Methods

rnf :: Environment -> () #

type Rep Environment Source # 
Instance details

Defined in Language.PureScript.Environment

initEnvironment :: Environment Source #

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

makeTypeClassData :: [(Text, Maybe SourceKind)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> TypeClassData Source #

A constructor for TypeClassData that computes which type class arguments are fully determined and argument covering sets. Fully determined means that this argument cannot be used when selecting a type class instance. A covering set is a minimal collection of arguments that can be used to find an instance and therefore determine all other type arguments.

An example of the difference between determined and fully determined would be with the class: ```class C a b c | a -> b, b -> a, b -> c``` In this case, a must differ when b differs, and vice versa - each is determined by the other. Both a and b can be used in selecting a type class instance. However, c cannot - it is fully determined by a and b.

Define a graph of type class arguments with edges being fundep determiners to determined. Each argument also has a self looping edge. An argument is fully determined if doesn't appear at the start of a path of strongly connected components. An argument is not fully determined otherwise.

The way we compute this is by saying: an argument X is fully determined if there are arguments that determine X that X does not determine. This is the same thing: everything X determines includes everything in its SCC, and everything determining X is either before it in an SCC path, or in the same SCC.

primName :: Text -> Qualified (ProperName a) Source #

Construct a ProperName in the Prim module

primSubName :: Text -> Text -> Qualified (ProperName a) Source #

Construct a ProperName in the Prim.NAME module.

kindType :: SourceKind Source #

Kind of ground types

primTy :: Text -> SourceType Source #

Construct a type in the Prim module

tyFunction :: SourceType Source #

Type constructor for functions

tyString :: SourceType Source #

Type constructor for strings

tyChar :: SourceType Source #

Type constructor for strings

tyNumber :: SourceType Source #

Type constructor for numbers

tyInt :: SourceType Source #

Type constructor for integers

tyBoolean :: SourceType Source #

Type constructor for booleans

tyArray :: SourceType Source #

Type constructor for arrays

tyRecord :: SourceType Source #

Type constructor for records

isObject :: Type a -> Bool Source #

Check whether a type is a record

isFunction :: Type a -> Bool Source #

Check whether a type is a function

function :: SourceType -> SourceType -> SourceType Source #

Smart constructor for function types

primTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #

The primitive types in the external javascript environment with their associated kinds. There are also pseudo Fail, Warn, and Partial types that correspond to the classes with the same names.

allPrimTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #

This Map contains all of the prim types from all Prim modules.

primClasses :: Map (Qualified (ProperName ClassName)) TypeClassData Source #

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

allPrimClasses :: Map (Qualified (ProperName ClassName)) TypeClassData Source #

This contains all of the type classes from all Prim modules.

lookupConstructor :: Environment -> Qualified (ProperName ConstructorName) -> (DataDeclType, ProperName TypeName, SourceType, [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 (SourceType, NameKind, NameVisibility) Source #

Finds information about values from the current environment.

noForAll :: TokenParser SourceType -> TokenParser SourceType Source #

Parse an atomic type with no forall

parseTypeAtom :: TokenParser SourceType Source #

Parse a type as it appears in e.g. a data constructor

noWildcards :: TokenParser SourceType -> TokenParser SourceType Source #

Parse an atomic type with no wildcards

data Binder Source #

Data type for binders

Constructors

NullBinder

Wildcard binder

LiteralBinder SourceSpan (Literal Binder)

A binder which matches a literal

VarBinder SourceSpan Ident

A binder which binds an identifier

ConstructorBinder SourceSpan (Qualified (ProperName ConstructorName)) [Binder]

A binder which matches a data constructor

OpBinder SourceSpan (Qualified (OpName ValueOpName))

A operator alias binder. During the rebracketing phase of desugaring, this data constructor will be removed.

BinaryNoParensBinder Binder Binder Binder

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

ParensInBinder Binder

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.

NamedBinder SourceSpan Ident Binder

A binder which binds its input to an identifier

PositionedBinder SourceSpan [Comment] Binder

A binder with source position information

TypedBinder SourceType Binder

A binder with a type annotation

Instances
Eq Binder Source # 
Instance details

Defined in Language.PureScript.AST.Binders

Methods

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

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

Ord Binder Source # 
Instance details

Defined in Language.PureScript.AST.Binders

Show Binder Source # 
Instance details

Defined in Language.PureScript.AST.Binders

binderNames :: Binder -> [Ident] Source #

Collect all names introduced in binders in an expression

newtype AssocList k t Source #

Constructors

AssocList 

Fields

Instances
Functor (AssocList k) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

fmap :: (a -> b) -> AssocList k a -> AssocList k b #

(<$) :: a -> AssocList k b -> AssocList k a #

Foldable (AssocList k) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

fold :: Monoid m => AssocList k m -> m #

foldMap :: Monoid m => (a -> m) -> AssocList k a -> m #

foldr :: (a -> b -> b) -> b -> AssocList k a -> b #

foldr' :: (a -> b -> b) -> b -> AssocList k a -> b #

foldl :: (b -> a -> b) -> b -> AssocList k a -> b #

foldl' :: (b -> a -> b) -> b -> AssocList k a -> b #

foldr1 :: (a -> a -> a) -> AssocList k a -> a #

foldl1 :: (a -> a -> a) -> AssocList k a -> a #

toList :: AssocList k a -> [a] #

null :: AssocList k a -> Bool #

length :: AssocList k a -> Int #

elem :: Eq a => a -> AssocList k a -> Bool #

maximum :: Ord a => AssocList k a -> a #

minimum :: Ord a => AssocList k a -> a #

sum :: Num a => AssocList k a -> a #

product :: Num a => AssocList k a -> a #

Traversable (AssocList k) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

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

sequenceA :: Applicative f => AssocList k (f a) -> f (AssocList k a) #

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

sequence :: Monad m => AssocList k (m a) -> m (AssocList k a) #

(Eq k, Eq t) => Eq (AssocList k t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

(==) :: AssocList k t -> AssocList k t -> Bool #

(/=) :: AssocList k t -> AssocList k t -> Bool #

(Ord k, Ord t) => Ord (AssocList k t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

compare :: AssocList k t -> AssocList k t -> Ordering #

(<) :: AssocList k t -> AssocList k t -> Bool #

(<=) :: AssocList k t -> AssocList k t -> Bool #

(>) :: AssocList k t -> AssocList k t -> Bool #

(>=) :: AssocList k t -> AssocList k t -> Bool #

max :: AssocList k t -> AssocList k t -> AssocList k t #

min :: AssocList k t -> AssocList k t -> AssocList k t #

(Show k, Show t) => Show (AssocList k t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

showsPrec :: Int -> AssocList k t -> ShowS #

show :: AssocList k t -> String #

showList :: [AssocList k t] -> ShowS #

data PathNode t Source #

Constructors

Leaf t 
Branch (PathTree t) 
Instances
Functor PathNode Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

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

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

Foldable PathNode Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

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

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

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

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

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

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

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

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

toList :: PathNode a -> [a] #

null :: PathNode a -> Bool #

length :: PathNode a -> Int #

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

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

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

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

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

Traversable PathNode Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

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

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

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

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

Eq t => Eq (PathNode t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

(==) :: PathNode t -> PathNode t -> Bool #

(/=) :: PathNode t -> PathNode t -> Bool #

Ord t => Ord (PathNode t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

compare :: PathNode t -> PathNode t -> Ordering #

(<) :: PathNode t -> PathNode t -> Bool #

(<=) :: PathNode t -> PathNode t -> Bool #

(>) :: PathNode t -> PathNode t -> Bool #

(>=) :: PathNode t -> PathNode t -> Bool #

max :: PathNode t -> PathNode t -> PathNode t #

min :: PathNode t -> PathNode t -> PathNode t #

Show t => Show (PathNode t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

showsPrec :: Int -> PathNode t -> ShowS #

show :: PathNode t -> String #

showList :: [PathNode t] -> ShowS #

newtype PathTree t Source #

Constructors

PathTree (AssocList PSString (PathNode t)) 
Instances
Functor PathTree Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

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

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

Foldable PathTree Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

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

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

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

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

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

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

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

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

toList :: PathTree a -> [a] #

null :: PathTree a -> Bool #

length :: PathTree a -> Int #

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

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

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

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

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

Traversable PathTree Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

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

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

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

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

Eq t => Eq (PathTree t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

(==) :: PathTree t -> PathTree t -> Bool #

(/=) :: PathTree t -> PathTree t -> Bool #

Ord t => Ord (PathTree t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

compare :: PathTree t -> PathTree t -> Ordering #

(<) :: PathTree t -> PathTree t -> Bool #

(<=) :: PathTree t -> PathTree t -> Bool #

(>) :: PathTree t -> PathTree t -> Bool #

(>=) :: PathTree t -> PathTree t -> Bool #

max :: PathTree t -> PathTree t -> PathTree t #

min :: PathTree t -> PathTree t -> PathTree t #

Show t => Show (PathTree t) Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

showsPrec :: Int -> PathTree t -> ShowS #

show :: PathTree t -> String #

showList :: [PathTree t] -> ShowS #

data DoNotationElement Source #

A statement in a do-notation block

Constructors

DoNotationValue Expr

A monadic value without a binder

DoNotationBind Binder Expr

A monadic value with a binder

DoNotationLet [Declaration]

A let statement, i.e. a pure value with a binder

PositionedDoNotationElement SourceSpan [Comment] DoNotationElement

A do notation element with source position information

data CaseAlternative Source #

An alternative in a case statement

Constructors

CaseAlternative 

Fields

data WhereProvenance Source #

Metadata that tells where a let binding originated

Constructors

FromWhere

The let binding was originally a where clause

FromLet

The let binding was always a let binding

data Expr Source #

Data type for expressions and terms

Constructors

Literal SourceSpan (Literal Expr)

A literal value

UnaryMinus SourceSpan Expr

A prefix -, will be desugared

BinaryNoParens Expr Expr Expr

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

Parens Expr

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.

Accessor PSString Expr

An record property accessor expression (e.g. `obj.x` or `_.x`). Anonymous arguments will be removed during desugaring and expanded into a lambda that reads a property from a record.

ObjectUpdate Expr [(PSString, Expr)]

Partial record update

ObjectUpdateNested Expr (PathTree Expr)

Object updates with nested support: `x { foo { bar = e } }` Replaced during desugaring into a Let and nested ObjectUpdates

Abs Binder Expr

Function introduction

App Expr Expr

Function application

Var SourceSpan (Qualified Ident)

Variable

Op SourceSpan (Qualified (OpName ValueOpName))

An operator. This will be desugared into a function during the "operators" phase of desugaring.

IfThenElse Expr Expr Expr

Conditional (if-then-else expression)

Constructor SourceSpan (Qualified (ProperName ConstructorName))

A data constructor

Case [Expr] [CaseAlternative]

A case expression. During the case expansion phase of desugaring, top-level binders will get desugared into case expressions, hence the need for guards and multiple binders per branch here.

TypedValue Bool Expr SourceType

A value with a type annotation

Let WhereProvenance [Declaration] Expr

A let binding

Do (Maybe ModuleName) [DoNotationElement]

A do-notation block

Ado (Maybe ModuleName) [DoNotationElement] Expr

An ado-notation block

TypeClassDictionaryConstructorApp (Qualified (ProperName ClassName)) Expr

An application of a typeclass dictionary constructor. The value should be an ObjectLiteral.

TypeClassDictionary SourceConstraint (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) [ErrorMessageHint]

A placeholder for a type class dictionary to be inserted later. At the end of type checking, these placeholders will be replaced with actual expressions representing type classes dictionaries which can be evaluated at runtime. The constructor arguments represent (in order): whether or not to look at superclass implementations when searching for a dictionary, the type class name and instance type, and the type class dictionaries in scope.

TypeClassDictionaryAccessor (Qualified (ProperName ClassName)) Ident

A typeclass dictionary accessor, the implementation is left unspecified until CoreFn desugaring.

DeferredDictionary (Qualified (ProperName ClassName)) [SourceType]

A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking

AnonymousArgument

A placeholder for an anonymous function argument

Hole Text

A typed hole that will be turned into a hint/error during typechecking

PositionedValue SourceSpan [Comment] Expr

A value with source position information

Instances
Show Expr Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #

data GuardedExpr Source #

The right hand side of a binder in value declarations and case expressions.

Constructors

GuardedExpr [Guard] Expr 

data Guard Source #

A guard is just a boolean-valued expression that appears alongside a set of binders

Instances
Show Guard Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

showsPrec :: Int -> Guard -> ShowS #

show :: Guard -> String #

showList :: [Guard] -> ShowS #

data TypeInstanceBody Source #

The members of a type class instance declaration

Constructors

DerivedInstance

This is a derived instance

NewtypeInstance

This is an instance derived from a newtype

NewtypeInstanceWithDictionary Expr

This is an instance derived from a newtype, desugared to include a dictionary for the type under the newtype.

ExplicitInstance [Declaration]

This is a regular (explicit) instance

data Declaration Source #

The data type of declarations

Constructors

DataDeclaration SourceAnn DataDeclType (ProperName TypeName) [(Text, Maybe SourceKind)] [(ProperName ConstructorName, [(Ident, SourceType)])]

A data type declaration (data or newtype, name, arguments, data constructors)

DataBindingGroupDeclaration (NonEmpty Declaration)

A minimal mutually recursive set of data type declarations

TypeSynonymDeclaration SourceAnn (ProperName TypeName) [(Text, Maybe SourceKind)] SourceType

A type synonym declaration (name, arguments, type)

TypeDeclaration !TypeDeclarationData

A type declaration for a value (name, ty)

ValueDeclaration !(ValueDeclarationData [GuardedExpr])

A value declaration (name, top-level binders, optional guard, value)

BoundValueDeclaration SourceAnn Binder Expr

A declaration paired with pattern matching in let-in expression (binder, optional guard, value)

BindingGroupDeclaration (NonEmpty ((SourceAnn, Ident), NameKind, Expr))

A minimal mutually recursive set of value declarations

ExternDeclaration SourceAnn Ident SourceType

A foreign import declaration (name, type)

ExternDataDeclaration SourceAnn (ProperName TypeName) SourceKind

A data type foreign import (name, kind)

ExternKindDeclaration SourceAnn (ProperName KindName)

A foreign kind import (name)

FixityDeclaration SourceAnn (Either ValueFixity TypeFixity)

A fixity declaration

ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName)

A module import (module name, qualifiedunqualifiedhiding, optional "qualified as" name)

TypeClassDeclaration SourceAnn (ProperName ClassName) [(Text, Maybe SourceKind)] [SourceConstraint] [FunctionalDependency] [Declaration]

A type class declaration (name, argument, implies, member declarations)

TypeInstanceDeclaration SourceAnn [Ident] Integer Ident [SourceConstraint] (Qualified (ProperName ClassName)) [SourceType] TypeInstanceBody

A type instance declaration (instance chain, chain index, name, dependencies, class name, instance types, member declarations)

data ValueDeclarationData a Source #

A value declaration assigns a name and potential binders, to an expression (or multiple guarded expressions).

double x = x + x

In this example double is the identifier, x is a binder and x + x is the expression.

Constructors

ValueDeclarationData 

Fields

Instances
Functor ValueDeclarationData Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Foldable ValueDeclarationData Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

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

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

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

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

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

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

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

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

toList :: ValueDeclarationData a -> [a] #

null :: ValueDeclarationData a -> Bool #

length :: ValueDeclarationData a -> Int #

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

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

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

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

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

Traversable ValueDeclarationData Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

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

Defined in Language.PureScript.AST.Declarations

data TypeDeclarationData Source #

A type declaration assigns a type to an identifier, eg:

identity :: forall a. a -> a

In this example identity is the identifier and forall a. a -> a the type.

data ImportDeclarationType Source #

The data type which specifies type of import declaration

Constructors

Implicit

An import with no explicit list: `import M`.

Explicit [DeclarationRef]

An import with an explicit list of references to import: `import M (foo)`

Hiding [DeclarationRef]

An import with a list of references to hide: `import M hiding (foo)`

data ExportSource Source #

Instances
Eq ExportSource Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Ord ExportSource Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Show ExportSource Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Generic ExportSource Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Associated Types

type Rep ExportSource :: Type -> Type #

NFData ExportSource Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

rnf :: ExportSource -> () #

ToJSON ExportSource Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

FromJSON ExportSource Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

type Rep ExportSource Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

type Rep ExportSource = D1 (MetaData "ExportSource" "Language.PureScript.AST.Declarations" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (C1 (MetaCons "ExportSource" PrefixI True) (S1 (MetaSel (Just "exportSourceImportedFrom") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe ModuleName)) :*: S1 (MetaSel (Just "exportSourceDefinedIn") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ModuleName)))

data DeclarationRef Source #

An item in a list of explicit imports or exports

Constructors

TypeRef SourceSpan (ProperName TypeName) (Maybe [ProperName ConstructorName])

A type constructor with data constructors

TypeOpRef SourceSpan (OpName TypeOpName)

A type operator

ValueRef SourceSpan Ident

A value

ValueOpRef SourceSpan (OpName ValueOpName)

A value-level operator

TypeClassRef SourceSpan (ProperName ClassName)

A type class

TypeInstanceRef SourceSpan Ident

A type class instance, created during typeclass desugaring (name, class name, instance types)

ModuleRef SourceSpan ModuleName

A module, in its entirety

KindRef SourceSpan (ProperName KindName)

A named kind

ReExportRef SourceSpan ExportSource DeclarationRef

A value re-exported from another module. These will be inserted during elaboration in name desugaring.

Instances
Eq DeclarationRef Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Show DeclarationRef Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Generic DeclarationRef Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Associated Types

type Rep DeclarationRef :: Type -> Type #

NFData DeclarationRef Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

Methods

rnf :: DeclarationRef -> () #

ToJSON DeclarationRef Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

FromJSON DeclarationRef Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

type Rep DeclarationRef Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

type Rep DeclarationRef = D1 (MetaData "DeclarationRef" "Language.PureScript.AST.Declarations" "purescript-0.12.4-4431FMqBZsLBJwEgpbTTth" False) (((C1 (MetaCons "TypeRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ProperName TypeName)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe [ProperName ConstructorName])))) :+: C1 (MetaCons "TypeOpRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (OpName TypeOpName)))) :+: (C1 (MetaCons "ValueRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Ident)) :+: C1 (MetaCons "ValueOpRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (OpName ValueOpName))))) :+: ((C1 (MetaCons "TypeClassRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ProperName ClassName))) :+: C1 (MetaCons "TypeInstanceRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Ident))) :+: (C1 (MetaCons "ModuleRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ModuleName)) :+: (C1 (MetaCons "KindRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ProperName KindName))) :+: C1 (MetaCons "ReExportRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SourceSpan) :*: (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ExportSource) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 DeclarationRef)))))))

data Module Source #

A module declaration, consisting of comments about the module, a module name, a list of declarations, and a list of the declarations that are explicitly exported. If the export list is Nothing, everything is exported.

Instances
Show Module Source # 
Instance details

Defined in Language.PureScript.AST.Declarations

data SimpleErrorMessage Source #

A type of error messages

Constructors

ModuleNotFound ModuleName 
ErrorParsingFFIModule FilePath (Maybe ErrorMessage) 
ErrorParsingModule ParseError 
MissingFFIModule ModuleName 
UnnecessaryFFIModule ModuleName FilePath 
MissingFFIImplementations ModuleName [Ident] 
UnusedFFIImplementations ModuleName [Ident] 
InvalidFFIIdentifier ModuleName Text 
CannotGetFileInfo FilePath 
CannotReadFile FilePath 
CannotWriteFile FilePath 
InfiniteType SourceType 
InfiniteKind SourceKind 
MultipleValueOpFixities (OpName ValueOpName) 
MultipleTypeOpFixities (OpName TypeOpName) 
OrphanTypeDeclaration Ident 
RedefinedIdent Ident 
OverlappingNamesInLet 
UnknownName (Qualified Name) 
UnknownImport ModuleName Name 
UnknownImportDataConstructor ModuleName (ProperName TypeName) (ProperName ConstructorName) 
UnknownExport Name 
UnknownExportDataConstructor (ProperName TypeName) (ProperName ConstructorName) 
ScopeConflict Name [ModuleName] 
ScopeShadowing Name (Maybe ModuleName) [ModuleName] 
DeclConflict Name Name 
ExportConflict (Qualified Name) (Qualified Name) 
DuplicateModule ModuleName 
DuplicateTypeClass (ProperName ClassName) SourceSpan 
DuplicateInstance Ident SourceSpan 
DuplicateTypeArgument Text 
InvalidDoBind 
InvalidDoLet 
CycleInDeclaration Ident 
CycleInTypeSynonym (Maybe (ProperName TypeName)) 
CycleInTypeClassDeclaration [ProperName ClassName] 
CycleInModules [ModuleName] 
NameIsUndefined Ident 
UndefinedTypeVariable (ProperName TypeName) 
PartiallyAppliedSynonym (Qualified (ProperName TypeName)) 
EscapedSkolem Text (Maybe SourceSpan) SourceType 
TypesDoNotUnify SourceType SourceType 
KindsDoNotUnify SourceKind SourceKind 
ConstrainedTypeUnified SourceType SourceType 
OverlappingInstances (Qualified (ProperName ClassName)) [SourceType] [Qualified Ident] 
NoInstanceFound SourceConstraint 
AmbiguousTypeVariables SourceType SourceConstraint 
UnknownClass (Qualified (ProperName ClassName)) 
PossiblyInfiniteInstance (Qualified (ProperName ClassName)) [SourceType] 
CannotDerive (Qualified (ProperName ClassName)) [SourceType] 
InvalidDerivedInstance (Qualified (ProperName ClassName)) [SourceType] Int 
ExpectedTypeConstructor (Qualified (ProperName ClassName)) [SourceType] SourceType 
InvalidNewtypeInstance (Qualified (ProperName ClassName)) [SourceType] 
MissingNewtypeSuperclassInstance (Qualified (ProperName ClassName)) (Qualified (ProperName ClassName)) [SourceType] 
UnverifiableSuperclassInstance (Qualified (ProperName ClassName)) (Qualified (ProperName ClassName)) [SourceType] 
CannotFindDerivingType (ProperName TypeName) 
DuplicateLabel Label (Maybe Expr) 
DuplicateValueDeclaration Ident 
ArgListLengthsDiffer Ident 
OverlappingArgNames (Maybe Ident) 
MissingClassMember (NonEmpty (Ident, SourceType)) 
ExtraneousClassMember Ident (Qualified (ProperName ClassName)) 
ExpectedType SourceType SourceKind 
IncorrectConstructorArity (Qualified (ProperName ConstructorName)) Int Int

constructor name, expected argument count, actual argument count

ExprDoesNotHaveType Expr SourceType 
PropertyIsMissing Label 
AdditionalProperty Label 
TypeSynonymInstance 
OrphanInstance Ident (Qualified (ProperName ClassName)) (Set ModuleName) [SourceType] 
InvalidNewtype (ProperName TypeName) 
InvalidInstanceHead SourceType 
TransitiveExportError DeclarationRef [DeclarationRef] 
TransitiveDctorExportError DeclarationRef (ProperName ConstructorName) 
ShadowedName Ident 
ShadowedTypeVar Text 
UnusedTypeVar Text 
WildcardInferredType SourceType Context 
HoleInferredType Text SourceType Context (Maybe TypeSearch) 
MissingTypeDeclaration Ident SourceType 
OverlappingPattern [[Binder]] Bool 
IncompleteExhaustivityCheck 
MisleadingEmptyTypeImport ModuleName (ProperName TypeName) 
ImportHidingModule ModuleName 
UnusedImport ModuleName 
UnusedExplicitImport ModuleName [Name] (Maybe ModuleName) [DeclarationRef] 
UnusedDctorImport ModuleName (ProperName TypeName) (Maybe ModuleName) [DeclarationRef] 
UnusedDctorExplicitImport ModuleName (ProperName TypeName) [ProperName ConstructorName] (Maybe ModuleName) [DeclarationRef] 
DuplicateSelectiveImport ModuleName 
DuplicateImport ModuleName ImportDeclarationType (Maybe ModuleName) 
DuplicateImportRef Name 
DuplicateExportRef Name 
IntOutOfRange Integer Text Integer Integer 
ImplicitQualifiedImport ModuleName ModuleName [DeclarationRef] 
ImplicitQualifiedImportReExport ModuleName ModuleName [DeclarationRef] 
ImplicitImport ModuleName [DeclarationRef] 
HidingImport ModuleName [DeclarationRef] 
CaseBinderLengthDiffers Int [Binder] 
IncorrectAnonymousArgument 
InvalidOperatorInBinder (Qualified (OpName ValueOpName)) (Qualified Ident) 
CannotGeneralizeRecursiveFunction Ident SourceType 
CannotDeriveNewtypeForData (ProperName TypeName) 
ExpectedWildcard (ProperName TypeName) 
CannotUseBindWithDo Ident 
ClassInstanceArityMismatch Ident (Qualified (ProperName ClassName)) Int Int

instance name, type class, expected argument count, actual argument count

UserDefinedWarning SourceType

a user-defined warning raised by using the Warn type class

UnusableDeclaration Ident [[Text]]

a declaration couldn't be used because it contained free variables

CannotDefinePrimModules ModuleName 
MixedAssociativityError (NonEmpty (Qualified (OpName AnyOpName), Associativity)) 
NonAssociativeError (NonEmpty (Qualified (OpName AnyOpName))) 

data TypeSearch Source #

Holds the data necessary to do type directed search for typed holes

Constructors

TSBefore Environment

An Environment captured for later consumption by type directed search

TSAfter

Results of applying type directed search to the previously captured Environment

Fields

type Context = [(Ident, SourceType)] Source #

A map of locally-bound names in scope.

getModuleName :: Module -> ModuleName Source #

Return a module's name.

getModuleSourceSpan :: Module -> SourceSpan Source #

Return a module's source span.

getModuleDeclarations :: Module -> [Declaration] Source #

Return a module's declarations.

addDefaultImport :: Qualified ModuleName -> Module -> Module Source #

Add an import declaration for a module if it does not already explicitly import it.

Will not import an unqualified module if that module has already been imported qualified. (See #2197)

importPrim :: Module -> Module Source #

Adds import declarations to a module for an implicit Prim import and Prim | qualified as Prim, as necessary.

traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody Source #

A traversal for TypeInstanceBody

isValueDecl :: Declaration -> Bool Source #

Test if a declaration is a value declaration

isDataDecl :: Declaration -> Bool Source #

Test if a declaration is a data type or type synonym declaration

isImportDecl :: Declaration -> Bool Source #

Test if a declaration is a module import

isExternDataDecl :: Declaration -> Bool Source #

Test if a declaration is a data type foreign import

isExternKindDecl :: Declaration -> Bool Source #

Test if a declaration is a foreign kind import

isFixityDecl :: Declaration -> Bool Source #

Test if a declaration is a fixity declaration

isExternDecl :: Declaration -> Bool Source #

Test if a declaration is a foreign import

isTypeClassInstanceDeclaration :: Declaration -> Bool Source #

Test if a declaration is a type class instance declaration

isTypeClassDeclaration :: Declaration -> Bool Source #

Test if a declaration is a type class declaration

flattenDecls :: [Declaration] -> [Declaration] Source #

Recursively flatten data binding groups in the list of declarations

litM :: Monad m => (a -> m a) -> Literal a -> m (Literal a) Source #

everywhereOnValuesTopDownM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) Source #

everywhereOnValuesM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) Source #

everythingOnValues :: forall r. (r -> r -> r) -> (Declaration -> r) -> (Expr -> r) -> (Binder -> r) -> (CaseAlternative -> r) -> (DoNotationElement -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) Source #

everythingWithContextOnValues :: forall s r. s -> r -> (r -> r -> r) -> (s -> Declaration -> (s, r)) -> (s -> Expr -> (s, r)) -> (s -> Binder -> (s, r)) -> (s -> CaseAlternative -> (s, r)) -> (s -> DoNotationElement -> (s, r)) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) Source #

everywhereWithContextOnValuesM :: forall m s. Monad m => s -> (s -> Declaration -> m (s, Declaration)) -> (s -> Expr -> m (s, Expr)) -> (s -> Binder -> m (s, Binder)) -> (s -> CaseAlternative -> m (s, CaseAlternative)) -> (s -> DoNotationElement -> m (s, DoNotationElement)) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder, CaseAlternative -> m CaseAlternative, DoNotationElement -> m DoNotationElement) Source #

accumTypes :: Monoid r => (SourceType -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) Source #

accumKinds :: Monoid r => (SourceKind -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) Source #

overTypes :: (SourceType -> SourceType) -> Expr -> Expr Source #

Map a function over type annotations appearing inside a value

exportedDeclarations :: Module -> [Declaration] Source #

Return a list of all declarations which are exported from a module. This function descends into data declarations to filter out unexported data constructors, and also filters out type instance declarations if they refer to classes or types which are not themselves exported.

Note that this function assumes that the module has already had its imports desugared using desugarImports. It will produce incorrect results if this is not the case - for example, type class instances will be incorrectly removed in some cases.

The returned declarations are in the same order as they appear in the export list, unless there is no export list, in which case they appear in the same order as they do in the source file.

isExported :: Maybe [DeclarationRef] -> Declaration -> Bool Source #

Test if a declaration is exported, given a module's export list. Note that this function does not account for type instance declarations of non-exported types, or non-exported data constructors. Therefore, you should prefer exportedDeclarations to this function, where possible.

desugarLetPatternModule :: Module -> Module Source #

Replace every BoundValueDeclaration in Let expressions with Case expressions.

prettyPrintKind :: Kind a -> Text Source #

Generate a pretty-printed string representing a Kind

prettyPrintTypeAtom :: Int -> Type a -> String Source #

Generate a pretty-printed string representing a Type, as it should appear inside parentheses

prettyPrintType :: Int -> Type a -> String Source #

Generate a pretty-printed string representing a Type

prettyPrintTypeWithUnicode :: Int -> Type a -> String Source #

Generate a pretty-printed string representing a Type using unicode symbols where applicable

prettyPrintSuggestedType :: Type a -> String Source #

Generate a pretty-printed string representing a suggested Type

prettyPrintValue :: Int -> Expr -> Box Source #

Pretty-print an expression

prettyPrintBinder :: Binder -> Text Source #

Generate a pretty-printed string representing a Binder

data ExternsDeclaration Source #

A type or value declaration appearing in an externs file

data ExternsTypeFixity Source #

A type fixity declaration in an externs file

Constructors

ExternsTypeFixity 

Fields

data ExternsFixity Source #

A fixity declaration in an externs file

Constructors

ExternsFixity 

Fields

data ExternsImport Source #

A module import in an externs file

Constructors

ExternsImport 

Fields

data ExternsFile Source #

The data which will be serialized to an externs file

Constructors

ExternsFile 

Fields

applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment Source #

Convert an externs file back into a module

moduleToExternsFile :: Module -> Environment -> ExternsFile Source #

Generate an externs file for all declarations in a module

data PPEOptions Source #

Constructors

PPEOptions 

Fields

data Level Source #

How critical the issue is

Constructors

Error 
Warning 
Instances
Show Level Source # 
Instance details

Defined in Language.PureScript.Errors

Methods

showsPrec :: Int -> Level -> ShowS #

show :: Level -> String #

showList :: [Level] -> ShowS #

data TypeMap Source #

A map from rigid type variable name/unknown variable pairs to new variables.

Constructors

TypeMap 

Fields

Instances
Show TypeMap Source # 
Instance details

Defined in Language.PureScript.Errors

errorSpan :: ErrorMessage -> Maybe (NonEmpty SourceSpan) Source #

Get the source span for an error

errorModule :: ErrorMessage -> Maybe ModuleName Source #

Get the module name for an error

stripModuleAndSpan :: ErrorMessage -> ErrorMessage Source #

Remove the module name and span hints from an error

errorCode :: ErrorMessage -> Text Source #

Get the error code for a particular error type

nonEmpty :: MultipleErrors -> Bool Source #

Check whether a collection of errors is empty or not.

errorMessage :: SimpleErrorMessage -> MultipleErrors Source #

Create an error set from a single simple error message

errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors Source #

Create an error set from a single simple error message and source annotation

errorMessage'' :: NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors Source #

Create an error set from a single simple error message and source annotations

errorMessage''' :: [SourceSpan] -> SimpleErrorMessage -> MultipleErrors Source #

Create an error from multiple (possibly empty) source spans, reversed sorted.

singleError :: ErrorMessage -> MultipleErrors Source #

Create an error set from a single error message

onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors Source #

Lift a function on ErrorMessage to a function on MultipleErrors

addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors Source #

Add a hint to an error message

addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors Source #

Add hints to an error message

unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage Source #

Extract nested error messages from wrapper errors

defaultCodeColor :: (ColorIntensity, Color) Source #

Default color intesity and color for code

defaultPPEOptions :: PPEOptions Source #

Default options for PPEOptions

prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box Source #

Pretty print a single error, simplifying if necessary

prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String Source #

Pretty print multiple errors

prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String Source #

Pretty print multiple warnings

prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box] Source #

Pretty print warnings as a Box

prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box] Source #

Pretty print errors as a Box

prettyPrintParseError :: ParseError -> Box Source #

Pretty print a Parsec ParseError as a Box

rethrow :: MonadError e m => (e -> e) -> m a -> m a Source #

Rethrow an error with a more detailed error message in the case of failure

reifyErrors :: MonadError e m => m a -> m (Either e a) Source #

reflectErrors :: MonadError e m => m (Either e a) -> m a Source #

warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a Source #

rethrowWithPosition :: MonadError MultipleErrors m => SourceSpan -> m a -> m a Source #

Rethrow an error with source position information

escalateWarningWhen :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (ErrorMessage -> Bool) -> m a -> m a Source #

Runs a computation listening for warnings and then escalating any warnings that match the predicate to error status.

parU :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b] Source #

Collect errors in in parallel

type Unknown = Int Source #

Unification variables

data CheckState Source #

State required for type checking

Constructors

CheckState 

Fields

data Substitution Source #

A substitution of unification variables for types or kinds

Constructors

Substitution 

Fields

emptySubstitution :: Substitution Source #

An empty substitution

emptyCheckState :: Environment -> CheckState Source #

Create an empty CheckState

bindNames :: MonadState CheckState m => Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> m a -> m a Source #

Temporarily bind a collection of names to values

bindTypes :: MonadState CheckState m => Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) -> m a -> m a Source #

Temporarily bind a collection of names to types

withScopedTypeVars :: (MonadState CheckState m, MonadWriter MultipleErrors m) => ModuleName -> [(Text, SourceKind)] -> m a -> m a Source #

Temporarily bind a collection of names to types

getHints :: MonadState CheckState m => m [ErrorMessageHint] Source #

These hints are added at the front, so the most nested hint occurs at the front, but the simplifier assumes the reverse order.

withTypeClassDictionaries :: MonadState CheckState m => [NamedDict] -> m a -> m a Source #

Temporarily make a collection of type class dictionaries available

getTypeClassDictionaries :: MonadState CheckState m => m (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) Source #

Get the currently available map of type class dictionaries

bindLocalVariables :: MonadState CheckState m => [(Ident, SourceType, NameVisibility)] -> m a -> m a Source #

Temporarily bind a collection of names to local variables

bindLocalTypeVariables :: MonadState CheckState m => ModuleName -> [(ProperName TypeName, SourceKind)] -> m a -> m a Source #

Temporarily bind a collection of names to local type variables

makeBindingGroupVisible :: MonadState CheckState m => m () Source #

Update the visibility of all names to Defined

withBindingGroupVisible :: MonadState CheckState m => m a -> m a Source #

Update the visibility of all names to Defined in the scope of the provided action

preservingNames :: MonadState CheckState m => m a -> m a Source #

Perform an action while preserving the names from the Environment.

lookupVariable :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m SourceType Source #

Lookup the type of a value by name in the Environment

getVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m NameVisibility Source #

Lookup the visibility of a value by name in the Environment

checkVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m () Source #

Assert that a name is visible

lookupTypeVariable :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified (ProperName TypeName) -> m SourceKind Source #

Lookup the kind of a type by name in the Environment

getEnv :: MonadState CheckState m => m Environment Source #

Get the current Environment

getLocalContext :: MonadState CheckState m => m Context Source #

Get locally-bound names in context, to create an error message.

putEnv :: MonadState CheckState m => Environment -> m () Source #

Update the Environment

modifyEnv :: MonadState CheckState m => (Environment -> Environment) -> m () Source #

Modify the Environment

runCheck :: Functor m => StateT CheckState m a -> m (a, Environment) Source #

Run a computation in the typechecking monad, starting with an empty Environment

runCheck' :: Functor m => CheckState -> StateT CheckState m a -> m (a, Environment) Source #

Run a computation in the typechecking monad, failing with an error, or succeeding with a return value and the final Environment.

guardWith :: MonadError e m => e -> Bool -> m () Source #

Make an assertion, failing with an error message

captureSubstitution :: MonadState CheckState m => m a -> m (a, Substitution) Source #

Run a computation in the substitution monad, generating a return value and the final substitution.

withoutWarnings :: MonadWriter w m => m a -> m (a, w) Source #

type SynonymMap = Map (Qualified (ProperName TypeName)) ([(Text, Maybe SourceKind)], SourceType) Source #

Type synonym information (arguments with kinds, aliased type), indexed by name

replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => SourceType -> m SourceType Source #

Replace fully applied type synonyms

replaceAllTypeSynonymsM :: MonadError MultipleErrors m => SynonymMap -> SourceType -> m SourceType Source #

Replace fully applied type synonyms by explicitly providing a SynonymMap.

kindOf :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> m SourceKind Source #

Infer the kind of a single type

kindOfWithScopedVars :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> m (SourceKind, [(Text, SourceKind)]) Source #

Infer the kind of a single type, returning the kinds of any scoped type variables

kindsOf :: (MonadError MultipleErrors m, MonadState CheckState m) => Bool -> ModuleName -> ProperName TypeName -> [(Text, Maybe SourceKind)] -> [SourceType] -> m SourceKind Source #

Infer the kind of a type constructor with a collection of arguments and a collection of associated data constructors

kindsOfAll :: (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> [(SourceAnn, ProperName TypeName, [(Text, Maybe SourceKind)], SourceType)] -> [(SourceAnn, ProperName TypeName, [(Text, Maybe SourceKind)], [SourceType])] -> m ([SourceKind], [SourceKind]) Source #

Simultaneously infer the kinds of several mutually recursive type constructors

typesOf :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => BindingGroupType -> ModuleName -> [((SourceAnn, Ident), Expr)] -> m [((SourceAnn, Ident), (Expr, SourceType))] Source #

Infer the types of multiple mutually-recursive values, and return elaborated values including type class dictionaries and type annotations.

desugarTypeDeclarationsModule :: forall m. MonadError MultipleErrors m => Module -> m Module Source #

Replace all top level type declarations in a module with type annotations

desugarSignedLiterals :: Module -> Module Source #

Removes unary negation operators and replaces them with calls to negate.

rebracket :: forall m. MonadError MultipleErrors m => [ExternsFile] -> [Module] -> m [Module] Source #

Remove explicit parentheses and reorder binary operator applications.

This pass requires name desugaring and export elaboration to have run first.

rebracketFiltered :: forall m. MonadError MultipleErrors m => (Declaration -> Bool) -> [ExternsFile] -> [Module] -> m [Module] Source #

A version of rebracket which allows you to choose which declarations should be affected. This is used in docs generation, where we want to desugar type operators in instance declarations to ensure that instances are paired up with their types correctly, but we don't want to desugar type operators in value declarations.

checkFixityExports :: forall m. MonadError MultipleErrors m => Module -> m Module Source #

Checks all the fixity exports within a module to ensure that members aliased by the operators are also exported from the module.

This pass requires name desugaring and export elaboration to have run first.

type Env = Map ModuleName (SourceSpan, Imports, Exports) Source #

The imports and exports for a collection of modules. The SourceSpan is used to store the source location of the module with a given name, used to provide useful information when there is a duplicate module definition.

data Exports Source #

The exported declarations from a module.

Constructors

Exports 

Fields

Instances
Show Exports Source # 
Instance details

Defined in Language.PureScript.Sugar.Names.Env

data Imports Source #

The imported declarations for a module, including the module's own members.

Constructors

Imports 

Fields

Instances
Show Imports Source # 
Instance details

Defined in Language.PureScript.Sugar.Names.Env

data ImportProvenance Source #

Used to track how an import was introduced into scope. This allows us to handle the one-open-import special case that allows a name conflict to become a warning rather than being an unresolvable situation.

data ImportRecord a Source #

The details for an import: the name of the thing that is being imported (x if importing from A), the module that the thing was originally defined in (for re-export resolution), and the import provenance (see below).

primEnv :: Env Source #

Environment which only contains the Prim modules.

desugarDoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module Source #

Replace all DoNotationBind and DoNotationValue constructors with applications of the bind function in scope, and all DoNotationLet constructors with let expressions.

desugarCasesModule :: (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module Source #

Replace all top-level binders in a module with case expressions.

desugarCases :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] Source #

Replace all top-level binders with case expressions.

desugarTypeClasses :: (MonadSupply m, MonadError MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] Source #

Add type synonym declarations for type class dictionary types, and value declarations for type class instance dictionary expressions.

createBindingGroupsModule :: MonadError MultipleErrors m => Module -> m Module Source #

Replace all sets of mutually-recursive declarations in a module with binding groups

collapseBindingGroupsModule :: [Module] -> [Module] Source #

Collapse all binding groups in a module to individual declarations

collapseBindingGroups :: [Declaration] -> [Declaration] Source #

Collapse all binding groups to individual declarations

desugarAdoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module Source #

Replace all AdoNotationBind and AdoNotationValue constructors with applications of the pure and apply functions in scope, and all AdoNotationLet constructors with let expressions.

parseDeclaration :: TokenParser [Declaration] Source #

Parse a single declaration. May include a collection of instances in a chain.

parseModuleDeclaration :: TokenParser (ModuleName, Maybe [DeclarationRef]) Source #

Parse a module declaration and its export declarations

parseModule :: TokenParser Module Source #

Parse a module header and a collection of declarations

parseModulesFromFiles :: forall m k. MonadError MultipleErrors m => (k -> FilePath) -> [(k, Text)] -> m [(k, Module)] Source #

Parse a collection of modules in parallel

parseModuleFromFile :: (k -> FilePath) -> (k, Text) -> Either ParseError (k, Module) Source #

Parses a single module with FilePath for eventual parsing errors

parseValue :: TokenParser Expr Source #

Parse an expression

parseBinderNoParens :: TokenParser Binder Source #

Parse a binder as it would appear in a top level declaration

parseGuard :: TokenParser [Guard] Source #

Parse a guard

type ModuleGraph = [(ModuleName, [ModuleName])] Source #

A list of modules with their transitive dependencies

sortModules :: forall m. MonadError MultipleErrors m => [Module] -> m ([Module], ModuleGraph) Source #

Sort a collection of modules based on module dependencies.

Reports an error if the module graph contains a cycle.

newtype Make a Source #

A monad for running make actions

Instances
Monad Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

Methods

(>>=) :: Make a -> (a -> Make b) -> Make b #

(>>) :: Make a -> Make b -> Make b #

return :: a -> Make a #

fail :: String -> Make a #

Functor Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

Methods

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

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

Applicative Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

Methods

pure :: a -> Make a #

(<*>) :: Make (a -> b) -> Make a -> Make b #

liftA2 :: (a -> b -> c) -> Make a -> Make b -> Make c #

(*>) :: Make a -> Make b -> Make b #

(<*) :: Make a -> Make b -> Make a #

MonadIO Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

Methods

liftIO :: IO a -> Make a #

MonadError MultipleErrors Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

MonadReader Options Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

Methods

ask :: Make Options #

local :: (Options -> Options) -> Make a -> Make a #

reader :: (Options -> a) -> Make a #

MonadBase IO Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

Methods

liftBase :: IO α -> Make α #

MonadBaseControl IO Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

Associated Types

type StM Make a :: Type #

Methods

liftBaseWith :: (RunInBase Make IO -> IO a) -> Make a #

restoreM :: StM Make a -> Make a #

MonadWriter MultipleErrors Make Source # 
Instance details

Defined in Language.PureScript.Make.Monad

type StM Make a Source # 
Instance details

Defined in Language.PureScript.Make.Monad

runMake :: Options -> Make a -> IO (Either MultipleErrors a, MultipleErrors) Source #

Execute a Make monad, returning either errors, or the result of the compile plus any warnings.

makeIO :: (IOError -> ErrorMessage) -> IO a -> Make a Source #

Run an IO action in the Make monad, by specifying how IO errors should be rendered as ErrorMessage values.

readTextFile :: FilePath -> Make ByteString Source #

Read a text file in the Make monad, capturing any errors using the MonadError instance.

type UsedImports = Map ModuleName [Qualified Name] Source #

Map of module name to list of imported names from that module which have been used.

lintImports :: forall m. MonadWriter MultipleErrors m => Module -> Env -> UsedImports -> m () Source #

Find and warn on:

  • Unused import statements (qualified or unqualified)
  • Unused references in an explicit import list
  • Implicit imports of modules
  • Implicit imports into a virtual module (unless the virtual module only has members from one module imported)
  • Imports using hiding (this is another form of implicit importing)

desugarImports :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] Source #

Replaces all local names with qualified names within a list of modules. The modules should be topologically sorted beforehand.

checkExhaustiveExpr :: forall m. (MonadWriter MultipleErrors m, MonadSupply m) => SourceSpan -> Environment -> ModuleName -> Expr -> m Expr Source #

Exhaustivity checking

lint :: forall m. MonadWriter MultipleErrors m => Module -> m () Source #

Lint the PureScript AST. | | Right now, this pass only performs a shadowing check.

typeCheckModule :: forall m. (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Module -> m Module Source #

Type check an entire module and ensure all types and classes defined within the module that are required by exported members are also exported.

deriveInstances :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => [ExternsFile] -> Module -> m Module Source #

Elaborates deriving instance declarations by code generation.

desugar :: (MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] Source #

The desugaring pipeline proceeds as follows:

  • Remove signed literals in favour of negate applications
  • Desugar object literals with wildcards into lambdas
  • Desugar operator sections
  • Desugar do-notation
  • Desugar ado-notation
  • Desugar top-level case declarations into explicit case expressions
  • Desugar type declarations into value declarations with explicit type annotations
  • Qualify any unqualified names and types
  • Rebracket user-defined binary operators
  • Introduce type synonyms for type class dictionaries
  • Group mutually recursive value and data declarations into binding groups.

renameInModules :: [Module Ann] -> [Module Ann] Source #

Renames within each declaration in a module.

data MakeActions m Source #

Actions that require implementations when running in "make" mode.

This type exists to make two things abstract:

  • The particular backend being used (JavaScript, C++11, etc.)
  • The details of how files are read/written etc.

Constructors

MakeActions 

Fields

type Externs = ByteString Source #

Generated code for an externs file.

buildMakeActions Source #

Arguments

:: FilePath

the output directory

-> Map ModuleName (Either RebuildPolicy FilePath)

a map between module names and paths to the file containing the PureScript module

-> Map ModuleName FilePath

a map between module name and the file containing the foreign javascript for the module

-> Bool

Generate a prefix comment?

-> MakeActions Make 

A set of make actions that read and write modules from the given directory.

checkForeignDecls :: Module ann -> FilePath -> Make () Source #

Check that the declarations in a given PureScript module match with those in its corresponding foreign module.

rebuildModule :: forall m. (Monad m, MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [ExternsFile] -> Module -> m ExternsFile Source #

Rebuild a single module.

This function is used for fast-rebuild workflows (PSCi and psc-ide are examples).

make :: forall m. (Monad m, MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [Module] -> m [ExternsFile] Source #

Compiles in "make" mode, compiling each module separately to a .js file and an externs.json file.

If timestamps have not changed, the externs file can be used to provide the module's types without having to typecheck the module again.

inferForeignModules :: forall m. MonadIO m => Map ModuleName (Either RebuildPolicy FilePath) -> m (Map ModuleName FilePath) Source #

Infer the module name for a module by looking for the same filename with a .js extension.