-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | PureScript Programming Language Compiler -- @package purescript @version 0.6.9.3 -- | State for the parser monad module Language.PureScript.Parser.State -- | State for the parser monad data ParseState ParseState :: Column -> ParseState -- | The most recently marked indentation level indentationLevel :: ParseState -> Column instance Show ParseState module Control.Monad.Unify -- | Untyped unification variables type Unknown = Int -- | A type which can contain unification variables class Partial t unknown :: Partial t => Unknown -> t isUnknown :: Partial t => t -> Maybe Unknown unknowns :: Partial t => t -> [Unknown] ($?) :: Partial t => Substitution t -> t -> t -- | Identifies types which support unification class Partial t => Unifiable m t | t -> m (=?=) :: Unifiable m t => t -> t -> UnifyT t m () -- | A substitution maintains a mapping from unification variables to their -- values data Substitution t Substitution :: HashMap Int t -> Substitution t runSubstitution :: Substitution t -> HashMap Int t -- | State required for type checking data UnifyState t UnifyState :: Int -> Substitution t -> UnifyState t -- | The next fresh unification variable unifyNextVar :: UnifyState t -> Int -- | The current substitution unifyCurrentSubstitution :: UnifyState t -> Substitution t -- | An empty UnifyState defaultUnifyState :: Partial t => UnifyState t -- | A class for errors which support unification errors class UnificationError t e occursCheckFailed :: UnificationError t e => t -> e -- | The type checking monad, which provides the state of the type checker, -- and error reporting capabilities newtype UnifyT t m a UnifyT :: StateT (UnifyState t) m a -> UnifyT t m a unUnify :: UnifyT t m a -> StateT (UnifyState t) m a -- | Run a computation in the Unify monad, failing with an error, or -- succeeding with a return value and the new next unification variable runUnify :: UnifyState t -> UnifyT t m a -> m (a, UnifyState t) -- | Substitute a single unification variable substituteOne :: Partial t => Unknown -> t -> Substitution t -- | Replace a unification variable with the specified value in the current -- substitution (=:=) :: (UnificationError t e, Monad m, MonadError e m, Unifiable m t) => Unknown -> t -> UnifyT t m () -- | Perform the occurs check, to make sure a unification variable does not -- occur inside a value occursCheck :: (UnificationError t e, Monad m, MonadError e m, Partial t) => Unknown -> t -> UnifyT t m () -- | Generate a fresh untyped unification variable fresh' :: Monad m => UnifyT t m Unknown -- | Generate a fresh unification variable at a specific type fresh :: (Monad m, Partial t) => UnifyT t m t instance Functor m => Functor (UnifyT t m) instance Monad m => Monad (UnifyT t m) instance (Monad m, Functor m) => Applicative (UnifyT t m) instance (Functor m, MonadPlus m) => Alternative (UnifyT t m) instance MonadPlus m => MonadPlus (UnifyT t m) instance MonadError e m => MonadError e (UnifyT t m) instance MonadState s m => MonadState s (UnifyT t m) instance Partial t => Monoid (Substitution t) -- | The core functional representation for literal values. module Language.PureScript.CoreFn.Literals -- | Data type for literal values. Parameterised so it can be used for -- Exprs and Binders. data Literal a -- | A numeric literal NumericLiteral :: (Either Integer Double) -> Literal a -- | A string literal StringLiteral :: String -> Literal a -- | A boolean literal BooleanLiteral :: Bool -> Literal a -- | An array literal ArrayLiteral :: [a] -> Literal a -- | An object literal ObjectLiteral :: [(String, a)] -> Literal a instance Typeable Literal instance Show a => Show (Literal a) instance Data a => Data (Literal a) instance Functor Literal -- | Common functions for implementing generic traversals module Language.PureScript.Traversals fstM :: Functor f => (a -> f c) -> (a, b) -> f (c, b) sndM :: Functor f => (b -> f c) -> (a, b) -> f (a, c) thirdM :: Functor f => (c -> f d) -> (a, b, c) -> f (a, b, d) pairM :: Applicative f => (a -> f c) -> (b -> f d) -> (a, b) -> f (c, d) maybeM :: Applicative f => (a -> f b) -> Maybe a -> f (Maybe b) eitherM :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) defS :: Monad m => st -> val -> m (st, val) -- | Source position information module Language.PureScript.AST.SourcePos -- | Source position information data SourcePos SourcePos :: Int -> Int -> SourcePos -- | Line number sourcePosLine :: SourcePos -> Int -- | Column number sourcePosColumn :: SourcePos -> Int data SourceSpan SourceSpan :: String -> SourcePos -> SourcePos -> SourceSpan -- | Source name spanName :: SourceSpan -> String -- | Start of the span spanStart :: SourceSpan -> SourcePos spanEnd :: SourceSpan -> SourcePos instance Typeable SourcePos instance Typeable SourceSpan instance Eq SourcePos instance Data SourcePos instance Eq SourceSpan instance Data SourceSpan instance Show SourceSpan instance Show SourcePos -- | Operators fixity and associativity module Language.PureScript.AST.Operators -- | A precedence level for an infix operator type Precedence = Integer -- | Associativity for infix operators data Associativity Infixl :: Associativity Infixr :: Associativity Infix :: Associativity -- | Fixity data for infix operators data Fixity Fixity :: Associativity -> Precedence -> Fixity instance Typeable Associativity instance Typeable Fixity instance Data Associativity instance Show Fixity instance Data Fixity instance Show Associativity -- | Various constants which refer to things in the Prelude module Language.PureScript.Constants ($) :: String (#) :: String (<>) :: String (++) :: String (>>=) :: String (+) :: String (-) :: String (*) :: String (/) :: String (%) :: String (<) :: String (>) :: String (<=) :: String (>=) :: String (==) :: String (/=) :: String (.&.) :: String (.|.) :: String (.^.) :: String (&&) :: String (||) :: String unsafeIndex :: String negate :: String shl :: String shr :: String zshr :: String complement :: String not :: String zero :: String one :: String return :: String pure' :: String returnEscaped :: String untilE :: String whileE :: String runST :: String stRefValue :: String newSTRef :: String readSTRef :: String writeSTRef :: String modifySTRef :: String mkFn :: String runFn :: String unit :: String undefined :: String monadEffDictionary :: String applicativeEffDictionary :: String bindEffDictionary :: String semiringNumber :: String ringNumber :: String moduloSemiringNumber :: String numNumber :: String ordNumber :: String eqNumber :: String eqString :: String eqBoolean :: String bitsNumber :: String boolLikeBoolean :: String semigroupString :: String semigroupoidArr :: String main :: String __superclass_ :: String __unused :: String prim :: String prelude :: String preludeUnsafe :: String eff :: String st :: String dataFunction :: String -- | Fresh variable supply module Control.Monad.Supply newtype SupplyT m a SupplyT :: StateT Integer m a -> SupplyT m a unSupplyT :: SupplyT m a -> StateT Integer m a runSupplyT :: Integer -> SupplyT m a -> m (a, Integer) evalSupplyT :: Functor m => Integer -> SupplyT m a -> m a type Supply = SupplyT Identity runSupply :: Integer -> Supply a -> (a, Integer) evalSupply :: Integer -> Supply a -> a instance Functor m => Functor (SupplyT m) instance (Monad m, Functor m) => Applicative (SupplyT m) instance Monad m => Monad (SupplyT m) instance MonadTrans SupplyT instance MonadError e m => MonadError e (SupplyT m) instance MonadWriter w m => MonadWriter w (SupplyT m) instance MonadReader r m => MonadReader r (SupplyT m) -- | A class for monads supporting a supply of fresh names module Control.Monad.Supply.Class class Monad m => MonadSupply m fresh :: MonadSupply m => m Integer freshName :: MonadSupply m => m String instance MonadSupply m => MonadSupply (StateT s m) instance Monad m => MonadSupply (SupplyT m) -- | The data type of compiler options module Language.PureScript.Options -- | Indicates the mode of the compiler. Lifted using DataKinds to refine -- the Options type. data Mode Compile :: Mode Make :: Mode -- | Per-mode options data ModeOptions mode CompileOptions :: String -> [String] -> [String] -> ModeOptions Compile MakeOptions :: ModeOptions Make browserNamespace :: ModeOptions Compile -> String entryPointModules :: ModeOptions Compile -> [String] codeGenModules :: ModeOptions Compile -> [String] -- | The data type of compiler options data Options mode Options :: Bool -> Bool -> Bool -> Maybe String -> Bool -> Bool -> Bool -> ModeOptions mode -> Options mode -- | Disable inclusion of the built in Prelude optionsNoPrelude :: Options mode -> Bool -- | Disable tail-call elimination optionsNoTco :: Options mode -> Bool -- | Disable inlining of calls to return and bind for the Eff monad optionsNoMagicDo :: Options mode -> Bool -- | When specified, checks the type of main in the module, and -- generate a call to run main after the module definitions. optionsMain :: Options mode -> Maybe String -- | Skip all optimizations optionsNoOptimizations :: Options mode -> Bool -- | Verbose error message optionsVerboseErrors :: Options mode -> Bool -- | Remove the comments from the generated js optionsNoComments :: Options mode -> Bool -- | Specify the namespace that PureScript modules will be exported to when -- running in the browser. optionsAdditional :: Options mode -> ModeOptions mode -- | Default compiler options defaultCompileOptions :: Options Compile -- | Default make options defaultMakeOptions :: Options Make instance Show (ModeOptions mode) instance Show (Options mode) -- | Data types for names module Language.PureScript.Names -- | Names for value identifiers data Ident -- | An alphanumeric identifier Ident :: String -> Ident -- | A symbolic name for an infix operator Op :: String -> Ident runIdent :: Ident -> String -- | Proper names, i.e. capitalized names for e.g. module names, type//data -- constructors. newtype ProperName ProperName :: String -> ProperName runProperName :: ProperName -> String -- | Module names data ModuleName ModuleName :: [ProperName] -> ModuleName runModuleName :: ModuleName -> String moduleNameFromString :: String -> ModuleName -- | A qualified name, i.e. a name with an optional module name data Qualified a Qualified :: (Maybe ModuleName) -> a -> Qualified a -- | Provide a default module name, if a name is unqualified qualify :: ModuleName -> Qualified a -> (ModuleName, a) instance Typeable Ident instance Typeable ProperName instance Typeable ModuleName instance Typeable Qualified instance Eq Ident instance Ord Ident instance Data Ident instance Eq ProperName instance Ord ProperName instance Data ProperName instance Eq ModuleName instance Ord ModuleName instance Data ModuleName instance Eq a => Eq (Qualified a) instance Ord a => Ord (Qualified a) instance Data a => Data (Qualified a) instance Functor Qualified instance Show a => Show (Qualified a) instance Show ModuleName instance Show ProperName instance Show Ident -- | Common code generation utility functions module Language.PureScript.CodeGen.JS.Common -- | Convert an Ident into a valid Javascript identifier: -- -- identToJs :: Ident -> String -- | Test if a string is a valid JS identifier without escaping. identNeedsEscaping :: String -> Bool -- | Attempts to find a human-readable name for a symbol, if none has been -- specified returns the ordinal value. identCharToString :: Char -> String -- | Checks whether an identifier name is reserved in Javascript. nameIsJsReserved :: String -> Bool moduleNameToJs :: ModuleName -> String -- | Checks whether a proper name is reserved in Javascript. properNameIsJsReserved :: String -> Bool -- | The core functional representation for binders module Language.PureScript.CoreFn.Binders -- | Data type for binders data Binder a -- | Wildcard binder NullBinder :: a -> Binder a -- | A binder which matches a literal value LiteralBinder :: a -> (Literal (Binder a)) -> Binder a -- | A binder which binds an identifier VarBinder :: a -> Ident -> Binder a -- | A binder which matches a data constructor (type name, constructor -- name, binders) ConstructorBinder :: a -> (Qualified ProperName) -> (Qualified ProperName) -> [Binder a] -> Binder a -- | A binder which binds its input to an identifier NamedBinder :: a -> Ident -> (Binder a) -> Binder a instance Typeable Binder instance Show a => Show (Binder a) instance Data a => Data (Binder a) instance Functor Binder -- | The core functional representation module Language.PureScript.CoreFn.Expr -- | Data type for expressions and terms data Expr a -- | A literal value Literal :: a -> (Literal (Expr a)) -> Expr a -- | A data constructor (type name, constructor name, field names) Constructor :: a -> ProperName -> ProperName -> [Ident] -> Expr a -- | A record property accessor Accessor :: a -> String -> (Expr a) -> Expr a -- | Partial record update ObjectUpdate :: a -> (Expr a) -> [(String, Expr a)] -> Expr a -- | Function introduction Abs :: a -> Ident -> (Expr a) -> Expr a -- | Function application App :: a -> (Expr a) -> (Expr a) -> Expr a -- | Variable Var :: a -> (Qualified Ident) -> Expr a -- | A case expression Case :: a -> [Expr a] -> [CaseAlternative a] -> Expr a -- | A let binding Let :: a -> [Bind a] -> (Expr a) -> Expr a -- | A let or module binding. data Bind a -- | Non-recursive binding for a single value NonRec :: Ident -> (Expr a) -> Bind a -- | Mutually recursive binding group for several values Rec :: [(Ident, Expr a)] -> Bind a -- | A guard is just a boolean-valued expression that appears alongside a -- set of binders type Guard a = Expr a -- | An alternative in a case statement data CaseAlternative a CaseAlternative :: [Binder a] -> Either [(Guard a, Expr a)] (Expr a) -> CaseAlternative a -- | A collection of binders with which to match the inputs caseAlternativeBinders :: CaseAlternative a -> [Binder a] -- | The result expression or a collect of guarded expressions caseAlternativeResult :: CaseAlternative a -> Either [(Guard a, Expr a)] (Expr a) -- | Extract the annotation from a term extractAnn :: Expr a -> a -- | Modify the annotation on a term modifyAnn :: (a -> a) -> Expr a -> Expr a instance Typeable CaseAlternative instance Typeable Expr instance Typeable Bind instance Show a => Show (CaseAlternative a) instance Data a => Data (CaseAlternative a) instance Show a => Show (Expr a) instance Data a => Data (Expr a) instance Functor Expr instance Show a => Show (Bind a) instance Data a => Data (Bind a) instance Functor Bind instance Functor CaseAlternative -- | CoreFn traversal helpers module Language.PureScript.CoreFn.Traversals everywhereOnValues :: (Bind a -> Bind a) -> (Expr a -> Expr a) -> (Binder a -> Binder a) -> (Bind a -> Bind a, Expr a -> Expr a, Binder a -> Binder a) everythingOnValues :: (r -> r -> r) -> (Bind a -> r) -> (Expr a -> r) -> (Binder a -> r) -> (CaseAlternative a -> r) -> (Bind a -> r, Expr a -> r, Binder a -> r, CaseAlternative a -> r) -- | Metadata annotations for core functional representation module Language.PureScript.CoreFn.Meta -- | Metadata annotations data Meta -- | The contained value is a data constructor IsConstructor :: ConstructorType -> [Ident] -> Meta -- | The contained value is a newtype IsNewtype :: Meta -- | The contained value is a typeclass dictionary constructor IsTypeClassConstructor :: Meta -- | Data constructor metadata data ConstructorType -- | The constructor is for a type with a single construcor ProductType :: ConstructorType -- | The constructor is for a type with multiple construcors SumType :: ConstructorType instance Typeable ConstructorType instance Typeable Meta instance Show ConstructorType instance Data ConstructorType instance Show Meta instance Data Meta module Language.PureScript.Kinds -- | The data type of kinds data Kind -- | Unification variable of type Kind KUnknown :: Unknown -> Kind -- | The kind of types Star :: Kind -- | The kind of effects Bang :: Kind -- | Kinds for labelled, unordered rows without duplicates Row :: Kind -> Kind -- | Function kinds FunKind :: Kind -> Kind -> Kind everywhereOnKinds :: (Kind -> Kind) -> Kind -> Kind everythingOnKinds :: (r -> r -> r) -> (Kind -> r) -> Kind -> r instance Typeable Kind instance Show Kind instance Eq Kind instance Data Kind -- | Data types for types module Language.PureScript.Types -- | An identifier for the scope of a skolem variable newtype SkolemScope SkolemScope :: Int -> SkolemScope runSkolemScope :: SkolemScope -> Int -- | The type of types data Type -- | A unification variable of type Type TUnknown :: Unknown -> Type -- | A named type variable TypeVar :: String -> Type -- | A type wildcard, as would appear in a partial type synonym TypeWildcard :: Type -- | A type constructor TypeConstructor :: (Qualified ProperName) -> Type -- | A type application TypeApp :: Type -> Type -> Type -- | A type synonym which is "saturated", i.e. fully applied SaturatedTypeSynonym :: (Qualified ProperName) -> [Type] -> Type -- | Forall quantifier ForAll :: String -> Type -> (Maybe SkolemScope) -> Type -- | A type with a set of type class constraints ConstrainedType :: [Constraint] -> Type -> Type -- | A skolem constant Skolem :: String -> Int -> SkolemScope -> Type -- | An empty row REmpty :: Type -- | A non-empty row RCons :: String -> Type -> Type -> Type -- | A type with a kind annotation KindedType :: Type -> Kind -> Type -- | A placeholder used in pretty printing PrettyPrintFunction :: Type -> Type -> Type -- | A placeholder used in pretty printing PrettyPrintArray :: Type -> Type -- | A placeholder used in pretty printing PrettyPrintObject :: Type -> Type -- | A placeholder used in pretty printing PrettyPrintForAll :: [String] -> Type -> Type -- | A typeclass constraint type Constraint = (Qualified ProperName, [Type]) -- | Convert a row to a list of pairs of labels and types rowToList :: Type -> ([(String, Type)], Type) -- | Convert a list of labels and types to a row rowFromList :: ([(String, Type)], Type) -> Type -- | Check whether a type is a monotype isMonoType :: Type -> Bool -- | Universally quantify a type mkForAll :: [String] -> Type -> Type -- | Replace a type variable, taking into account variable shadowing replaceTypeVars :: String -> Type -> Type -> Type -- | Replace named type variables with types replaceAllTypeVars :: [(String, Type)] -> Type -> Type -- | Collect all type variables appearing in a type usedTypeVariables :: Type -> [String] -- | Collect all free type variables appearing in a type freeTypeVariables :: Type -> [String] -- | Universally quantify over all type variables appearing free in a type quantify :: Type -> Type -- | Move all universal quantifiers to the front of a type moveQuantifiersToFront :: Type -> Type -- | Check if a type contains wildcards containsWildcards :: Type -> Bool everywhereOnTypes :: (Type -> Type) -> Type -> Type everywhereOnTypesTopDown :: (Type -> Type) -> Type -> Type everywhereOnTypesM :: (Functor m, Applicative m, Monad m) => (Type -> m Type) -> Type -> m Type everywhereOnTypesTopDownM :: (Functor m, Applicative m, Monad m) => (Type -> m Type) -> Type -> m Type everythingOnTypes :: (r -> r -> r) -> (Type -> r) -> Type -> r instance Typeable SkolemScope instance Typeable Type instance Show SkolemScope instance Eq SkolemScope instance Ord SkolemScope instance Data SkolemScope instance Show Type instance Eq Type instance Data Type module Language.PureScript.TypeClassDictionaries -- | Data representing a type class dictionary which is in scope data TypeClassDictionaryInScope TypeClassDictionaryInScope :: Qualified Ident -> Qualified ProperName -> [Type] -> Maybe [Constraint] -> TypeClassDictionaryType -> Bool -> TypeClassDictionaryInScope -- | The identifier with which the dictionary can be accessed at runtime tcdName :: TypeClassDictionaryInScope -> Qualified Ident -- | The name of the type class to which this type class instance applies tcdClassName :: TypeClassDictionaryInScope -> Qualified ProperName -- | The types to which this type class instance applies tcdInstanceTypes :: TypeClassDictionaryInScope -> [Type] -- | Type class dependencies which must be satisfied to construct this -- dictionary tcdDependencies :: TypeClassDictionaryInScope -> Maybe [Constraint] -- | The type of this dictionary tcdType :: TypeClassDictionaryInScope -> TypeClassDictionaryType -- | Is this instance exported by its module? tcdExported :: TypeClassDictionaryInScope -> Bool -- | The type of a type class dictionary data TypeClassDictionaryType -- | A regular type class dictionary TCDRegular :: TypeClassDictionaryType -- | A type class dictionary which is an alias for an imported dictionary -- from another module TCDAlias :: (Qualified Ident) -> TypeClassDictionaryType -- | A simplified representation of expressions which are used to represent -- type class dictionaries at runtime, which can be compared for equality data DictionaryValue -- | A dictionary which is brought into scope by a local constraint LocalDictionaryValue :: (Qualified Ident) -> DictionaryValue -- | A dictionary which is brought into scope by an instance declaration GlobalDictionaryValue :: (Qualified Ident) -> DictionaryValue -- | A dictionary which depends on other dictionaries DependentDictionaryValue :: (Qualified Ident) -> [DictionaryValue] -> DictionaryValue -- | A subclass dictionary SubclassDictionaryValue :: DictionaryValue -> (Qualified ProperName) -> Integer -> DictionaryValue -- | Find the original dictionary which a type class dictionary in scope -- refers to canonicalizeDictionary :: TypeClassDictionaryInScope -> Qualified Ident instance Typeable TypeClassDictionaryType instance Typeable TypeClassDictionaryInScope instance Show TypeClassDictionaryType instance Eq TypeClassDictionaryType instance Data TypeClassDictionaryType instance Show TypeClassDictionaryInScope instance Data TypeClassDictionaryInScope instance Show DictionaryValue instance Ord DictionaryValue instance Eq DictionaryValue module Language.PureScript.Environment -- | The Environment defines all values and types which are -- currently in scope: data Environment Environment :: Map (ModuleName, Ident) (Type, NameKind, NameVisibility) -> Map (Qualified ProperName) (Kind, TypeKind) -> Map (Qualified ProperName) (DataDeclType, ProperName, Type, [Ident]) -> Map (Qualified ProperName) ([(String, Maybe Kind)], Type) -> Map (Qualified Ident, Maybe ModuleName) TypeClassDictionaryInScope -> Map (Qualified ProperName) ([(String, Maybe Kind)], [(Ident, Type)], [Constraint]) -> Environment -- | Value names currently in scope names :: Environment -> Map (ModuleName, Ident) (Type, NameKind, NameVisibility) -- | Type names currently in scope types :: Environment -> Map (Qualified ProperName) (Kind, TypeKind) -- | Data constructors currently in scope, along with their associated data -- type constructors dataConstructors :: Environment -> Map (Qualified ProperName) (DataDeclType, ProperName, Type, [Ident]) -- | Type synonyms currently in scope typeSynonyms :: Environment -> Map (Qualified ProperName) ([(String, Maybe Kind)], Type) -- | Available type class dictionaries typeClassDictionaries :: Environment -> Map (Qualified Ident, Maybe ModuleName) TypeClassDictionaryInScope -- | Type classes typeClasses :: Environment -> Map (Qualified ProperName) ([(String, Maybe Kind)], [(Ident, Type)], [Constraint]) -- | The initial environment with no values and only the default javascript -- types defined initEnvironment :: Environment -- | The type of a foreign import data ForeignImportType -- | A regular foreign import ForeignImport :: ForeignImportType -- | A foreign import which contains inline Javascript as a string literal InlineJavascript :: ForeignImportType -- | The visibility of a name in scope data NameVisibility -- | The name is defined in the current binding group, but is not visible Undefined :: NameVisibility -- | The name is defined in the another binding group, or has been made -- visible by a function binder Defined :: NameVisibility -- | The kind of a name data NameKind -- | A value introduced as a binding in a module Value :: NameKind -- | A type class dictionary member accessor import, generated during -- desugaring of type class declarations TypeClassAccessorImport :: NameKind -- | A foreign import Extern :: ForeignImportType -> NameKind -- | A local name introduced using a lambda abstraction, variable -- introduction or binder LocalVariable :: NameKind -- | A data constructor DataConstructor :: NameKind -- | A type class dictionary, generated during desugaring of type class -- declarations TypeInstanceDictionaryValue :: NameKind -- | The kinds of a type data TypeKind -- | Data type DataType :: [(String, Maybe Kind)] -> [(ProperName, [Type])] -> TypeKind -- | Type synonym TypeSynonym :: TypeKind -- | Foreign data ExternData :: TypeKind -- | A local type variable LocalTypeVariable :: TypeKind -- | A scoped type variable ScopedTypeVar :: TypeKind -- | The type ('data' or 'newtype') of a data type declaration data DataDeclType -- | A standard data constructor Data :: DataDeclType -- | A newtype constructor Newtype :: DataDeclType -- | Construct a ProperName in the Prim module primName :: String -> Qualified ProperName -- | Construct a type in the Prim module primTy :: String -> Type -- | Type constructor for functions tyFunction :: Type -- | Type constructor for strings tyString :: Type -- | Type constructor for numbers tyNumber :: Type -- | Type constructor for booleans tyBoolean :: Type -- | Type constructor for arrays tyArray :: Type -- | Type constructor for objects tyObject :: Type -- | Smart constructor for function types function :: Type -> Type -> Type -- | The primitive types in the external javascript environment with their -- associated kinds. primTypes :: Map (Qualified ProperName) (Kind, TypeKind) -- | Finds information about data constructors from the current -- environment. lookupConstructor :: Environment -> Qualified ProperName -> (DataDeclType, ProperName, Type, [Ident]) -- | Checks whether a data constructor is for a newtype. isNewtypeConstructor :: Environment -> Qualified ProperName -> Bool instance Typeable ForeignImportType instance Typeable NameKind instance Typeable TypeKind instance Typeable DataDeclType instance Show ForeignImportType instance Eq ForeignImportType instance Data ForeignImportType instance Show NameVisibility instance Eq NameVisibility instance Show NameKind instance Eq NameKind instance Data NameKind instance Show TypeKind instance Eq TypeKind instance Data TypeKind instance Eq DataDeclType instance Ord DataDeclType instance Data DataDeclType instance Show Environment instance Show DataDeclType -- | Defines the types of source code comments module Language.PureScript.Comments data Comment LineComment :: String -> Comment BlockComment :: String -> Comment instance Typeable Comment instance Show Comment instance Eq Comment instance Ord Comment instance Data Comment -- | Case binders module Language.PureScript.AST.Binders -- | Data type for binders data Binder -- | Wildcard binder NullBinder :: Binder -- | A binder which matches a boolean literal BooleanBinder :: Bool -> Binder -- | A binder which matches a string literal StringBinder :: String -> Binder -- | A binder which matches a numeric literal NumberBinder :: (Either Integer Double) -> Binder -- | A binder which binds an identifier VarBinder :: Ident -> Binder -- | A binder which matches a data constructor ConstructorBinder :: (Qualified ProperName) -> [Binder] -> Binder -- | A binder which matches a record and binds its properties ObjectBinder :: [(String, Binder)] -> Binder -- | A binder which matches an array and binds its elements ArrayBinder :: [Binder] -> Binder -- | A binder which matches an array and binds its head and tail ConsBinder :: Binder -> Binder -> Binder -- | A binder which binds its input to an identifier NamedBinder :: Ident -> Binder -> Binder -- | A binder with source position information PositionedBinder :: SourceSpan -> [Comment] -> Binder -> Binder -- | Collect all names introduced in binders in an expression binderNames :: Binder -> [Ident] instance Typeable Binder instance Show Binder instance Data Binder -- | Data types for the intermediate simplified-Javascript AST module Language.PureScript.CodeGen.JS.AST -- | Built-in unary operators data UnaryOperator -- | Numeric negation Negate :: UnaryOperator -- | Boolean negation Not :: UnaryOperator -- | Bitwise negation BitwiseNot :: UnaryOperator -- | Numeric unary 'plus' Positive :: UnaryOperator -- | Constructor JSNew :: UnaryOperator -- | Built-in binary operators data BinaryOperator -- | Numeric addition Add :: BinaryOperator -- | Numeric subtraction Subtract :: BinaryOperator -- | Numeric multiplication Multiply :: BinaryOperator -- | Numeric division Divide :: BinaryOperator -- | Remainder Modulus :: BinaryOperator -- | Generic equality test EqualTo :: BinaryOperator -- | Generic inequality test NotEqualTo :: BinaryOperator -- | Numeric less-than LessThan :: BinaryOperator -- | Numeric less-than-or-equal LessThanOrEqualTo :: BinaryOperator -- | Numeric greater-than GreaterThan :: BinaryOperator -- | Numeric greater-than-or-equal GreaterThanOrEqualTo :: BinaryOperator -- | Boolean and And :: BinaryOperator -- | Boolean or Or :: BinaryOperator -- | Bitwise and BitwiseAnd :: BinaryOperator -- | Bitwise or BitwiseOr :: BinaryOperator -- | Bitwise xor BitwiseXor :: BinaryOperator -- | Bitwise left shift ShiftLeft :: BinaryOperator -- | Bitwise right shift ShiftRight :: BinaryOperator -- | Bitwise right shift with zero-fill ZeroFillShiftRight :: BinaryOperator -- | Data type for simplified Javascript expressions data JS -- | A numeric literal JSNumericLiteral :: (Either Integer Double) -> JS -- | A string literal JSStringLiteral :: String -> JS -- | A boolean literal JSBooleanLiteral :: Bool -> JS -- | A unary operator application JSUnary :: UnaryOperator -> JS -> JS -- | A binary operator application JSBinary :: BinaryOperator -> JS -> JS -> JS -- | An array literal JSArrayLiteral :: [JS] -> JS -- | An array indexer expression JSIndexer :: JS -> JS -> JS -- | An object literal JSObjectLiteral :: [(String, JS)] -> JS -- | An object property accessor expression JSAccessor :: String -> JS -> JS -- | A function introduction (optional name, arguments, body) JSFunction :: (Maybe String) -> [String] -> JS -> JS -- | Function application JSApp :: JS -> [JS] -> JS -- | Variable JSVar :: String -> JS -- | Conditional expression JSConditional :: JS -> JS -> JS -> JS -- | A block of expressions in braces JSBlock :: [JS] -> JS -- | A variable introduction and optional initialization JSVariableIntroduction :: String -> (Maybe JS) -> JS -- | A variable assignment JSAssignment :: JS -> JS -> JS -- | While loop JSWhile :: JS -> JS -> JS -- | For loop JSFor :: String -> JS -> JS -> JS -> JS -- | ForIn loop JSForIn :: String -> JS -> JS -> JS -- | If-then-else statement JSIfElse :: JS -> JS -> (Maybe JS) -> JS -- | Return statement JSReturn :: JS -> JS -- | Throw statement JSThrow :: JS -> JS -- | Type-Of operator JSTypeOf :: JS -> JS -- | InstanceOf test JSInstanceOf :: JS -> JS -> JS -- | Labelled statement JSLabel :: String -> JS -> JS -- | Break statement JSBreak :: String -> JS -- | Continue statement JSContinue :: String -> JS -- | Raw Javascript (generated when parsing fails for an inline foreign -- import declaration) JSRaw :: String -> JS -- | Commented Javascript JSComment :: [Comment] -> JS -> JS everywhereOnJS :: (JS -> JS) -> JS -> JS everywhereOnJSTopDown :: (JS -> JS) -> JS -> JS everythingOnJS :: (r -> r -> r) -> (JS -> r) -> JS -> r instance Typeable UnaryOperator instance Typeable BinaryOperator instance Typeable JS instance Show UnaryOperator instance Eq UnaryOperator instance Data UnaryOperator instance Show BinaryOperator instance Eq BinaryOperator instance Data BinaryOperator instance Show JS instance Eq JS instance Data JS -- | Data types for modules and declarations module Language.PureScript.AST.Declarations -- | 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. data Module Module :: [Comment] -> ModuleName -> [Declaration] -> (Maybe [DeclarationRef]) -> Module -- | Return a module's name. getModuleName :: Module -> ModuleName -- | Test if a declaration is exported, given a module's export list. isExported :: Maybe [DeclarationRef] -> Declaration -> Bool exportedDeclarations :: Module -> [Declaration] -- | Test if a data constructor for a given type is exported, given a -- module's export list. isDctorExported :: ProperName -> Maybe [DeclarationRef] -> ProperName -> Bool -- | Return the exported data constructors for a given type. exportedDctors :: Module -> ProperName -> [ProperName] -- | An item in a list of explicit imports or exports data DeclarationRef -- | A type constructor with data constructors TypeRef :: ProperName -> (Maybe [ProperName]) -> DeclarationRef -- | A value ValueRef :: Ident -> DeclarationRef -- | A type class TypeClassRef :: ProperName -> DeclarationRef -- | A type class instance, created during typeclass desugaring (name, -- class name, instance types) TypeInstanceRef :: Ident -> DeclarationRef -- | A declaration reference with source position information PositionedDeclarationRef :: SourceSpan -> [Comment] -> DeclarationRef -> DeclarationRef -- | The data type which specifies type of import declaration data ImportDeclarationType -- | An import with no explicit list: `import M` Implicit :: ImportDeclarationType -- | An import with an explicit list of references to import: `import M -- (foo)` Explicit :: [DeclarationRef] -> ImportDeclarationType -- | An import with a list of references to hide: `import M hiding (foo)` Hiding :: [DeclarationRef] -> ImportDeclarationType -- | The data type of declarations data Declaration -- | A data type declaration (data or newtype, name, arguments, data -- constructors) DataDeclaration :: DataDeclType -> ProperName -> [(String, Maybe Kind)] -> [(ProperName, [Type])] -> Declaration -- | A minimal mutually recursive set of data type declarations DataBindingGroupDeclaration :: [Declaration] -> Declaration -- | A type synonym declaration (name, arguments, type) TypeSynonymDeclaration :: ProperName -> [(String, Maybe Kind)] -> Type -> Declaration -- | A type declaration for a value (name, ty) TypeDeclaration :: Ident -> Type -> Declaration -- | A value declaration (name, top-level binders, optional guard, value) ValueDeclaration :: Ident -> NameKind -> [Binder] -> (Either [(Guard, Expr)] Expr) -> Declaration -- | A minimal mutually recursive set of value declarations BindingGroupDeclaration :: [(Ident, NameKind, Expr)] -> Declaration -- | A foreign import declaration (type, name, optional inline Javascript, -- type) ExternDeclaration :: ForeignImportType -> Ident -> (Maybe JS) -> Type -> Declaration -- | A data type foreign import (name, kind) ExternDataDeclaration :: ProperName -> Kind -> Declaration -- | A type class instance foreign import ExternInstanceDeclaration :: Ident -> [Constraint] -> (Qualified ProperName) -> [Type] -> Declaration -- | A fixity declaration (fixity data, operator name) FixityDeclaration :: Fixity -> String -> Declaration -- | A module import (module name, qualifiedunqualifiedhiding, -- optional "qualified as" name) ImportDeclaration :: ModuleName -> ImportDeclarationType -> (Maybe ModuleName) -> Declaration -- | A type class declaration (name, argument, implies, member -- declarations) TypeClassDeclaration :: ProperName -> [(String, Maybe Kind)] -> [Constraint] -> [Declaration] -> Declaration -- | A type instance declaration (name, dependencies, class name, instance -- types, member declarations) TypeInstanceDeclaration :: Ident -> [Constraint] -> (Qualified ProperName) -> [Type] -> [Declaration] -> Declaration -- | A declaration with source position information PositionedDeclaration :: SourceSpan -> [Comment] -> Declaration -> Declaration -- | Test if a declaration is a value declaration isValueDecl :: Declaration -> Bool -- | Test if a declaration is a data type or type synonym declaration isDataDecl :: Declaration -> Bool -- | Test if a declaration is a module import isImportDecl :: Declaration -> Bool -- | Test if a declaration is a data type foreign import isExternDataDecl :: Declaration -> Bool -- | Test if a declaration is a type class instance foreign import isExternInstanceDecl :: Declaration -> Bool -- | Test if a declaration is a fixity declaration isFixityDecl :: Declaration -> Bool -- | Test if a declaration is a foreign import isExternDecl :: Declaration -> Bool -- | Test if a declaration is a type class instance declaration isTypeClassInstanceDeclaration :: Declaration -> Bool -- | Test if a declaration is a type class declaration isTypeClassDeclaration :: Declaration -> Bool -- | Recursively flatten data binding groups in the list of declarations flattenDecls :: [Declaration] -> [Declaration] -- | A guard is just a boolean-valued expression that appears alongside a -- set of binders type Guard = Expr -- | Data type for expressions and terms data Expr -- | A numeric literal NumericLiteral :: (Either Integer Double) -> Expr -- | A string literal StringLiteral :: String -> Expr -- | A boolean literal BooleanLiteral :: Bool -> Expr -- | A prefix -, will be desugared UnaryMinus :: Expr -> Expr -- | Binary operator application. During the rebracketing phase of -- desugaring, this data constructor will be removed. BinaryNoParens :: Expr -> Expr -> Expr -> Expr -- | Explicit parentheses. During the rebracketing phase of desugaring, -- this data constructor will be removed. Parens :: Expr -> Expr -- | Operator section. This will be removed during desugaring and replaced -- with a partially applied operator or lambda to flip the arguments. OperatorSection :: Expr -> (Either Expr Expr) -> Expr -- | An array literal ArrayLiteral :: [Expr] -> Expr -- | An object literal ObjectLiteral :: [(String, Expr)] -> Expr -- | An object constructor (object literal with underscores). This will be -- removed during desugaring and expanded into a lambda that returns an -- object literal. ObjectConstructor :: [(String, Maybe Expr)] -> Expr -- | An object property getter (e.g. `_.x`). This will be removed during -- desugaring and expanded into a lambda that reads a property from an -- object. ObjectGetter :: String -> Expr -- | An record property accessor expression Accessor :: String -> Expr -> Expr -- | Partial record update ObjectUpdate :: Expr -> [(String, Expr)] -> Expr -- | Partial record updater. This will be removed during desugaring and -- expanded into a lambda that returns an object update. ObjectUpdater :: (Maybe Expr) -> [(String, Maybe Expr)] -> Expr -- | Function introduction Abs :: (Either Ident Binder) -> Expr -> Expr -- | Function application App :: Expr -> Expr -> Expr -- | Variable Var :: (Qualified Ident) -> Expr -- | Conditional (if-then-else expression) IfThenElse :: Expr -> Expr -> Expr -> Expr -- | A data constructor Constructor :: (Qualified ProperName) -> Expr -- | 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. Case :: [Expr] -> [CaseAlternative] -> Expr -- | A value with a type annotation TypedValue :: Bool -> Expr -> Type -> Expr -- | A let binding Let :: [Declaration] -> Expr -> Expr -- | A do-notation block Do :: [DoNotationElement] -> Expr -- | An application of a typeclass dictionary constructor. The value should -- be an ObjectLiteral. TypeClassDictionaryConstructorApp :: (Qualified ProperName) -> Expr -> Expr -- | 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. TypeClassDictionary :: Bool -> Constraint -> [TypeClassDictionaryInScope] -> Expr -- | A typeclass dictionary accessor, the implementation is left -- unspecified until CoreFn desugaring. TypeClassDictionaryAccessor :: (Qualified ProperName) -> Ident -> Expr -- | A placeholder for a superclass dictionary to be turned into a -- TypeClassDictionary during typechecking SuperClassDictionary :: (Qualified ProperName) -> [Type] -> Expr -- | A value with source position information PositionedValue :: SourceSpan -> [Comment] -> Expr -> Expr -- | An alternative in a case statement data CaseAlternative CaseAlternative :: [Binder] -> Either [(Guard, Expr)] Expr -> CaseAlternative -- | A collection of binders with which to match the inputs caseAlternativeBinders :: CaseAlternative -> [Binder] -- | The result expression or a collect of guarded expressions caseAlternativeResult :: CaseAlternative -> Either [(Guard, Expr)] Expr -- | A statement in a do-notation block data DoNotationElement -- | A monadic value without a binder DoNotationValue :: Expr -> DoNotationElement -- | A monadic value with a binder DoNotationBind :: Binder -> Expr -> DoNotationElement -- | A let statement, i.e. a pure value with a binder DoNotationLet :: [Declaration] -> DoNotationElement -- | A do notation element with source position information PositionedDoNotationElement :: SourceSpan -> [Comment] -> DoNotationElement -> DoNotationElement instance Typeable DeclarationRef instance Typeable ImportDeclarationType instance Typeable DoNotationElement instance Typeable Expr instance Typeable CaseAlternative instance Typeable Declaration instance Typeable Module instance Show DeclarationRef instance Data DeclarationRef instance Show ImportDeclarationType instance Data ImportDeclarationType instance Show DoNotationElement instance Data DoNotationElement instance Show Expr instance Data Expr instance Show CaseAlternative instance Data CaseAlternative instance Show Declaration instance Data Declaration instance Show Module instance Data Module instance Eq DeclarationRef -- | AST traversal helpers module Language.PureScript.AST.Traversals everywhereOnValues :: (Declaration -> Declaration) -> (Expr -> Expr) -> (Binder -> Binder) -> (Declaration -> Declaration, Expr -> Expr, Binder -> Binder) everywhereOnValuesTopDownM :: (Functor m, Applicative m, Monad m) => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everywhereOnValuesM :: (Functor m, Applicative m, Monad m) => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everythingOnValues :: (r -> r -> r) -> (Declaration -> r) -> (Expr -> r) -> (Binder -> r) -> (CaseAlternative -> r) -> (DoNotationElement -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) everythingWithContextOnValues :: 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) everywhereWithContextOnValuesM :: (Functor m, Applicative m, 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) accumTypes :: Monoid r => (Type -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) -- | Common functions used by the various optimizer phases module Language.PureScript.CodeGen.JS.Optimizer.Common applyAll :: [a -> a] -> a -> a replaceIdent :: String -> JS -> JS -> JS replaceIdents :: [(String, JS)] -> JS -> JS isReassigned :: String -> JS -> Bool isRebound :: JS -> JS -> Bool isUsed :: String -> JS -> Bool targetVariable :: JS -> String isUpdated :: String -> JS -> Bool removeFromBlock :: ([JS] -> [JS]) -> JS -> JS -- | This module implements tail call elimination. module Language.PureScript.CodeGen.JS.Optimizer.TCO -- | Eliminate tail calls tco :: Options mode -> JS -> JS -- | This module implements the "Magic Do" optimization, which inlines -- calls to return and bind for the Eff monad, as well as some of its -- actions. module Language.PureScript.CodeGen.JS.Optimizer.MagicDo magicDo :: Options mode -> JS -> JS -- | This module provides basic inlining capabilities module Language.PureScript.CodeGen.JS.Optimizer.Inliner inlineVariables :: JS -> JS inlineValues :: JS -> JS inlineOperator :: (String, String) -> (JS -> JS -> JS) -> JS -> JS inlineCommonOperators :: JS -> JS etaConvert :: JS -> JS unThunk :: JS -> JS evaluateIifes :: JS -> JS -- | Removes unused variables module Language.PureScript.CodeGen.JS.Optimizer.Unused removeCodeAfterReturnStatements :: JS -> JS removeUnusedArg :: JS -> JS removeUndefinedApp :: JS -> JS -- | Optimizer steps for simplifying Javascript blocks module Language.PureScript.CodeGen.JS.Optimizer.Blocks -- | Collapse blocks which appear nested directly below another block collapseNestedBlocks :: JS -> JS collapseNestedIfs :: JS -> JS -- | This module optimizes code in the simplified-Javascript intermediate -- representation. -- -- The following optimizations are supported: -- -- module Language.PureScript.CodeGen.JS.Optimizer -- | Apply a series of optimizer passes to simplified Javascript code optimize :: (Monad m, MonadReader (Options mode) m) => JS -> m JS -- | Type alias for basic annotations module Language.PureScript.CoreFn.Ann -- | Type alias for basic annotations type Ann = (Maybe SourceSpan, [Comment], Maybe Type, Maybe Meta) -- | Initial annotation with no metadata nullAnn :: Ann -- | Remove the comments from an annotation removeComments :: Ann -> Ann -- | The CoreFn module representation module Language.PureScript.CoreFn.Module data Module a Module :: [Comment] -> ModuleName -> [ModuleName] -> [Ident] -> [ForeignDecl] -> [Bind a] -> Module a moduleComments :: Module a -> [Comment] moduleName :: Module a -> ModuleName moduleImports :: Module a -> [ModuleName] moduleExports :: Module a -> [Ident] moduleForeign :: Module a -> [ForeignDecl] moduleDecls :: Module a -> [Bind a] type ForeignDecl = (Ident, Maybe JS, Type) instance Show a => Show (Module a) -- | The first step in the parsing process - turns source code into a list -- of lexemes module Language.PureScript.Parser.Lexer data PositionedToken PositionedToken :: SourcePos -> Token -> [Comment] -> PositionedToken ptSourcePos :: PositionedToken -> SourcePos ptToken :: PositionedToken -> Token ptComments :: PositionedToken -> [Comment] data Token type TokenParser a = Parsec [PositionedToken] ParseState a lex :: FilePath -> String -> Either ParseError [PositionedToken] anyToken :: TokenParser PositionedToken token :: (Token -> Maybe a) -> TokenParser a match :: Token -> TokenParser () lparen :: TokenParser () rparen :: TokenParser () parens :: TokenParser a -> TokenParser a lbrace :: TokenParser () rbrace :: TokenParser () braces :: TokenParser a -> TokenParser a lsquare :: TokenParser () rsquare :: TokenParser () squares :: TokenParser a -> TokenParser a indent :: TokenParser Int indentAt :: Column -> TokenParser () larrow :: TokenParser () rarrow :: TokenParser () lfatArrow :: TokenParser () rfatArrow :: TokenParser () colon :: TokenParser () doubleColon :: TokenParser () equals :: TokenParser () pipe :: TokenParser () tick :: TokenParser () dot :: TokenParser () comma :: TokenParser () semi :: TokenParser () at :: TokenParser () underscore :: TokenParser () -- | Parse zero or more values separated by semicolons semiSep :: TokenParser a -> TokenParser [a] -- | Parse one or more values separated by semicolons semiSep1 :: TokenParser a -> TokenParser [a] -- | Parse zero or more values separated by commas commaSep :: TokenParser a -> TokenParser [a] -- | Parse one or more values separated by commas commaSep1 :: TokenParser a -> TokenParser [a] lname :: TokenParser String qualifier :: TokenParser String uname :: TokenParser String uname' :: String -> TokenParser () mname :: TokenParser String reserved :: String -> TokenParser () symbol :: TokenParser String symbol' :: String -> TokenParser () identifier :: TokenParser String stringLiteral :: TokenParser String number :: TokenParser (Either Integer Double) natural :: TokenParser Integer -- | A list of purescript reserved identifiers reservedPsNames :: [String] reservedTypeNames :: [String] -- | The characters allowed for use in operators opChars :: [Char] instance Show Token instance Eq Token instance Ord Token instance Eq PositionedToken instance Show PositionedToken -- | Constants, and utility functions to be used when parsing module Language.PureScript.Parser.Common properName :: TokenParser ProperName -- | Parse a module name moduleName :: TokenParser ModuleName -- | Parse a qualified name, i.e. M.name or just name parseQualified :: TokenParser a -> TokenParser (Qualified a) -- | Parse an identifier or parenthesized operator parseIdent :: TokenParser Ident -- | Run the first parser, then match the second if possible, applying the -- specified function on a successful match augment :: Stream s m t => ParsecT s u m a -> ParsecT s u m b -> (a -> b -> a) -> ParsecT s u m a -- | Run the first parser, then match the second zero or more times, -- applying the specified function for each match fold :: Stream s m t => ParsecT s u m a -> ParsecT s u m b -> (a -> b -> a) -> ParsecT s u m a -- | Build a parser from a smaller parser and a list of parsers for postfix -- operators buildPostfixParser :: Stream s m t => [a -> ParsecT s u m a] -> ParsecT s u m a -> ParsecT s u m a -- | Mark the current indentation level mark :: Parsec s ParseState a -> Parsec s ParseState a -- | Check that the current identation level matches a predicate checkIndentation :: (Column -> Column -> Bool) -> Parsec s ParseState () -- | Check that the current indentation level is past the current mark indented :: Parsec s ParseState () -- | Check that the current indentation level is at the same indentation as -- the current mark same :: Parsec s ParseState () -- | Read the comments from the the next token, without consuming it readComments :: Parsec [PositionedToken] u [Comment] -- | Run a parser runTokenParser :: FilePath -> TokenParser a -> [PositionedToken] -> Either ParseError a -- | A parser for kinds module Language.PureScript.Parser.Kinds -- | Parse a kind parseKind :: TokenParser Kind -- | Parsers for types module Language.PureScript.Parser.Types -- | Parse a monotype parseType :: TokenParser Type -- | Parse a polytype parsePolyType :: TokenParser Type -- | Parse an atomic type with no wildcards noWildcards :: TokenParser Type -> TokenParser Type -- | Parse a type as it appears in e.g. a data constructor parseTypeAtom :: TokenParser Type -- | Common pretty-printing utility functions module Language.PureScript.Pretty.Common -- | Wrap a string in parentheses parens :: String -> String newtype PrinterState PrinterState :: Int -> PrinterState indent :: PrinterState -> Int -- | Number of characters per identation level blockIndent :: Int -- | Pretty print with a new indentation level withIndent :: StateT PrinterState Maybe String -> StateT PrinterState Maybe String -- | Get the current indentation level currentIndent :: StateT PrinterState Maybe String -- | Print many lines prettyPrintMany :: (a -> StateT PrinterState Maybe String) -> [a] -> StateT PrinterState Maybe String -- | Prints an object key, escaping reserved names. prettyPrintObjectKey :: String -> String instance Show PrinterState instance Eq PrinterState instance Ord PrinterState -- | Pretty printer for kinds module Language.PureScript.Pretty.Kinds -- | Generate a pretty-printed string representing a Kind prettyPrintKind :: Kind -> String -- | Pretty printer for Types module Language.PureScript.Pretty.Types -- | Generate a pretty-printed string representing a Type prettyPrintType :: Type -> String -- | Generate a pretty-printed string representing a Type, as it should -- appear inside parentheses prettyPrintTypeAtom :: Type -> String -- | Generate a pretty-printed string representing a Row prettyPrintRow :: Type -> String -- | Pretty printer for the Javascript AST module Language.PureScript.Pretty.JS -- | Generate a pretty-printed string representing a collection of -- Javascript expressions at the same indentation level prettyPrintJS :: [JS] -> String -- | The initial PureScript AST module Language.PureScript.AST -- | Provides the ability to sort modules based on module dependencies module Language.PureScript.ModuleDependencies -- | Sort a collection of modules based on module dependencies. -- -- Reports an error if the module graph contains a cycle. sortModules :: MonadError String m => [Module] -> m ([Module], ModuleGraph) -- | A list of modules with their dependencies type ModuleGraph = [(ModuleName, [ModuleName])] -- | Parsers for module definitions and declarations module Language.PureScript.Parser.Declarations -- | Parse a single declaration parseDeclaration :: TokenParser Declaration -- | Parse a module header and a collection of declarations parseModule :: TokenParser Module -- | Parse a collection of modules parseModules :: TokenParser [Module] -- | Parse a collection of modules parseModulesFromFiles :: (k -> String) -> [(k, String)] -> Either ParseError [(k, Module)] -- | Parse a value parseValue :: TokenParser Expr -- | Parse a guard parseGuard :: TokenParser Guard -- | Parse a binder parseBinder :: TokenParser Binder -- | Parse a binder as it would appear in a top level declaration parseBinderNoParens :: TokenParser Binder parseImportDeclaration' :: TokenParser (ModuleName, ImportDeclarationType, Maybe ModuleName) parseLocalDeclaration :: TokenParser Declaration -- | A collection of parsers for core data types: -- -- module Language.PureScript.Parser -- | Pretty printer for values module Language.PureScript.Pretty.Values -- | Generate a pretty-printed string representing an expression prettyPrintValue :: Expr -> String -- | Generate a pretty-printed string representing a Binder prettyPrintBinder :: Binder -> String -- | A collection of pretty printers for core data types: -- -- module Language.PureScript.Pretty module Language.PureScript.Errors -- | A type of error messages data ErrorMessage InfiniteType :: Type -> ErrorMessage InfiniteKind :: Kind -> ErrorMessage CannotReorderOperators :: ErrorMessage MultipleFixities :: Ident -> ErrorMessage OrphanTypeDeclaration :: Ident -> ErrorMessage OrphanFixityDeclaration :: String -> ErrorMessage RedefinedModule :: ModuleName -> ErrorMessage RedefinedIdent :: Ident -> ErrorMessage OverlappingNamesInLet :: ErrorMessage UnknownModule :: ModuleName -> ErrorMessage UnknownType :: (Qualified ProperName) -> ErrorMessage UnknownTypeClass :: (Qualified ProperName) -> ErrorMessage UnknownValue :: (Qualified Ident) -> ErrorMessage UnknownDataConstructor :: (Qualified ProperName) -> (Maybe (Qualified ProperName)) -> ErrorMessage UnknownTypeConstructor :: (Qualified ProperName) -> ErrorMessage ConflictingImport :: String -> ModuleName -> ErrorMessage ConflictingImports :: String -> ModuleName -> ModuleName -> ErrorMessage ConflictingTypeDecls :: ProperName -> ErrorMessage ConflictingCtorDecls :: ProperName -> ErrorMessage TypeConflictsWithClass :: ProperName -> ErrorMessage CtorConflictsWithClass :: ProperName -> ErrorMessage ClassConflictsWithType :: ProperName -> ErrorMessage ClassConflictsWithCtor :: ProperName -> ErrorMessage DuplicateClassExport :: ProperName -> ErrorMessage DuplicateValueExport :: Ident -> ErrorMessage DuplicateTypeArgument :: String -> ErrorMessage InvalidDoBind :: ErrorMessage InvalidDoLet :: ErrorMessage CycleInDeclaration :: Ident -> ErrorMessage CycleInTypeSynonym :: (Maybe ProperName) -> ErrorMessage NameIsUndefined :: Ident -> ErrorMessage NameNotInScope :: Ident -> ErrorMessage UndefinedTypeVariable :: ProperName -> ErrorMessage PartiallyAppliedSynonym :: (Qualified ProperName) -> ErrorMessage NotYetDefined :: [Ident] -> ErrorMessage -> ErrorMessage EscapedSkolem :: (Maybe Expr) -> ErrorMessage UnspecifiedSkolemScope :: ErrorMessage TypesDoNotUnify :: Type -> Type -> ErrorMessage KindsDoNotUnify :: Kind -> Kind -> ErrorMessage ConstrainedTypeUnified :: Type -> Type -> ErrorMessage OverlappingInstances :: (Qualified ProperName) -> [Type] -> [DictionaryValue] -> ErrorMessage NoInstanceFound :: (Qualified ProperName) -> [Type] -> ErrorMessage DuplicateLabel :: String -> (Maybe Expr) -> ErrorMessage DuplicateValueDeclaration :: Ident -> ErrorMessage ArgListLengthsDiffer :: Ident -> ErrorMessage OverlappingArgNames :: (Maybe Ident) -> ErrorMessage MissingClassMember :: Ident -> ErrorMessage ExpectedType :: Kind -> ErrorMessage IncorrectConstructorArity :: (Qualified ProperName) -> ErrorMessage SubsumptionCheckFailed :: ErrorMessage ExprDoesNotHaveType :: Expr -> Type -> ErrorMessage PropertyIsMissing :: String -> Type -> ErrorMessage ErrorUnifyingTypes :: Type -> Type -> ErrorMessage -> ErrorMessage CannotApplyFunction :: Type -> Expr -> ErrorMessage TypeSynonymInstance :: ErrorMessage InvalidNewtype :: ErrorMessage InvalidInstanceHead :: Type -> ErrorMessage TransitiveExportError :: DeclarationRef -> [DeclarationRef] -> ErrorMessage ErrorInExpression :: Expr -> ErrorMessage -> ErrorMessage ErrorInModule :: ModuleName -> ErrorMessage -> ErrorMessage ErrorInInstance :: (Qualified ProperName) -> [Type] -> ErrorMessage -> ErrorMessage ErrorInSubsumption :: Type -> Type -> ErrorMessage -> ErrorMessage ErrorCheckingType :: Expr -> Type -> ErrorMessage -> ErrorMessage ErrorCheckingKind :: Type -> ErrorMessage -> ErrorMessage ErrorInferringType :: Expr -> ErrorMessage -> ErrorMessage ErrorInApplication :: Expr -> Type -> Expr -> ErrorMessage -> ErrorMessage ErrorInDataConstructor :: ProperName -> ErrorMessage -> ErrorMessage ErrorInTypeConstructor :: ProperName -> ErrorMessage -> ErrorMessage ErrorInBindingGroup :: [Ident] -> ErrorMessage -> ErrorMessage ErrorInDataBindingGroup :: ErrorMessage -> ErrorMessage ErrorInTypeSynonym :: ProperName -> ErrorMessage -> ErrorMessage ErrorInValueDeclaration :: Ident -> ErrorMessage -> ErrorMessage ErrorInForeignImport :: Ident -> ErrorMessage -> ErrorMessage PositionedError :: SourceSpan -> ErrorMessage -> ErrorMessage -- | Get the error code for a particular error type errorCode :: ErrorMessage -> String -- | A stack trace for an error newtype MultipleErrors MultipleErrors :: [ErrorMessage] -> MultipleErrors runMultipleErrors :: MultipleErrors -> [ErrorMessage] -- | Create an error set from a single error message errorMessage :: ErrorMessage -> MultipleErrors -- | Lift a function on ErrorMessage to a function on MultipleErrors onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors -- | Pretty print a single error, simplifying if necessary prettyPrintSingleError :: Bool -> ErrorMessage -> Box -- | Pretty print multiple errors prettyPrintMultipleErrors :: Bool -> MultipleErrors -> String renderBox :: Box -> String -- | Interpret multiple errors in a monad supporting errors interpretMultipleErrors :: MonadError String m => Bool -> Either MultipleErrors a -> m a -- | Rethrow an error with a more detailed error message in the case of -- failure rethrow :: MonadError e m => (e -> e) -> m a -> m a -- | Rethrow an error with source position information rethrowWithPosition :: MonadError MultipleErrors m => SourceSpan -> m a -> m a -- | Collect errors in in parallel parU :: (MonadError MultipleErrors m, Functor m) => [a] -> (a -> m b) -> m [b] instance Show ErrorMessage instance Show MultipleErrors instance Monoid MultipleErrors instance UnificationError Kind MultipleErrors instance UnificationError Type MultipleErrors instance UnificationError Kind ErrorMessage instance UnificationError Type ErrorMessage -- | Monads for type checking and type inference and associated data types module Language.PureScript.TypeChecker.Monad -- | Temporarily bind a collection of names to values bindNames :: MonadState CheckState m => Map (ModuleName, Ident) (Type, NameKind, NameVisibility) -> m a -> m a -- | Temporarily bind a collection of names to types bindTypes :: MonadState CheckState m => Map (Qualified ProperName) (Kind, TypeKind) -> m a -> m a -- | Temporarily bind a collection of names to types withScopedTypeVars :: (Functor m, MonadState CheckState m) => ModuleName -> [(String, Kind)] -> m a -> m a -- | Temporarily make a collection of type class dictionaries available withTypeClassDictionaries :: MonadState CheckState m => [TypeClassDictionaryInScope] -> m a -> m a -- | Get the currently available list of type class dictionaries getTypeClassDictionaries :: (Functor m, MonadState CheckState m) => m [TypeClassDictionaryInScope] -- | Temporarily bind a collection of names to local variables bindLocalVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(Ident, Type, NameVisibility)] -> m a -> m a -- | Temporarily bind a collection of names to local type variables bindLocalTypeVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(ProperName, Kind)] -> m a -> m a -- | Update the visibility of all names to Defined makeBindingGroupVisible :: (Functor m, MonadState CheckState m) => m a -> m a -- | Lookup the type of a value by name in the Environment lookupVariable :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m Type -- | Lookup the visibility of a value by name in the Environment getVisibility :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m NameVisibility -- | Assert that a name is visible checkVisibility :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m () -- | Lookup the kind of a type by name in the Environment lookupTypeVariable :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified ProperName -> m Kind -- | State required for type checking: data CheckState CheckState :: Environment -> Int -> Int -> Maybe ModuleName -> CheckState -- | The current Environment checkEnv :: CheckState -> Environment -- | The next fresh unification variable name checkNextVar :: CheckState -> Int -- | The next type class dictionary name checkNextDictName :: CheckState -> Int -- | The current module checkCurrentModule :: CheckState -> Maybe ModuleName -- | The type checking monad, which provides the state of the type checker, -- and error reporting capabilities newtype Check a Check :: StateT CheckState (Either MultipleErrors) a -> Check a unCheck :: Check a -> StateT CheckState (Either MultipleErrors) a -- | Get the current Environment getEnv :: (Functor m, MonadState CheckState m) => m Environment -- | Update the Environment putEnv :: MonadState CheckState m => Environment -> m () -- | Modify the Environment modifyEnv :: MonadState CheckState m => (Environment -> Environment) -> m () -- | Run a computation in the Check monad, starting with an empty -- Environment runCheck :: (MonadReader (Options mode) m, MonadError String m) => Check a -> m (a, Environment) -- | Run a computation in the Check monad, failing with an error, or -- succeeding with a return value and the final Environment. runCheck' :: (MonadReader (Options mode) m, MonadError String m) => Environment -> Check a -> m (a, Environment) -- | Make an assertion, failing with an error message guardWith :: MonadError e m => e -> Bool -> m () -- | Generate new type class dictionary name freshDictionaryName :: Check Int -- | Lift a computation in the Check monad into the substitution -- monad. liftCheck :: Check a -> UnifyT t Check a -- | Run a computation in the substitution monad, generating a return value -- and the final substitution. liftUnify :: Partial t => UnifyT t Check a -> Check (a, Substitution t) instance Functor Check instance Monad Check instance Applicative Check instance MonadState CheckState Check instance MonadError MultipleErrors Check -- | This module implements the kind checker module Language.PureScript.TypeChecker.Kinds -- | Infer the kind of a single type kindOf :: ModuleName -> Type -> Check Kind -- | Infer the kind of a single type, returning the kinds of any scoped -- type variables kindOfWithScopedVars :: Type -> Check (Kind, [(String, Kind)]) -- | Infer the kind of a type constructor with a collection of arguments -- and a collection of associated data constructors kindsOf :: Bool -> ModuleName -> ProperName -> [(String, Maybe Kind)] -> [Type] -> Check Kind -- | Simultaneously infer the kinds of several mutually recursive type -- constructors kindsOfAll :: ModuleName -> [(ProperName, [(String, Maybe Kind)], Type)] -> [(ProperName, [(String, Maybe Kind)], [Type])] -> Check ([Kind], [Kind]) instance Unifiable Check Kind instance Partial Kind -- | Functions for replacing fully applied type synonyms with the -- SaturatedTypeSynonym data constructor module Language.PureScript.TypeChecker.Synonyms -- | Replace all type synonyms with the SaturatedTypeSynonym data -- constructor saturateAllTypeSynonyms :: [(Qualified ProperName, Int)] -> Type -> Either ErrorMessage Type -- | "Desaturate" SaturatedTypeSynonyms desaturateAllTypeSynonyms :: Type -> Type replaceAllTypeSynonyms :: (e ~ MultipleErrors, Functor m, Monad m, MonadState CheckState m, MonadError e m) => Type -> m Type expandAllTypeSynonyms :: (e ~ MultipleErrors, Functor m, Applicative m, Monad m, MonadState CheckState m, MonadError e m) => Type -> m Type expandTypeSynonym :: (e ~ MultipleErrors, Functor m, Monad m, MonadState CheckState m, MonadError e m) => Qualified ProperName -> [Type] -> m Type -- | Replace a type synonym and its arguments with the aliased type expandTypeSynonym' :: Environment -> Qualified ProperName -> [Type] -> Either ErrorMessage Type -- | This module generates code for "externs" files, i.e. files containing -- only foreign import declarations. module Language.PureScript.CodeGen.Externs -- | Generate foreign imports for all declarations in a module moduleToPs :: Module -> Environment -> String -- | This module implements the desugaring pass which creates binding -- groups from sets of mutually-recursive value declarations and -- mutually-recursive type declarations. module Language.PureScript.Sugar.BindingGroups createBindingGroups :: (Functor m, Applicative m, MonadError MultipleErrors m) => ModuleName -> [Declaration] -> m [Declaration] -- | Replace all sets of mutually-recursive declarations in a module with -- binding groups createBindingGroupsModule :: (Functor m, Applicative m, MonadError MultipleErrors m) => [Module] -> m [Module] -- | Collapse all binding groups to individual declarations collapseBindingGroups :: [Declaration] -> [Declaration] -- | Collapse all binding groups in a module to individual declarations collapseBindingGroupsModule :: [Module] -> [Module] -- | This module implements the desugaring pass which replaces top-level -- binders with case expressions. module Language.PureScript.Sugar.CaseDeclarations -- | Replace all top-level binders with case expressions. desugarCases :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] -- | Replace all top-level binders in a module with case expressions. desugarCasesModule :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Module] -> m [Module] -- | This module implements the desugaring pass which creates type synonyms -- for type class dictionaries and dictionary expressions for type class -- instances. module Language.PureScript.Sugar.TypeClasses -- | Add type synonym declarations for type class dictionary types, and -- value declarations for type class instance dictionary expressions. desugarTypeClasses :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Module] -> m [Module] typeClassMemberName :: Declaration -> String superClassDictionaryNames :: [Constraint] -> [String] -- | The AST -> CoreFn desugaring step module Language.PureScript.CoreFn.Desugar -- | Desugars a module from AST to CoreFn representation. moduleToCoreFn :: Environment -> Module -> Module Ann -- | The core functional representation module Language.PureScript.CoreFn -- | Dead code elimination. module Language.PureScript.DeadCodeElimination -- | Eliminate all declarations which are not a transitive dependency of -- the entry point module eliminateDeadCode :: [ModuleName] -> [Module a] -> [Module a] -- | Renaming pass that prevents shadowing of local identifiers. module Language.PureScript.Renamer -- | Renames within each declaration in a module. renameInModules :: [Module Ann] -> [Module Ann] -- | This module generates code in the simplified Javascript intermediate -- representation from Purescript code module Language.PureScript.CodeGen.JS -- | Generate code in the simplified Javascript intermediate representation -- for all declarations in a module. moduleToJs :: (Applicative m, Monad m, MonadReader (Options mode) m, MonadSupply m) => Module Ann -> m [JS] -- | A collection of modules related to code generation: -- -- module Language.PureScript.CodeGen -- | This module implements the desugaring pass which replaces do-notation -- statements with appropriate calls to (>>=) from the -- Prelude.Monad type class. module Language.PureScript.Sugar.DoNotation -- | Replace all DoNotationBind and DoNotationValue -- constructors with applications of the Prelude.(>>=) function, -- and all DoNotationLet constructors with let expressions. desugarDoModule :: (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> m Module module Language.PureScript.Sugar.Names -- | Replaces all local names with qualified names within a set of modules. desugarImports :: (Applicative m, MonadError MultipleErrors m) => [Module] -> m [Module] instance Show Exports instance Show ImportEnvironment module Language.PureScript.Sugar.ObjectWildcards desugarObjectConstructors :: (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> m Module -- | This module implements the desugaring pass which reapplies binary -- operators based on their fixity data and removes explicit parentheses. -- -- The value parser ignores fixity data when parsing binary operator -- applications, so it is necessary to reorder them here. module Language.PureScript.Sugar.Operators -- | Remove explicit parentheses and reorder binary operator applications rebracket :: (Applicative m, MonadError MultipleErrors m) => [Module] -> m [Module] removeSignedLiterals :: Module -> Module desugarOperatorSections :: (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> m Module -- | This module implements the desugaring pass which replaces top-level -- type declarations with type annotations on the corresponding -- expression. module Language.PureScript.Sugar.TypeDeclarations -- | Replace all top level type declarations with type annotations desugarTypeDeclarations :: (Functor m, Applicative m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] -- | Replace all top level type declarations in a module with type -- annotations desugarTypeDeclarationsModule :: (Functor m, Applicative m, MonadError MultipleErrors m) => [Module] -> m [Module] -- | Desugaring passes module Language.PureScript.Sugar -- | The desugaring pipeline proceeds as follows: -- -- desugar :: (Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Module] -> m [Module] -- | Functions relating to type checking for rows module Language.PureScript.TypeChecker.Rows -- | Ensure rows do not contain duplicate labels checkDuplicateLabels :: Expr -> Check () -- | Functions relating to skolemization used during typechecking module Language.PureScript.TypeChecker.Skolems -- | Generate a new skolem constant newSkolemConstant :: UnifyT Type Check Int -- | Introduce skolem scope at every occurence of a ForAll introduceSkolemScope :: Type -> UnifyT Type Check Type -- | Generate a new skolem scope newSkolemScope :: UnifyT Type Check SkolemScope -- | Skolemize a type variable by replacing its instances with fresh skolem -- constants skolemize :: String -> Int -> SkolemScope -> Type -> Type -- | This function has one purpose - to skolemize type variables appearing -- in a SuperClassDictionary placeholder. These type variables are -- somewhat unique since they are the only example of scoped type -- variables. skolemizeTypesInValue :: String -> Int -> SkolemScope -> Expr -> Expr -- | Ensure skolem variables do not escape their scope skolemEscapeCheck :: Expr -> Check () -- | Functions and instances relating to unification module Language.PureScript.TypeChecker.Unify -- | Unify two types, updating the current substitution unifyTypes :: Type -> Type -> UnifyT Type Check () -- | Unify two rows, updating the current substitution -- -- Common labels are first identified, and unified. Remaining labels and -- types are unified with a trailing row unification variable, if -- appropriate, otherwise leftover labels result in a unification error. unifyRows :: Type -> Type -> UnifyT Type Check () -- | Check that two types unify unifiesWith :: Environment -> Type -> Type -> Bool -- | Replace a single type variable with a new unification variable replaceVarWithUnknown :: String -> Type -> UnifyT Type Check Type -- | Replace type wildcards with unknowns replaceTypeWildcards :: Type -> UnifyT t Check Type -- | Replace outermost unsolved unification variables with named type -- variables varIfUnknown :: Type -> Type instance Unifiable Check Type instance Partial Type -- | Type class entailment module Language.PureScript.TypeChecker.Entailment -- | Check that the current set of type class dictionaries entail the -- specified type class goal, and, if so, return a type class dictionary -- reference. entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> Constraint -> Bool -> Check Expr -- | Subsumption checking module Language.PureScript.TypeChecker.Subsumption -- | Check whether one type subsumes another, rethrowing errors to provide -- a better error message subsumes :: Maybe Expr -> Type -> Type -> UnifyT Type Check (Maybe Expr) -- | This module implements the type checker module Language.PureScript.TypeChecker.Types -- | Infer the types of multiple mutually-recursive values, and return -- elaborated values including type class dictionaries and type -- annotations. typesOf :: Maybe ModuleName -> ModuleName -> [(Ident, Expr)] -> Check [(Ident, (Expr, Type))] -- | The top-level type checker, which checks all declarations in a module. module Language.PureScript.TypeChecker -- | Type check an entire module and ensure all types and classes defined -- within the module that are required by exported members are also -- exported. typeCheckModule :: Maybe ModuleName -> Module -> Check Module -- | The main compiler module module Language.PureScript -- | Compile a collection of modules -- -- The compilation pipeline proceeds as follows: -- -- compile :: (Functor m, Applicative m, MonadError String m, MonadReader (Options Compile) m) => [Module] -> [String] -> m (String, String, Environment) compile' :: (Functor m, Applicative m, MonadError String m, MonadReader (Options Compile) m) => Environment -> [Module] -> [String] -> m (String, String, Environment) -- | Determines when to rebuild a module data RebuildPolicy -- | Never rebuild this module RebuildNever :: RebuildPolicy -- | Always rebuild this module RebuildAlways :: RebuildPolicy -- | A type class which collects the IO actions we need to be able to run -- in "make" mode class (MonadReader (Options Make) m, MonadError String m) => MonadMake m getTimestamp :: MonadMake m => FilePath -> m (Maybe UTCTime) readTextFile :: MonadMake m => FilePath -> m String writeTextFile :: MonadMake m => FilePath -> String -> m () progress :: MonadMake m => String -> m () -- | Compiles in "make" mode, compiling each module separately to a js -- files and an externs 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. make :: (Functor m, Applicative m, Monad m, MonadMake m) => FilePath -> [(Either RebuildPolicy FilePath, Module)] -> [String] -> m Environment prelude :: String version :: Version instance Show RebuildPolicy instance Eq RebuildPolicy instance Ord RebuildPolicy