-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | PureScript Programming Language Compiler -- -- A small strongly, statically typed programming language with -- expressive types, inspired by Haskell and compiling to Javascript. @package purescript @version 0.8.5.0 module Language.PureScript.Publish.BoxesHelpers -- | The basic data type. A box has a specified size and some sort of -- contents. data Box :: * -- | The null box, which has no content and no size. It is quite useless. nullBox :: Box width :: Int indentWidth :: Int para :: String -> Box indented :: Box -> Box successivelyIndented :: [String] -> Box vcat :: [Box] -> Box spacer :: Box bulletedList :: (a -> String) -> [a] -> [Box] printToStderr :: Box -> IO () printToStdout :: Box -> IO () module Language.PureScript.Publish.Utils -- | Glob relative to the current directory, and produce relative -- pathnames. globRelative :: Pattern -> IO [FilePath] -- | Glob pattern for PureScript source files. purescriptSourceFiles :: Pattern -- | Glob pattern for PureScript dependency files. purescriptDepsFiles :: Pattern module Language.PureScript.Docs.Utils.MonoidExtras mintersperse :: (Monoid m) => m -> [m] -> m -- | 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 GHC.Show.Show Language.PureScript.Parser.State.ParseState module System.IO.UTF8 readUTF8File :: FilePath -> IO String writeUTF8File :: FilePath -> String -> IO () -- | Various constants which refer to things in the Prelude module Language.PureScript.Constants ($) :: String apply :: String (#) :: String applyFlipped :: String (<>) :: String (++) :: String append :: String (>>=) :: String bind :: String (+) :: String add :: String (-) :: String sub :: String (*) :: String mul :: String (/) :: String div :: String (%) :: String mod :: String (<) :: String lessThan :: String (>) :: String greaterThan :: String (<=) :: String lessThanOrEq :: String (>=) :: String greaterThanOrEq :: String (==) :: String eq :: String (/=) :: String notEq :: String compare :: String (&&) :: String conj :: String (||) :: String disj :: String unsafeIndex :: String (.|.) :: String (.&.) :: String (.^.) :: String (<<<) :: String compose :: String (>>>) :: String composeFlipped :: String negate :: String not :: String shl :: String shr :: String zshr :: String complement :: String zero :: String one :: String bottom :: String top :: 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 semiringInt :: String ringNumber :: String ringInt :: String moduloSemiringNumber :: String moduloSemiringInt :: String ordBoolean :: String ordNumber :: String ordInt :: String ordString :: String ordChar :: String eqNumber :: String eqInt :: String eqString :: String eqChar :: String eqBoolean :: String boundedBoolean :: String booleanAlgebraBoolean :: String semigroupString :: String semigroupoidFn :: String generic :: String toSpine :: String fromSpine :: String toSignature :: String main :: String __superclass_ :: String __unused :: String prim :: String prelude :: String dataArrayUnsafe :: String eff :: String st :: String controlApplicative :: String controlSemigroupoid :: String controlBind :: String dataBounded :: String dataSemigroup :: String dataModuloSemiring :: String dataBooleanAlgebra :: String dataEq :: String dataOrd :: String dataSemiring :: String dataRing :: String dataFunction :: String dataIntBits :: String -- | 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 displaySourcePos :: SourcePos -> String data SourceSpan SourceSpan :: String -> SourcePos -> SourcePos -> SourceSpan -- | Source name [spanName] :: SourceSpan -> String -- | Start of the span [spanStart] :: SourceSpan -> SourcePos [spanEnd] :: SourceSpan -> SourcePos displayStartEndPos :: SourceSpan -> String displaySourceSpan :: SourceSpan -> String internalModuleSourceSpan :: String -> SourceSpan instance GHC.Classes.Ord Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Classes.Eq Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Read.Read Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Show.Show Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Classes.Ord Language.PureScript.AST.SourcePos.SourcePos instance GHC.Classes.Eq Language.PureScript.AST.SourcePos.SourcePos instance GHC.Read.Read Language.PureScript.AST.SourcePos.SourcePos instance GHC.Show.Show Language.PureScript.AST.SourcePos.SourcePos instance Data.Aeson.Types.Class.ToJSON Language.PureScript.AST.SourcePos.SourcePos instance Data.Aeson.Types.Class.FromJSON Language.PureScript.AST.SourcePos.SourcePos instance Data.Aeson.Types.Class.ToJSON Language.PureScript.AST.SourcePos.SourceSpan instance Data.Aeson.Types.Class.FromJSON Language.PureScript.AST.SourcePos.SourceSpan -- | The core functional representation for literal values. module Language.PureScript.AST.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 character literal CharLiteral :: Char -> 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 GHC.Base.Functor Language.PureScript.AST.Literals.Literal instance GHC.Read.Read a => GHC.Read.Read (Language.PureScript.AST.Literals.Literal a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.AST.Literals.Literal a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.AST.Literals.Literal a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.AST.Literals.Literal a) -- | Bundles compiled PureScript modules for the browser. -- -- This module takes as input the individual generated modules from -- Make and performs dead code elimination, filters empty modules, -- and generates the final Javascript bundle. module Language.PureScript.Bundle -- | The bundling function. This function performs dead code elimination, -- filters empty modules and generates and prints the final Javascript -- bundle. bundle :: (MonadError ErrorMessage m) => [(ModuleIdentifier, String)] -> [ModuleIdentifier] -> Maybe String -> String -> Maybe FilePath -> m String -- | A module is identified by its module name and its type. data ModuleIdentifier ModuleIdentifier :: String -> ModuleType -> ModuleIdentifier moduleName :: ModuleIdentifier -> String -- | Modules are either "regular modules" (i.e. those generated by psc) or -- foreign modules. data ModuleType Regular :: ModuleType Foreign :: ModuleType -- | The type of error messages. We separate generation and rendering of -- errors using a data type, in case we need to match on error types -- later. data ErrorMessage UnsupportedModulePath :: String -> ErrorMessage InvalidTopLevel :: ErrorMessage UnableToParseModule :: String -> ErrorMessage UnsupportedExport :: ErrorMessage ErrorInModule :: ModuleIdentifier -> ErrorMessage -> ErrorMessage -- | Prepare an error message for consumption by humans. printErrorMessage :: ErrorMessage -> [String] getExportedIdentifiers :: (MonadError ErrorMessage m) => String -> JSAST -> m [String] instance GHC.Show.Show Language.PureScript.Bundle.Module instance GHC.Show.Show Language.PureScript.Bundle.ModuleElement instance GHC.Classes.Ord Language.PureScript.Bundle.ExportType instance GHC.Classes.Eq Language.PureScript.Bundle.ExportType instance GHC.Show.Show Language.PureScript.Bundle.ExportType instance GHC.Read.Read Language.PureScript.Bundle.ErrorMessage instance GHC.Show.Show Language.PureScript.Bundle.ErrorMessage instance GHC.Classes.Ord Language.PureScript.Bundle.ModuleIdentifier instance GHC.Classes.Eq Language.PureScript.Bundle.ModuleIdentifier instance GHC.Read.Read Language.PureScript.Bundle.ModuleIdentifier instance GHC.Show.Show Language.PureScript.Bundle.ModuleIdentifier instance GHC.Classes.Ord Language.PureScript.Bundle.ModuleType instance GHC.Classes.Eq Language.PureScript.Bundle.ModuleType instance GHC.Read.Read Language.PureScript.Bundle.ModuleType instance GHC.Show.Show Language.PureScript.Bundle.ModuleType -- | 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 Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Supply.SupplyT m) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Supply.SupplyT m) instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Supply.SupplyT m) instance Control.Monad.Trans.Class.MonadTrans Control.Monad.Supply.SupplyT instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Supply.SupplyT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Supply.SupplyT m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Supply.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 GHC.Base.Monad m => Control.Monad.Supply.Class.MonadSupply (Control.Monad.Supply.SupplyT m) instance Control.Monad.Supply.Class.MonadSupply m => Control.Monad.Supply.Class.MonadSupply (Control.Monad.Trans.State.Lazy.StateT s m) -- | The data type of compiler options module Language.PureScript.Options -- | The data type of compiler options data Options Options :: Bool -> Bool -> Maybe String -> Bool -> Bool -> Bool -> Maybe FilePath -> Bool -> Options -- | Disable tail-call elimination [optionsNoTco] :: Options -> Bool -- | Disable inlining of calls to return and bind for the Eff monad [optionsNoMagicDo] :: Options -> Bool -- | When specified, checks the type of main in the module, and -- generate a call to run main after the module definitions. [optionsMain] :: Options -> Maybe String -- | Skip all optimizations [optionsNoOptimizations] :: Options -> Bool -- | Verbose error message [optionsVerboseErrors] :: Options -> Bool -- | Remove the comments from the generated js [optionsNoComments] :: Options -> Bool -- | The path to prepend to require statements [optionsRequirePath] :: Options -> Maybe FilePath -- | Generate soure maps [optionsSourceMaps] :: Options -> Bool -- | Default make options defaultOptions :: Options instance GHC.Show.Show Language.PureScript.Options.Options -- | 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 -- | A generated name for an identifier GenIdent :: (Maybe String) -> Integer -> Ident runIdent :: Ident -> String showIdent :: Ident -> String freshIdent :: (MonadSupply m) => String -> m Ident freshIdent' :: (MonadSupply m) => m Ident -- | Proper names, i.e. capitalized names for e.g. module names, type//data -- constructors. newtype ProperName (a :: ProperNameType) ProperName :: String -> ProperName [runProperName] :: ProperName -> String -- | The closed set of proper name types. data ProperNameType TypeName :: ProperNameType ConstructorName :: ProperNameType ClassName :: ProperNameType Namespace :: ProperNameType -- | 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. coerceProperName :: ProperName a -> ProperName b -- | Module names newtype ModuleName ModuleName :: [ProperName Namespace] -> 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 showQualified :: (a -> String) -> Qualified a -> String -- | Provide a default module name, if a name is unqualified qualify :: ModuleName -> Qualified a -> (ModuleName, a) -- | Makes a qualified value from a name and module name. mkQualified :: a -> ModuleName -> Qualified a -- | Remove the module name from a qualified name disqualify :: Qualified a -> a -- | Checks whether a qualified value is actually qualified with a module -- reference isQualified :: Qualified a -> Bool -- | Checks whether a qualified value is not actually qualified with a -- module reference isUnqualified :: Qualified a -> Bool -- | Checks whether a qualified value is qualified with a particular module isQualifiedWith :: ModuleName -> Qualified a -> Bool instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Names.ModuleName instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Names.ModuleName instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Names.Ident instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Names.Ident instance Data.Aeson.Types.Class.ToJSON a0 => Data.Aeson.Types.Class.ToJSON (Language.PureScript.Names.Qualified a0) instance Data.Aeson.Types.Class.FromJSON a0 => Data.Aeson.Types.Class.FromJSON (Language.PureScript.Names.Qualified a0) instance GHC.Base.Functor Language.PureScript.Names.Qualified instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.Names.Qualified a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Names.Qualified a) instance GHC.Read.Read a => GHC.Read.Read (Language.PureScript.Names.Qualified a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Names.Qualified a) instance GHC.Classes.Ord Language.PureScript.Names.ModuleName instance GHC.Classes.Eq Language.PureScript.Names.ModuleName instance GHC.Read.Read Language.PureScript.Names.ModuleName instance GHC.Show.Show Language.PureScript.Names.ModuleName instance GHC.Classes.Ord (Language.PureScript.Names.ProperName a) instance GHC.Classes.Eq (Language.PureScript.Names.ProperName a) instance GHC.Read.Read (Language.PureScript.Names.ProperName a) instance GHC.Show.Show (Language.PureScript.Names.ProperName a) instance GHC.Classes.Ord Language.PureScript.Names.Ident instance GHC.Classes.Eq Language.PureScript.Names.Ident instance GHC.Read.Read Language.PureScript.Names.Ident instance GHC.Show.Show Language.PureScript.Names.Ident instance Data.Aeson.Types.Class.ToJSON (Language.PureScript.Names.ProperName a) instance Data.Aeson.Types.Class.FromJSON (Language.PureScript.Names.ProperName a) -- | 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 ConstructorBinder :: a -> (Qualified (ProperName TypeName)) -> (Qualified (ProperName ConstructorName)) -> [Binder a] -> Binder a -- | A binder which binds its input to an identifier NamedBinder :: a -> Ident -> (Binder a) -> Binder a extractBinderAnn :: Binder a -> a instance GHC.Base.Functor Language.PureScript.CoreFn.Binders.Binder instance GHC.Read.Read a => GHC.Read.Read (Language.PureScript.CoreFn.Binders.Binder a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Binders.Binder a) -- | 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 TypeName) -> (ProperName ConstructorName) -> [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 :: a -> Ident -> (Expr a) -> Bind a -- | Mutually recursive binding group for several values Rec :: [((a, 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 GHC.Base.Functor Language.PureScript.CoreFn.Expr.Bind instance GHC.Read.Read a => GHC.Read.Read (Language.PureScript.CoreFn.Expr.Bind a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Expr.Bind a) instance GHC.Base.Functor Language.PureScript.CoreFn.Expr.Expr instance GHC.Read.Read a => GHC.Read.Read (Language.PureScript.CoreFn.Expr.Expr a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Expr.Expr a) instance GHC.Read.Read a => GHC.Read.Read (Language.PureScript.CoreFn.Expr.CaseAlternative a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Expr.CaseAlternative a) instance GHC.Base.Functor Language.PureScript.CoreFn.Expr.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 -- | The contained reference is for a foreign member IsForeign :: 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 GHC.Classes.Eq Language.PureScript.CoreFn.Meta.Meta instance GHC.Read.Read Language.PureScript.CoreFn.Meta.Meta instance GHC.Show.Show Language.PureScript.CoreFn.Meta.Meta instance GHC.Classes.Eq Language.PureScript.CoreFn.Meta.ConstructorType instance GHC.Read.Read Language.PureScript.CoreFn.Meta.ConstructorType instance GHC.Show.Show Language.PureScript.CoreFn.Meta.ConstructorType module Language.PureScript.Kinds -- | The data type of kinds data Kind -- | Unification variable of type Kind KUnknown :: Int -> 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 everywhereOnKindsM :: Monad m => (Kind -> m Kind) -> Kind -> m Kind everythingOnKinds :: (r -> r -> r) -> (Kind -> r) -> Kind -> r instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Kinds.Kind instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Kinds.Kind instance GHC.Classes.Ord Language.PureScript.Kinds.Kind instance GHC.Classes.Eq Language.PureScript.Kinds.Kind instance GHC.Read.Read Language.PureScript.Kinds.Kind instance GHC.Show.Show Language.PureScript.Kinds.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 :: Int -> 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 TypeName)) -> Type -- | A type operator. This will be desugared into a type constructor during -- the "operators" phase of desugaring. TypeOp :: (Qualified Ident) -> Type -- | A type application TypeApp :: Type -> 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 -> (Maybe SourceSpan) -> 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 PrettyPrintObject :: Type -> Type -- | A placeholder used in pretty printing PrettyPrintForAll :: [String] -> Type -> Type -- | Binary operator application. During the rebracketing phase of -- desugaring, this data constructor will be removed. BinaryNoParensType :: Type -> Type -> Type -> Type -- | Explicit parentheses. During the rebracketing phase of desugaring, -- this data constructor will be removed. -- -- Note: although it seems this constructor is not used, it _is_ useful, -- since it prevents certain traversals from matching. ParensInType :: Type -> Type -- | A typeclass constraint type Constraint = (Qualified (ProperName ClassName), [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 :: Monad m => (Type -> m Type) -> Type -> m Type everywhereOnTypesTopDownM :: Monad m => (Type -> m Type) -> Type -> m Type everythingOnTypes :: (r -> r -> r) -> (Type -> r) -> Type -> r everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type -> (s, r)) -> Type -> r instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Types.Type instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Types.Type instance GHC.Classes.Ord Language.PureScript.Types.Type instance GHC.Classes.Eq Language.PureScript.Types.Type instance GHC.Read.Read Language.PureScript.Types.Type instance GHC.Show.Show Language.PureScript.Types.Type instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Types.SkolemScope instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Types.SkolemScope instance GHC.Classes.Ord Language.PureScript.Types.SkolemScope instance GHC.Classes.Eq Language.PureScript.Types.SkolemScope instance GHC.Read.Read Language.PureScript.Types.SkolemScope instance GHC.Show.Show Language.PureScript.Types.SkolemScope module Language.PureScript.TypeClassDictionaries -- | Data representing a type class dictionary which is in scope data TypeClassDictionaryInScope TypeClassDictionaryInScope :: Qualified Ident -> [(Qualified (ProperName ClassName), Integer)] -> Qualified (ProperName ClassName) -> [Type] -> Maybe [Constraint] -> TypeClassDictionaryInScope -- | The identifier with which the dictionary can be accessed at runtime [tcdName] :: TypeClassDictionaryInScope -> Qualified Ident -- | How to obtain this instance via superclass relationships [tcdPath] :: TypeClassDictionaryInScope -> [(Qualified (ProperName ClassName), Integer)] -- | The name of the type class to which this type class instance applies [tcdClassName] :: TypeClassDictionaryInScope -> Qualified (ProperName ClassName) -- | 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] -- | 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 ClassName)) -> Integer -> DictionaryValue instance GHC.Classes.Eq Language.PureScript.TypeClassDictionaries.DictionaryValue instance GHC.Classes.Ord Language.PureScript.TypeClassDictionaries.DictionaryValue instance GHC.Read.Read Language.PureScript.TypeClassDictionaries.DictionaryValue instance GHC.Show.Show Language.PureScript.TypeClassDictionaries.DictionaryValue instance GHC.Read.Read Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope instance GHC.Show.Show Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope -- | Defines the types of source code comments module Language.PureScript.Comments data Comment LineComment :: String -> Comment BlockComment :: String -> Comment instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Comments.Comment instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Comments.Comment instance GHC.Classes.Ord Language.PureScript.Comments.Comment instance GHC.Classes.Eq Language.PureScript.Comments.Comment instance GHC.Read.Read Language.PureScript.Comments.Comment instance GHC.Show.Show Language.PureScript.Comments.Comment -- | Case binders module Language.PureScript.AST.Binders -- | Data type for binders data Binder -- | Wildcard binder NullBinder :: Binder -- | A binder which matches a literal LiteralBinder :: (Literal Binder) -> Binder -- | A binder which binds an identifier VarBinder :: Ident -> Binder -- | A binder which matches a data constructor ConstructorBinder :: (Qualified (ProperName ConstructorName)) -> [Binder] -> Binder -- | A operator alias binder. During the rebracketing phase of desugaring, -- this data constructor will be removed. OpBinder :: (Qualified Ident) -> Binder -- | Binary operator application. During the rebracketing phase of -- desugaring, this data constructor will be removed. BinaryNoParensBinder :: Binder -> Binder -> Binder -> 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. ParensInBinder :: 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 -- | A binder with a type annotation TypedBinder :: Type -> Binder -> Binder -- | Collect all names introduced in binders in an expression binderNames :: Binder -> [Ident] instance GHC.Classes.Eq Language.PureScript.AST.Binders.Binder instance GHC.Read.Read Language.PureScript.AST.Binders.Binder instance GHC.Show.Show Language.PureScript.AST.Binders.Binder -- | 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 -> [(a, ModuleName)] -> [Ident] -> [ForeignDecl] -> [Bind a] -> Module a [moduleComments] :: Module a -> [Comment] [moduleName] :: Module a -> ModuleName [moduleImports] :: Module a -> [(a, ModuleName)] [moduleExports] :: Module a -> [Ident] [moduleForeign] :: Module a -> [ForeignDecl] [moduleDecls] :: Module a -> [Bind a] type ForeignDecl = (Ident, Type) instance GHC.Read.Read a => GHC.Read.Read (Language.PureScript.CoreFn.Module.Module a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Module.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 () holeLit :: TokenParser String -- | 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 charLiteral :: TokenParser Char 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 isSymbolChar :: Char -> Bool -- | Strings allowed to be left unquoted in a record key isUnquotedKey :: String -> Bool instance GHC.Classes.Eq Language.PureScript.Parser.Lexer.PositionedToken instance GHC.Classes.Ord Language.PureScript.Parser.Lexer.Token instance GHC.Classes.Eq Language.PureScript.Parser.Lexer.Token instance GHC.Read.Read Language.PureScript.Parser.Lexer.Token instance GHC.Show.Show Language.PureScript.Parser.Lexer.Token instance GHC.Show.Show Language.PureScript.Parser.Lexer.PositionedToken -- | Constants, and utility functions to be used when parsing module Language.PureScript.Parser.Common properName :: TokenParser (ProperName a) -- | 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 module Language.PureScript.Crash -- | Exit with an error message and a crash report link. internalError :: String -> a 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 TypeName)) (Kind, TypeKind) -> Map (Qualified (ProperName ConstructorName)) (DataDeclType, ProperName TypeName, Type, [Ident]) -> Map (Qualified (ProperName TypeName)) ([(String, Maybe Kind)], Type) -> Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) TypeClassDictionaryInScope)) -> Map (Qualified (ProperName ClassName)) ([(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 TypeName)) (Kind, TypeKind) -- | Data constructors currently in scope, along with their associated type -- constructor name, argument types and return type. [dataConstructors] :: Environment -> Map (Qualified (ProperName ConstructorName)) (DataDeclType, ProperName TypeName, Type, [Ident]) -- | Type synonyms currently in scope [typeSynonyms] :: Environment -> Map (Qualified (ProperName TypeName)) ([(String, Maybe Kind)], Type) -- | Available type class dictionaries [typeClassDictionaries] :: Environment -> Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) TypeClassDictionaryInScope)) -- | Type classes [typeClasses] :: Environment -> Map (Qualified (ProperName ClassName)) ([(String, Maybe Kind)], [(Ident, Type)], [Constraint]) -- | The initial environment with no values and only the default javascript -- types defined initEnvironment :: Environment -- | 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 -- | A flag for whether a name is for an private or public value - only -- public values will be included in a generated externs file. data NameKind -- | A private value introduced as an artifact of code generation (class -- instances, class member accessors, etc.) Private :: NameKind -- | A public value for a module member or foreing import declaration Public :: NameKind -- | A name for member introduced by foreign import External :: NameKind -- | The kinds of a type data TypeKind -- | Data type DataType :: [(String, Maybe Kind)] -> [(ProperName ConstructorName, [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 showDataDeclType :: DataDeclType -> String -- | Construct a ProperName in the Prim module primName :: String -> Qualified (ProperName a) -- | 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 strings tyChar :: Type -- | Type constructor for numbers tyNumber :: Type -- | Type constructor for integers tyInt :: Type -- | Type constructor for booleans tyBoolean :: Type -- | Type constructor for arrays tyArray :: Type -- | Type constructor for objects tyObject :: Type -- | Check whether a type is an object isObject :: Type -> Bool -- | Check whether a type is a function isFunction :: Type -> Bool isTypeOrApplied :: Type -> Type -> Bool -- | Smart constructor for function types function :: Type -> Type -> Type -- | The primitive types in the external javascript environment with their -- associated kinds. There is also a pseudo Partial type that -- corresponds to the class with the same name. primTypes :: Map (Qualified (ProperName TypeName)) (Kind, TypeKind) -- | The primitive class map. This just contains to Partial class, -- used as a kind of magic constraint for partial functions. primClasses :: Map (Qualified (ProperName ClassName)) ([(String, Maybe Kind)], [(Ident, Type)], [Constraint]) -- | Finds information about data constructors from the current -- environment. lookupConstructor :: Environment -> Qualified (ProperName ConstructorName) -> (DataDeclType, ProperName TypeName, Type, [Ident]) -- | Checks whether a data constructor is for a newtype. isNewtypeConstructor :: Environment -> Qualified (ProperName ConstructorName) -> Bool -- | Finds information about values from the current environment. lookupValue :: Environment -> Qualified Ident -> Maybe (Type, NameKind, NameVisibility) instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Environment.TypeKind instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Environment.TypeKind instance GHC.Read.Read Language.PureScript.Environment.Environment instance GHC.Show.Show Language.PureScript.Environment.Environment instance GHC.Classes.Ord Language.PureScript.Environment.DataDeclType instance GHC.Classes.Eq Language.PureScript.Environment.DataDeclType instance GHC.Read.Read Language.PureScript.Environment.DataDeclType instance GHC.Show.Show Language.PureScript.Environment.DataDeclType instance GHC.Classes.Eq Language.PureScript.Environment.TypeKind instance GHC.Read.Read Language.PureScript.Environment.TypeKind instance GHC.Show.Show Language.PureScript.Environment.TypeKind instance GHC.Classes.Eq Language.PureScript.Environment.NameKind instance GHC.Read.Read Language.PureScript.Environment.NameKind instance GHC.Show.Show Language.PureScript.Environment.NameKind instance GHC.Classes.Eq Language.PureScript.Environment.NameVisibility instance GHC.Read.Read Language.PureScript.Environment.NameVisibility instance GHC.Show.Show Language.PureScript.Environment.NameVisibility instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Environment.DataDeclType instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Environment.DataDeclType 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 -- | 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 showAssoc :: Associativity -> String readAssoc :: String -> Associativity -- | Fixity data for infix operators data Fixity Fixity :: Associativity -> Precedence -> Fixity instance GHC.Classes.Ord Language.PureScript.AST.Operators.Fixity instance GHC.Classes.Eq Language.PureScript.AST.Operators.Fixity instance GHC.Read.Read Language.PureScript.AST.Operators.Fixity instance GHC.Show.Show Language.PureScript.AST.Operators.Fixity instance GHC.Classes.Ord Language.PureScript.AST.Operators.Associativity instance GHC.Classes.Eq Language.PureScript.AST.Operators.Associativity instance GHC.Read.Read Language.PureScript.AST.Operators.Associativity instance GHC.Show.Show Language.PureScript.AST.Operators.Associativity instance Data.Aeson.Types.Class.ToJSON Language.PureScript.AST.Operators.Associativity instance Data.Aeson.Types.Class.FromJSON Language.PureScript.AST.Operators.Associativity instance Data.Aeson.Types.Class.ToJSON Language.PureScript.AST.Operators.Fixity -- | 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 :: SourceSpan -> [Comment] -> ModuleName -> [Declaration] -> (Maybe [DeclarationRef]) -> Module -- | Return a module's name. getModuleName :: Module -> ModuleName -- | Add an import declaration for a module if it does not already -- explicitly import it. addDefaultImport :: ModuleName -> Module -> Module -- | An item in a list of explicit imports or exports data DeclarationRef -- | A type constructor with data constructors TypeRef :: (ProperName TypeName) -> (Maybe [ProperName ConstructorName]) -> DeclarationRef -- | A type operator TypeOpRef :: Ident -> DeclarationRef -- | A value ValueRef :: Ident -> DeclarationRef -- | A type class TypeClassRef :: (ProperName ClassName) -> DeclarationRef -- | A type class instance, created during typeclass desugaring (name, -- class name, instance types) TypeInstanceRef :: Ident -> DeclarationRef -- | A module, in its entirety ModuleRef :: ModuleName -> DeclarationRef -- | An unspecified ProperName ref. This will be replaced with a -- TypeClassRef or TypeRef during name desugaring. ProperRef :: String -> DeclarationRef -- | A declaration reference with source position information PositionedDeclarationRef :: SourceSpan -> [Comment] -> DeclarationRef -> DeclarationRef isModuleRef :: DeclarationRef -> Bool -- | Finds duplicate values in a list of declaration refs. The returned -- values are the duplicate refs with data constructors elided, and then -- a separate list of duplicate data constructors. findDuplicateRefs :: [DeclarationRef] -> ([DeclarationRef], [ProperName ConstructorName]) -- | 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 isImplicit :: ImportDeclarationType -> Bool isExplicit :: ImportDeclarationType -> Bool -- | The data type of declarations data Declaration -- | A data type declaration (data or newtype, name, arguments, data -- constructors) DataDeclaration :: DataDeclType -> (ProperName TypeName) -> [(String, Maybe Kind)] -> [(ProperName ConstructorName, [Type])] -> Declaration -- | A minimal mutually recursive set of data type declarations DataBindingGroupDeclaration :: [Declaration] -> Declaration -- | A type synonym declaration (name, arguments, type) TypeSynonymDeclaration :: (ProperName TypeName) -> [(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 (name, type) ExternDeclaration :: Ident -> Type -> Declaration -- | A data type foreign import (name, kind) ExternDataDeclaration :: (ProperName TypeName) -> Kind -> Declaration -- | A fixity declaration (fixity data, operator name, value the operator -- is an alias for) FixityDeclaration :: Fixity -> String -> (Maybe (Qualified FixityAlias)) -> Declaration -- | A module import (module name, qualifiedunqualifiedhiding, -- optional "qualified as" name) TODO: also a boolean specifying whether -- the old qualified syntax was used, so a warning can be raised -- in desugaring (remove for 0.9) ImportDeclaration :: ModuleName -> ImportDeclarationType -> (Maybe ModuleName) -> Bool -> Declaration -- | A type class declaration (name, argument, implies, member -- declarations) TypeClassDeclaration :: (ProperName ClassName) -> [(String, Maybe Kind)] -> [Constraint] -> [Declaration] -> Declaration -- | A type instance declaration (name, dependencies, class name, instance -- types, member declarations) TypeInstanceDeclaration :: Ident -> [Constraint] -> (Qualified (ProperName ClassName)) -> [Type] -> TypeInstanceBody -> Declaration -- | A declaration with source position information PositionedDeclaration :: SourceSpan -> [Comment] -> Declaration -> Declaration data FixityAlias AliasValue :: Ident -> FixityAlias AliasConstructor :: (ProperName ConstructorName) -> FixityAlias AliasType :: (ProperName TypeName) -> FixityAlias foldFixityAlias :: (Ident -> a) -> (ProperName ConstructorName -> a) -> (ProperName TypeName -> a) -> FixityAlias -> a getValueAlias :: FixityAlias -> Maybe (Either Ident (ProperName ConstructorName)) getTypeAlias :: FixityAlias -> Maybe (ProperName TypeName) -- | The members of a type class instance declaration data TypeInstanceBody -- | This is a derived instance DerivedInstance :: TypeInstanceBody -- | This is a regular (explicit) instance ExplicitInstance :: [Declaration] -> TypeInstanceBody mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody -- | A traversal for TypeInstanceBody traverseTypeInstanceBody :: (Applicative f) => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody -- | 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 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 literal value Literal :: (Literal Expr) -> 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. -- -- Note: although it seems this constructor is not used, it _is_ useful, -- since it prevents certain traversals from matching. Parens :: Expr -> Expr -- | Operator section. This will be removed during desugaring and replaced -- with lambda. OperatorSection :: Expr -> (Either Expr 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 -- | 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 ConstructorName)) -> 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 ClassName)) -> 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 :: Constraint -> (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) TypeClassDictionaryInScope))) -> Expr -- | A typeclass dictionary accessor, the implementation is left -- unspecified until CoreFn desugaring. TypeClassDictionaryAccessor :: (Qualified (ProperName ClassName)) -> Ident -> Expr -- | A placeholder for a superclass dictionary to be turned into a -- TypeClassDictionary during typechecking SuperClassDictionary :: (Qualified (ProperName ClassName)) -> [Type] -> Expr -- | A placeholder for an anonymous function argument AnonymousArgument :: Expr -- | A typed hole that will be turned into a hint/error duing typechecking Hole :: String -> 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 Data.Aeson.Types.Class.ToJSON Language.PureScript.AST.Declarations.FixityAlias instance Data.Aeson.Types.Class.FromJSON Language.PureScript.AST.Declarations.FixityAlias instance Data.Aeson.Types.Class.ToJSON Language.PureScript.AST.Declarations.ImportDeclarationType instance Data.Aeson.Types.Class.FromJSON Language.PureScript.AST.Declarations.ImportDeclarationType instance Data.Aeson.Types.Class.ToJSON Language.PureScript.AST.Declarations.DeclarationRef instance Data.Aeson.Types.Class.FromJSON Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Read.Read Language.PureScript.AST.Declarations.Module instance GHC.Show.Show Language.PureScript.AST.Declarations.Module instance GHC.Read.Read Language.PureScript.AST.Declarations.TypeInstanceBody instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeInstanceBody instance GHC.Read.Read Language.PureScript.AST.Declarations.Declaration instance GHC.Show.Show Language.PureScript.AST.Declarations.Declaration instance GHC.Read.Read Language.PureScript.AST.Declarations.CaseAlternative instance GHC.Show.Show Language.PureScript.AST.Declarations.CaseAlternative instance GHC.Read.Read Language.PureScript.AST.Declarations.Expr instance GHC.Show.Show Language.PureScript.AST.Declarations.Expr instance GHC.Read.Read Language.PureScript.AST.Declarations.DoNotationElement instance GHC.Show.Show Language.PureScript.AST.Declarations.DoNotationElement instance GHC.Read.Read Language.PureScript.AST.Declarations.FixityAlias instance GHC.Show.Show Language.PureScript.AST.Declarations.FixityAlias instance GHC.Classes.Ord Language.PureScript.AST.Declarations.FixityAlias instance GHC.Classes.Eq Language.PureScript.AST.Declarations.FixityAlias instance GHC.Read.Read Language.PureScript.AST.Declarations.ImportDeclarationType instance GHC.Show.Show Language.PureScript.AST.Declarations.ImportDeclarationType instance GHC.Classes.Eq Language.PureScript.AST.Declarations.ImportDeclarationType instance GHC.Read.Read Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Show.Show Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Classes.Eq Language.PureScript.AST.Declarations.DeclarationRef module Language.PureScript.AST.Exported -- | 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. exportedDeclarations :: Module -> [Declaration] -- | 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. isExported :: Maybe [DeclarationRef] -> Declaration -> Bool -- | AST traversal helpers module Language.PureScript.AST.Traversals everywhereOnValues :: (Declaration -> Declaration) -> (Expr -> Expr) -> (Binder -> Binder) -> (Declaration -> Declaration, Expr -> Expr, Binder -> Binder) everywhereOnValuesTopDownM :: (Monad m) => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everywhereOnValuesM :: (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 :: (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) everythingWithScope :: (Monoid r) => (Set Ident -> Declaration -> r) -> (Set Ident -> Expr -> r) -> (Set Ident -> Binder -> r) -> (Set Ident -> CaseAlternative -> r) -> (Set Ident -> DoNotationElement -> r) -> (Set Ident -> Declaration -> r, Set Ident -> Expr -> r, Set Ident -> Binder -> r, Set Ident -> CaseAlternative -> r, Set Ident -> DoNotationElement -> r) accumTypes :: (Monoid r) => (Type -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) -- | Common code generation utility functions module Language.PureScript.CodeGen.JS.Common moduleNameToJs :: ModuleName -> String -- | 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 -- | Checks whether a name matches a built-in value in Javascript. nameIsJsBuiltIn :: String -> Bool jsAnyReserved :: [String] jsKeywords :: [String] jsSometimesReserved :: [String] jsFutureReserved :: [String] jsFutureReservedStrict :: [String] jsOldReserved :: [String] jsLiterals :: [String] -- | The initial PureScript AST module Language.PureScript.AST -- | This module generates code for "externs" files, i.e. files containing -- only foreign import declarations. module Language.PureScript.Externs -- | The data which will be serialized to an externs file data ExternsFile ExternsFile :: String -> ModuleName -> [DeclarationRef] -> [ExternsImport] -> [ExternsFixity] -> [ExternsDeclaration] -> ExternsFile -- | The externs version [efVersion] :: ExternsFile -> String -- | Module name [efModuleName] :: ExternsFile -> ModuleName -- | List of module exports [efExports] :: ExternsFile -> [DeclarationRef] -- | List of module imports [efImports] :: ExternsFile -> [ExternsImport] -- | List of operators and their fixities [efFixities] :: ExternsFile -> [ExternsFixity] -- | List of type and value declaration [efDeclarations] :: ExternsFile -> [ExternsDeclaration] -- | A module import in an externs file data ExternsImport ExternsImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> ExternsImport -- | The imported module [eiModule] :: ExternsImport -> ModuleName -- | The import type: regular, qualified or hiding [eiImportType] :: ExternsImport -> ImportDeclarationType -- | The imported-as name, for qualified imports [eiImportedAs] :: ExternsImport -> Maybe ModuleName -- | A fixity declaration in an externs file data ExternsFixity ExternsFixity :: Associativity -> Precedence -> String -> Maybe (Qualified FixityAlias) -> ExternsFixity -- | The associativity of the operator [efAssociativity] :: ExternsFixity -> Associativity -- | The precedence level of the operator [efPrecedence] :: ExternsFixity -> Precedence -- | The operator symbol [efOperator] :: ExternsFixity -> String -- | The value the operator is an alias for [efAlias] :: ExternsFixity -> Maybe (Qualified FixityAlias) -- | A type or value declaration appearing in an externs file data ExternsDeclaration -- | A type declaration EDType :: ProperName TypeName -> Kind -> TypeKind -> ExternsDeclaration [edTypeName] :: ExternsDeclaration -> ProperName TypeName [edTypeKind] :: ExternsDeclaration -> Kind [edTypeDeclarationKind] :: ExternsDeclaration -> TypeKind -- | A type synonym EDTypeSynonym :: ProperName TypeName -> [(String, Maybe Kind)] -> Type -> ExternsDeclaration [edTypeSynonymName] :: ExternsDeclaration -> ProperName TypeName [edTypeSynonymArguments] :: ExternsDeclaration -> [(String, Maybe Kind)] [edTypeSynonymType] :: ExternsDeclaration -> Type -- | A data construtor EDDataConstructor :: ProperName ConstructorName -> DataDeclType -> ProperName TypeName -> Type -> [Ident] -> ExternsDeclaration [edDataCtorName] :: ExternsDeclaration -> ProperName ConstructorName [edDataCtorOrigin] :: ExternsDeclaration -> DataDeclType [edDataCtorTypeCtor] :: ExternsDeclaration -> ProperName TypeName [edDataCtorType] :: ExternsDeclaration -> Type [edDataCtorFields] :: ExternsDeclaration -> [Ident] -- | A value declaration EDValue :: Ident -> Type -> ExternsDeclaration [edValueName] :: ExternsDeclaration -> Ident [edValueType] :: ExternsDeclaration -> Type -- | A type class declaration EDClass :: ProperName ClassName -> [(String, Maybe Kind)] -> [(Ident, Type)] -> [Constraint] -> ExternsDeclaration [edClassName] :: ExternsDeclaration -> ProperName ClassName [edClassTypeArguments] :: ExternsDeclaration -> [(String, Maybe Kind)] [edClassMembers] :: ExternsDeclaration -> [(Ident, Type)] [edClassConstraints] :: ExternsDeclaration -> [Constraint] -- | An instance declaration EDInstance :: Qualified (ProperName ClassName) -> Ident -> [Type] -> Maybe [Constraint] -> ExternsDeclaration [edInstanceClassName] :: ExternsDeclaration -> Qualified (ProperName ClassName) [edInstanceName] :: ExternsDeclaration -> Ident [edInstanceTypes] :: ExternsDeclaration -> [Type] [edInstanceConstraints] :: ExternsDeclaration -> Maybe [Constraint] -- | Generate an externs file for all declarations in a module moduleToExternsFile :: Module -> Environment -> ExternsFile -- | Convert an externs file back into a module applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Externs.ExternsFile instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Externs.ExternsFile instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Externs.ExternsDeclaration instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Externs.ExternsDeclaration instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Externs.ExternsFixity instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Externs.ExternsFixity instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Externs.ExternsImport instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Externs.ExternsImport instance GHC.Read.Read Language.PureScript.Externs.ExternsFile instance GHC.Show.Show Language.PureScript.Externs.ExternsFile instance GHC.Read.Read Language.PureScript.Externs.ExternsDeclaration instance GHC.Show.Show Language.PureScript.Externs.ExternsDeclaration instance GHC.Read.Read Language.PureScript.Externs.ExternsFixity instance GHC.Show.Show Language.PureScript.Externs.ExternsFixity instance GHC.Read.Read Language.PureScript.Externs.ExternsImport instance GHC.Show.Show Language.PureScript.Externs.ExternsImport -- | 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 :: (Maybe SourceSpan) -> (Either Integer Double) -> JS -- | A string literal JSStringLiteral :: (Maybe SourceSpan) -> String -> JS -- | A boolean literal JSBooleanLiteral :: (Maybe SourceSpan) -> Bool -> JS -- | A unary operator application JSUnary :: (Maybe SourceSpan) -> UnaryOperator -> JS -> JS -- | A binary operator application JSBinary :: (Maybe SourceSpan) -> BinaryOperator -> JS -> JS -> JS -- | An array literal JSArrayLiteral :: (Maybe SourceSpan) -> [JS] -> JS -- | An array indexer expression JSIndexer :: (Maybe SourceSpan) -> JS -> JS -> JS -- | An object literal JSObjectLiteral :: (Maybe SourceSpan) -> [(String, JS)] -> JS -- | An object property accessor expression JSAccessor :: (Maybe SourceSpan) -> String -> JS -> JS -- | A function introduction (optional name, arguments, body) JSFunction :: (Maybe SourceSpan) -> (Maybe String) -> [String] -> JS -> JS -- | Function application JSApp :: (Maybe SourceSpan) -> JS -> [JS] -> JS -- | Variable JSVar :: (Maybe SourceSpan) -> String -> JS -- | Conditional expression JSConditional :: (Maybe SourceSpan) -> JS -> JS -> JS -> JS -- | A block of expressions in braces JSBlock :: (Maybe SourceSpan) -> [JS] -> JS -- | A variable introduction and optional initialization JSVariableIntroduction :: (Maybe SourceSpan) -> String -> (Maybe JS) -> JS -- | A variable assignment JSAssignment :: (Maybe SourceSpan) -> JS -> JS -> JS -- | While loop JSWhile :: (Maybe SourceSpan) -> JS -> JS -> JS -- | For loop JSFor :: (Maybe SourceSpan) -> String -> JS -> JS -> JS -> JS -- | ForIn loop JSForIn :: (Maybe SourceSpan) -> String -> JS -> JS -> JS -- | If-then-else statement JSIfElse :: (Maybe SourceSpan) -> JS -> JS -> (Maybe JS) -> JS -- | Return statement JSReturn :: (Maybe SourceSpan) -> JS -> JS -- | Throw statement JSThrow :: (Maybe SourceSpan) -> JS -> JS -- | Type-Of operator JSTypeOf :: (Maybe SourceSpan) -> JS -> JS -- | InstanceOf test JSInstanceOf :: (Maybe SourceSpan) -> JS -> JS -> JS -- | Labelled statement JSLabel :: (Maybe SourceSpan) -> String -> JS -> JS -- | Break statement JSBreak :: (Maybe SourceSpan) -> String -> JS -- | Continue statement JSContinue :: (Maybe SourceSpan) -> String -> JS -- | Raw Javascript (generated when parsing fails for an inline foreign -- import declaration) JSRaw :: (Maybe SourceSpan) -> String -> JS -- | Commented Javascript JSComment :: (Maybe SourceSpan) -> [Comment] -> JS -> JS withSourceSpan :: SourceSpan -> JS -> JS getSourceSpan :: JS -> Maybe SourceSpan everywhereOnJS :: (JS -> JS) -> JS -> JS everywhereOnJSTopDown :: (JS -> JS) -> JS -> JS everywhereOnJSTopDownM :: (Monad m) => (JS -> m JS) -> JS -> m JS everythingOnJS :: (r -> r -> r) -> (JS -> r) -> JS -> r instance GHC.Classes.Eq Language.PureScript.CodeGen.JS.AST.JS instance GHC.Read.Read Language.PureScript.CodeGen.JS.AST.JS instance GHC.Show.Show Language.PureScript.CodeGen.JS.AST.JS instance GHC.Classes.Eq Language.PureScript.CodeGen.JS.AST.BinaryOperator instance GHC.Read.Read Language.PureScript.CodeGen.JS.AST.BinaryOperator instance GHC.Show.Show Language.PureScript.CodeGen.JS.AST.BinaryOperator instance GHC.Classes.Eq Language.PureScript.CodeGen.JS.AST.UnaryOperator instance GHC.Read.Read Language.PureScript.CodeGen.JS.AST.UnaryOperator instance GHC.Show.Show Language.PureScript.CodeGen.JS.AST.UnaryOperator -- | 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 isFn :: (String, String) -> JS -> Bool isFn' :: [(String, String)] -> JS -> Bool isDict :: (String, String) -> JS -> Bool isDict' :: [(String, String)] -> JS -> Bool -- | This module implements tail call elimination. module Language.PureScript.CodeGen.JS.Optimizer.TCO -- | Eliminate tail calls tco :: Options -> 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 -> JS -> JS -- | This module provides basic inlining capabilities module Language.PureScript.CodeGen.JS.Optimizer.Inliner inlineVariables :: JS -> JS inlineCommonValues :: JS -> JS inlineOperator :: (String, String) -> (JS -> JS -> JS) -> JS -> JS inlineCommonOperators :: JS -> JS inlineFnComposition :: (MonadSupply m) => JS -> m 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 m, MonadSupply m) => JS -> m JS -- | Common pretty-printing utility functions module Language.PureScript.Pretty.Common -- | Wrap a string in parentheses parens :: String -> String parensPos :: (Emit gen) => gen -> gen -- | Generalize intercalate slightly for monoids intercalate :: Monoid m => m -> [m] -> m class (Monoid gen) => Emit gen emit :: Emit gen => String -> gen addMapping :: Emit gen => SourceSpan -> gen data SMap SMap :: String -> SourcePos -> SourcePos -> SMap -- | String with length and source-map entries newtype StrPos StrPos :: (SourcePos, String, [SMap]) -> StrPos -- | Make a monoid where append consists of concatenating the string part, -- adding the lengths appropriately and advancing source mappings on the -- right hand side to account for the length of the left. newtype PlainString PlainString :: String -> PlainString runPlainString :: PlainString -> String addMapping' :: (Emit gen) => Maybe SourceSpan -> gen bumpPos :: SourcePos -> SMap -> SMap addPos :: SourcePos -> SourcePos -> SourcePos data PrinterState PrinterState :: Int -> PrinterState [indent] :: PrinterState -> Int emptyPrinterState :: PrinterState -- | Number of characters per identation level blockIndent :: Int -- | Pretty print with a new indentation level withIndent :: (Emit gen) => StateT PrinterState Maybe gen -> StateT PrinterState Maybe gen -- | Get the current indentation level currentIndent :: (Emit gen) => StateT PrinterState Maybe gen -- | Print many lines prettyPrintMany :: (Emit gen) => (a -> StateT PrinterState Maybe gen) -> [a] -> StateT PrinterState Maybe gen -- | Prints an object key, escaping reserved names. prettyPrintObjectKey :: String -> String -- | Place a box before another, vertically when the first box takes up -- multiple lines. before :: Box -> Box -> Box beforeWithSpace :: Box -> Box -> Box instance GHC.Base.Monoid Language.PureScript.Pretty.Common.PlainString instance GHC.Base.Monoid Language.PureScript.Pretty.Common.StrPos instance Language.PureScript.Pretty.Common.Emit Language.PureScript.Pretty.Common.StrPos instance Language.PureScript.Pretty.Common.Emit Language.PureScript.Pretty.Common.PlainString -- | 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 typeAsBox :: Type -> Box -- | Generate a pretty-printed string representing a Type prettyPrintType :: Type -> String typeAtomAsBox :: Type -> Box -- | 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 prettyPrintRowWith :: Char -> Char -> Type -> Box prettyPrintRow :: Type -> String -- | Pretty printer for values module Language.PureScript.Pretty.Values -- | Pretty-print an expression prettyPrintValue :: Int -> Expr -> Box -- | Generate a pretty-printed string representing a Binder prettyPrintBinder :: Binder -> String prettyPrintBinderAtom :: Binder -> String -- | Pretty printer for the Javascript AST module Language.PureScript.Pretty.JS prettyPrintJS :: [JS] -> String -- | Generate a pretty-printed string representing a collection of -- Javascript expressions at the same indentation level prettyPrintJSWithSourceMaps :: [JS] -> (String, [SMap]) -- | A collection of pretty printers for core data types: -- -- module Language.PureScript.Pretty module Language.PureScript.Errors -- | A type of error messages data SimpleErrorMessage ErrorParsingFFIModule :: FilePath -> (Maybe ErrorMessage) -> SimpleErrorMessage ErrorParsingModule :: ParseError -> SimpleErrorMessage MissingFFIModule :: ModuleName -> SimpleErrorMessage MultipleFFIModules :: ModuleName -> [FilePath] -> SimpleErrorMessage UnnecessaryFFIModule :: ModuleName -> FilePath -> SimpleErrorMessage MissingFFIImplementations :: ModuleName -> [Ident] -> SimpleErrorMessage UnusedFFIImplementations :: ModuleName -> [Ident] -> SimpleErrorMessage InvalidFFIIdentifier :: ModuleName -> String -> SimpleErrorMessage CannotGetFileInfo :: FilePath -> SimpleErrorMessage CannotReadFile :: FilePath -> SimpleErrorMessage CannotWriteFile :: FilePath -> SimpleErrorMessage InfiniteType :: Type -> SimpleErrorMessage InfiniteKind :: Kind -> SimpleErrorMessage MultipleFixities :: Ident -> SimpleErrorMessage OrphanTypeDeclaration :: Ident -> SimpleErrorMessage OrphanFixityDeclaration :: String -> SimpleErrorMessage RedefinedModule :: ModuleName -> [SourceSpan] -> SimpleErrorMessage RedefinedIdent :: Ident -> SimpleErrorMessage OverlappingNamesInLet :: SimpleErrorMessage UnknownModule :: ModuleName -> SimpleErrorMessage UnknownType :: (Qualified (ProperName TypeName)) -> SimpleErrorMessage UnknownTypeOp :: (Qualified Ident) -> SimpleErrorMessage UnknownTypeClass :: (Qualified (ProperName ClassName)) -> SimpleErrorMessage UnknownValue :: (Qualified Ident) -> SimpleErrorMessage UnknownDataConstructor :: (Qualified (ProperName ConstructorName)) -> (Maybe (Qualified (ProperName ConstructorName))) -> SimpleErrorMessage UnknownTypeConstructor :: (Qualified (ProperName TypeName)) -> SimpleErrorMessage UnknownImportType :: ModuleName -> (ProperName TypeName) -> SimpleErrorMessage UnknownExportType :: (ProperName TypeName) -> SimpleErrorMessage UnknownImportTypeOp :: ModuleName -> Ident -> SimpleErrorMessage UnknownExportTypeOp :: Ident -> SimpleErrorMessage UnknownImportTypeClass :: ModuleName -> (ProperName ClassName) -> SimpleErrorMessage UnknownExportTypeClass :: (ProperName ClassName) -> SimpleErrorMessage UnknownImportValue :: ModuleName -> Ident -> SimpleErrorMessage UnknownExportValue :: Ident -> SimpleErrorMessage UnknownExportModule :: ModuleName -> SimpleErrorMessage UnknownImportDataConstructor :: ModuleName -> (ProperName TypeName) -> (ProperName ConstructorName) -> SimpleErrorMessage UnknownExportDataConstructor :: (ProperName TypeName) -> (ProperName ConstructorName) -> SimpleErrorMessage ScopeConflict :: String -> [ModuleName] -> SimpleErrorMessage ScopeShadowing :: String -> (Maybe ModuleName) -> [ModuleName] -> SimpleErrorMessage ConflictingTypeDecls :: (ProperName TypeName) -> SimpleErrorMessage ConflictingCtorDecls :: (ProperName ConstructorName) -> SimpleErrorMessage TypeConflictsWithClass :: (ProperName TypeName) -> SimpleErrorMessage CtorConflictsWithClass :: (ProperName ConstructorName) -> SimpleErrorMessage ClassConflictsWithType :: (ProperName ClassName) -> SimpleErrorMessage ClassConflictsWithCtor :: (ProperName ClassName) -> SimpleErrorMessage DuplicateModuleName :: ModuleName -> SimpleErrorMessage DuplicateClassExport :: (ProperName ClassName) -> SimpleErrorMessage DuplicateValueExport :: Ident -> SimpleErrorMessage DuplicateTypeOpExport :: Ident -> SimpleErrorMessage DuplicateTypeArgument :: String -> SimpleErrorMessage InvalidDoBind :: SimpleErrorMessage InvalidDoLet :: SimpleErrorMessage CycleInDeclaration :: Ident -> SimpleErrorMessage CycleInTypeSynonym :: (Maybe (ProperName TypeName)) -> SimpleErrorMessage CycleInModules :: [ModuleName] -> SimpleErrorMessage NameIsUndefined :: Ident -> SimpleErrorMessage UndefinedTypeVariable :: (ProperName TypeName) -> SimpleErrorMessage PartiallyAppliedSynonym :: (Qualified (ProperName TypeName)) -> SimpleErrorMessage EscapedSkolem :: (Maybe Expr) -> SimpleErrorMessage TypesDoNotUnify :: Type -> Type -> SimpleErrorMessage KindsDoNotUnify :: Kind -> Kind -> SimpleErrorMessage ConstrainedTypeUnified :: Type -> Type -> SimpleErrorMessage OverlappingInstances :: (Qualified (ProperName ClassName)) -> [Type] -> [Qualified Ident] -> SimpleErrorMessage NoInstanceFound :: (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage PossiblyInfiniteInstance :: (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage CannotDerive :: (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage CannotFindDerivingType :: (ProperName TypeName) -> SimpleErrorMessage DuplicateLabel :: String -> (Maybe Expr) -> SimpleErrorMessage DuplicateValueDeclaration :: Ident -> SimpleErrorMessage ArgListLengthsDiffer :: Ident -> SimpleErrorMessage OverlappingArgNames :: (Maybe Ident) -> SimpleErrorMessage MissingClassMember :: Ident -> SimpleErrorMessage ExtraneousClassMember :: Ident -> (Qualified (ProperName ClassName)) -> SimpleErrorMessage ExpectedType :: Type -> Kind -> SimpleErrorMessage IncorrectConstructorArity :: (Qualified (ProperName ConstructorName)) -> SimpleErrorMessage ExprDoesNotHaveType :: Expr -> Type -> SimpleErrorMessage PropertyIsMissing :: String -> SimpleErrorMessage AdditionalProperty :: String -> SimpleErrorMessage CannotApplyFunction :: Type -> Expr -> SimpleErrorMessage TypeSynonymInstance :: SimpleErrorMessage OrphanInstance :: Ident -> (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage InvalidNewtype :: (ProperName TypeName) -> SimpleErrorMessage InvalidInstanceHead :: Type -> SimpleErrorMessage TransitiveExportError :: DeclarationRef -> [DeclarationRef] -> SimpleErrorMessage TransitiveDctorExportError :: DeclarationRef -> (ProperName ConstructorName) -> SimpleErrorMessage ShadowedName :: Ident -> SimpleErrorMessage ShadowedTypeVar :: String -> SimpleErrorMessage UnusedTypeVar :: String -> SimpleErrorMessage WildcardInferredType :: Type -> SimpleErrorMessage HoleInferredType :: String -> Type -> SimpleErrorMessage MissingTypeDeclaration :: Ident -> Type -> SimpleErrorMessage NotExhaustivePattern :: [[Binder]] -> Bool -> SimpleErrorMessage OverlappingPattern :: [[Binder]] -> Bool -> SimpleErrorMessage IncompleteExhaustivityCheck :: SimpleErrorMessage ClassOperator :: (ProperName ClassName) -> Ident -> SimpleErrorMessage MisleadingEmptyTypeImport :: ModuleName -> (ProperName TypeName) -> SimpleErrorMessage ImportHidingModule :: ModuleName -> SimpleErrorMessage UnusedImport :: ModuleName -> SimpleErrorMessage UnusedExplicitImport :: ModuleName -> [String] -> (Maybe ModuleName) -> [DeclarationRef] -> SimpleErrorMessage UnusedDctorImport :: (ProperName TypeName) -> SimpleErrorMessage UnusedDctorExplicitImport :: (ProperName TypeName) -> [ProperName ConstructorName] -> SimpleErrorMessage DeprecatedOperatorDecl :: String -> SimpleErrorMessage DeprecatedOperatorSection :: Expr -> (Either Expr Expr) -> SimpleErrorMessage DeprecatedQualifiedSyntax :: ModuleName -> ModuleName -> SimpleErrorMessage DeprecatedClassImport :: ModuleName -> (ProperName ClassName) -> SimpleErrorMessage DeprecatedClassExport :: (ProperName ClassName) -> SimpleErrorMessage DuplicateSelectiveImport :: ModuleName -> SimpleErrorMessage DuplicateImport :: ModuleName -> ImportDeclarationType -> (Maybe ModuleName) -> SimpleErrorMessage DuplicateImportRef :: String -> SimpleErrorMessage DuplicateExportRef :: String -> SimpleErrorMessage IntOutOfRange :: Integer -> String -> Integer -> Integer -> SimpleErrorMessage RedundantEmptyHidingImport :: ModuleName -> SimpleErrorMessage ImplicitQualifiedImport :: ModuleName -> ModuleName -> [DeclarationRef] -> SimpleErrorMessage ImplicitImport :: ModuleName -> [DeclarationRef] -> SimpleErrorMessage HidingImport :: ModuleName -> [DeclarationRef] -> SimpleErrorMessage CaseBinderLengthDiffers :: Int -> [Binder] -> SimpleErrorMessage IncorrectAnonymousArgument :: SimpleErrorMessage InvalidOperatorInBinder :: Ident -> Ident -> SimpleErrorMessage DeprecatedRequirePath :: SimpleErrorMessage CannotGeneralizeRecursiveFunction :: Ident -> Type -> SimpleErrorMessage -- | Error message hints, providing more detailed information about -- failure. data ErrorMessageHint ErrorUnifyingTypes :: Type -> Type -> ErrorMessageHint ErrorInExpression :: Expr -> ErrorMessageHint ErrorInModule :: ModuleName -> ErrorMessageHint ErrorInInstance :: (Qualified (ProperName ClassName)) -> [Type] -> ErrorMessageHint ErrorInSubsumption :: Type -> Type -> ErrorMessageHint ErrorCheckingAccessor :: Expr -> String -> ErrorMessageHint ErrorCheckingType :: Expr -> Type -> ErrorMessageHint ErrorCheckingKind :: Type -> ErrorMessageHint ErrorCheckingGuard :: ErrorMessageHint ErrorInferringType :: Expr -> ErrorMessageHint ErrorInApplication :: Expr -> Type -> Expr -> ErrorMessageHint ErrorInDataConstructor :: (ProperName ConstructorName) -> ErrorMessageHint ErrorInTypeConstructor :: (ProperName TypeName) -> ErrorMessageHint ErrorInBindingGroup :: [Ident] -> ErrorMessageHint ErrorInDataBindingGroup :: ErrorMessageHint ErrorInTypeSynonym :: (ProperName TypeName) -> ErrorMessageHint ErrorInValueDeclaration :: Ident -> ErrorMessageHint ErrorInTypeDeclaration :: Ident -> ErrorMessageHint ErrorInForeignImport :: Ident -> ErrorMessageHint PositionedError :: SourceSpan -> ErrorMessageHint -- | Categories of hints data HintCategory ExprHint :: HintCategory KindHint :: HintCategory CheckHint :: HintCategory PositionHint :: HintCategory OtherHint :: HintCategory data ErrorMessage ErrorMessage :: [ErrorMessageHint] -> SimpleErrorMessage -> ErrorMessage newtype ErrorSuggestion ErrorSuggestion :: String -> ErrorSuggestion -- | Get the source span for an error errorSpan :: ErrorMessage -> Maybe SourceSpan -- | Get the module name for an error errorModule :: ErrorMessage -> Maybe ModuleName findHint :: (ErrorMessageHint -> Maybe a) -> ErrorMessage -> Maybe a -- | Remove the module name and span hints from an error stripModuleAndSpan :: 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] -- | Check whether a collection of errors is empty or not. nonEmpty :: MultipleErrors -> Bool -- | Create an error set from a single simple error message errorMessage :: SimpleErrorMessage -> MultipleErrors -- | Create an error set from a single error message singleError :: ErrorMessage -> MultipleErrors -- | Lift a function on ErrorMessage to a function on MultipleErrors onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors -- | Add a hint to an error message addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors -- | A map from rigid type variable name/unknown variable pairs to new -- variables. data TypeMap TypeMap :: Map Int (String, Int, Maybe SourceSpan) -> Int -> Map Int Int -> Int -> TypeMap [umSkolemMap] :: TypeMap -> Map Int (String, Int, Maybe SourceSpan) [umNextSkolem] :: TypeMap -> Int [umUnknownMap] :: TypeMap -> Map Int Int [umNextUnknown] :: TypeMap -> Int defaultUnknownMap :: TypeMap -- | How critical the issue is data Level Error :: Level Warning :: Level -- | Extract nested error messages from wrapper errors unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage replaceUnknowns :: Type -> State TypeMap Type onTypesInErrorMessageM :: (Applicative m) => (Type -> m Type) -> ErrorMessage -> m ErrorMessage wikiUri :: ErrorMessage -> String errorSuggestion :: SimpleErrorMessage -> Maybe ErrorSuggestion showSuggestion :: SimpleErrorMessage -> String -- | Pretty print a single error, simplifying if necessary prettyPrintSingleError :: Bool -> Level -> Bool -> ErrorMessage -> Box prettyPrintExport :: DeclarationRef -> String prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> String prettyPrintRef :: DeclarationRef -> String -- | Pretty print multiple errors prettyPrintMultipleErrors :: Bool -> MultipleErrors -> String -- | Pretty print multiple warnings prettyPrintMultipleWarnings :: Bool -> MultipleErrors -> String -- | Pretty print warnings as a Box prettyPrintMultipleWarningsBox :: Bool -> MultipleErrors -> [Box] -- | Pretty print errors as a Box prettyPrintMultipleErrorsBox :: Bool -> MultipleErrors -> [Box] prettyPrintMultipleErrorsWith :: Level -> String -> String -> Bool -> MultipleErrors -> [Box] -- | Pretty print a Parsec ParseError as a Box prettyPrintParseError :: ParseError -> Box -- | Pretty print ParseError detail messages. -- -- Adapted from showErrorMessages, see -- https://github.com/aslatter/parsec/blob/v3.1.9/Text/Parsec/Error.hs#L173. prettyPrintParseErrorMessages :: String -> String -> String -> String -> String -> [Message] -> Box -- | Indent to the right, and pad on top and bottom. indent :: Box -> Box line :: String -> Box renderBox :: Box -> String -- | Rethrow an error with a more detailed error message in the case of -- failure rethrow :: (MonadError e m) => (e -> e) -> m a -> m a reifyErrors :: (MonadError e m) => m a -> m (Either e a) reflectErrors :: (MonadError e m) => m (Either e a) -> m a warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a -- | Rethrow an error with source position information rethrowWithPosition :: (MonadError MultipleErrors m) => SourceSpan -> m a -> m a warnWithPosition :: (MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a warnAndRethrowWithPosition :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage -- | Runs a computation listening for warnings and then escalating any -- warnings that match the predicate to error status. escalateWarningWhen :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (ErrorMessage -> Bool) -> m a -> m a -- | Collect errors in in parallel parU :: (MonadError MultipleErrors m) => [a] -> (a -> m b) -> m [b] instance GHC.Show.Show Language.PureScript.Errors.Level instance GHC.Show.Show Language.PureScript.Errors.TypeMap instance GHC.Base.Monoid Language.PureScript.Errors.MultipleErrors instance GHC.Show.Show Language.PureScript.Errors.MultipleErrors instance GHC.Show.Show Language.PureScript.Errors.ErrorMessage instance GHC.Classes.Eq Language.PureScript.Errors.HintCategory instance GHC.Show.Show Language.PureScript.Errors.HintCategory instance GHC.Show.Show Language.PureScript.Errors.ErrorMessageHint instance GHC.Show.Show Language.PureScript.Errors.SimpleErrorMessage -- | 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 MultipleErrors m) => [Module] -> m ([Module], ModuleGraph) -- | A list of modules with their transitive dependencies type ModuleGraph = [(ModuleName, [ModuleName])] -- | Module for exhaustivity checking over pattern matching definitions The -- algorithm analyses the clauses of a definition one by one from top to -- bottom, where in each step it has the cases already missing -- (uncovered), and it generates the new set of missing cases. module Language.PureScript.Linter.Exhaustive -- | Exhaustivity checking over a single module checkExhaustiveModule :: MonadWriter MultipleErrors m => Environment -> Module -> m () module Language.PureScript.Sugar.Names.Env -- | 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). data ImportRecord a ImportRecord :: Qualified a -> ModuleName -> ImportProvenance -> ImportRecord a [importName] :: ImportRecord a -> Qualified a [importSourceModule] :: ImportRecord a -> ModuleName [importProvenance] :: ImportRecord a -> ImportProvenance -- | 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 ImportProvenance FromImplicit :: ImportProvenance FromExplicit :: ImportProvenance Local :: ImportProvenance -- | The imported declarations for a module, including the module's own -- members. data Imports Imports :: Map (Qualified (ProperName TypeName)) [ImportRecord (ProperName TypeName)] -> Map (Qualified Ident) [ImportRecord Ident] -> Map (Qualified (ProperName ConstructorName)) [ImportRecord (ProperName ConstructorName)] -> Map (Qualified (ProperName ClassName)) [ImportRecord (ProperName ClassName)] -> Map (Qualified Ident) [ImportRecord Ident] -> Set ModuleName -> Set ModuleName -> Imports -- | Local names for types within a module mapped to to their qualified -- names [importedTypes] :: Imports -> Map (Qualified (ProperName TypeName)) [ImportRecord (ProperName TypeName)] -- | Local names for type operators within a module mapped to to their -- qualified names [importedTypeOps] :: Imports -> Map (Qualified Ident) [ImportRecord Ident] -- | Local names for data constructors within a module mapped to to their -- qualified names [importedDataConstructors] :: Imports -> Map (Qualified (ProperName ConstructorName)) [ImportRecord (ProperName ConstructorName)] -- | Local names for classes within a module mapped to to their qualified -- names [importedTypeClasses] :: Imports -> Map (Qualified (ProperName ClassName)) [ImportRecord (ProperName ClassName)] -- | Local names for values within a module mapped to to their qualified -- names [importedValues] :: Imports -> Map (Qualified Ident) [ImportRecord Ident] -- | The modules that have been imported into the current scope. [importedModules] :: Imports -> Set ModuleName -- | The names of "virtual" modules that come into existence when "import -- as" is used. [importedVirtualModules] :: Imports -> Set ModuleName -- | An empty Imports value. nullImports :: Imports -- | The exported declarations from a module. data Exports Exports :: [((ProperName TypeName, [ProperName ConstructorName]), ModuleName)] -> [(Ident, ModuleName)] -> [(ProperName ClassName, ModuleName)] -> [(Ident, ModuleName)] -> Exports -- | The types exported from each module along with the module they -- originally came from. [exportedTypes] :: Exports -> [((ProperName TypeName, [ProperName ConstructorName]), ModuleName)] -- | The type operators exported from each module along with the module -- they originally came from. [exportedTypeOps] :: Exports -> [(Ident, ModuleName)] -- | The classes exported from each module along with the module they -- originally came from. [exportedTypeClasses] :: Exports -> [(ProperName ClassName, ModuleName)] -- | The values exported from each module along with the module they -- originally came from. [exportedValues] :: Exports -> [(Ident, ModuleName)] -- | An empty Exports value. nullExports :: Exports -- | 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. type Env = Map ModuleName (SourceSpan, Imports, Exports) -- | Environment which only contains the Prim module. primEnv :: Env -- | Extracts the SourceSpan from an Env value. envModuleSourceSpan :: (SourceSpan, a, b) -> SourceSpan -- | Extracts the Imports from an Env value. envModuleImports :: (a, Imports, b) -> Imports -- | Extracts the Exports from an Env value. envModuleExports :: (a, b, Exports) -> Exports -- | Safely adds a type and its data constructors to some exports, -- returning an error if a conflict occurs. exportType :: (MonadError MultipleErrors m) => Exports -> ProperName TypeName -> [ProperName ConstructorName] -> ModuleName -> m Exports -- | Safely adds a type operator to some exports, returning an error if a -- conflict occurs. exportTypeOp :: (MonadError MultipleErrors m) => Exports -> Ident -> ModuleName -> m Exports -- | Safely adds a class to some exports, returning an error if a conflict -- occurs. exportTypeClass :: (MonadError MultipleErrors m) => Exports -> ProperName ClassName -> ModuleName -> m Exports -- | Safely adds a value to some exports, returning an error if a conflict -- occurs. exportValue :: (MonadError MultipleErrors m) => Exports -> Ident -> ModuleName -> m Exports getExports :: (MonadError MultipleErrors m) => Env -> ModuleName -> m Exports -- | When reading a value from the imports, check that there are no -- conflicts in scope. checkImportConflicts :: (Show a, MonadError MultipleErrors m, MonadWriter MultipleErrors m, Ord a) => ModuleName -> (a -> String) -> [ImportRecord a] -> m (ModuleName, ModuleName) instance GHC.Read.Read Language.PureScript.Sugar.Names.Env.Exports instance GHC.Show.Show Language.PureScript.Sugar.Names.Env.Exports instance GHC.Read.Read Language.PureScript.Sugar.Names.Env.Imports instance GHC.Show.Show Language.PureScript.Sugar.Names.Env.Imports instance GHC.Read.Read a => GHC.Read.Read (Language.PureScript.Sugar.Names.Env.ImportRecord a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Sugar.Names.Env.ImportRecord a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.Sugar.Names.Env.ImportRecord a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Sugar.Names.Env.ImportRecord a) instance GHC.Read.Read Language.PureScript.Sugar.Names.Env.ImportProvenance instance GHC.Show.Show Language.PureScript.Sugar.Names.Env.ImportProvenance instance GHC.Classes.Ord Language.PureScript.Sugar.Names.Env.ImportProvenance instance GHC.Classes.Eq Language.PureScript.Sugar.Names.Env.ImportProvenance module Language.PureScript.Sugar.Names.Imports -- | Constructs a set of imports for a module. resolveImports :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Env -> Module -> m (Module, Imports) -- | Constructs a set of imports for a single module import. resolveModuleImport :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Env -> Imports -> (ModuleName, [(Maybe SourceSpan, Maybe ImportDeclarationType, Maybe ModuleName)]) -> m Imports -- | Finds the imports within a module, mapping the imported module name to -- an optional set of explicitly imported declarations. findImports :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [Declaration] -> m (Map ModuleName [(Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)]) module Language.PureScript.Linter.Imports -- | Find and warn on: -- -- lintImports :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Module -> Env -> UsedImports -> m () -- | Imported name used in some type or expression. data Name IdentName :: (Qualified Ident) -> Name TyName :: (Qualified (ProperName TypeName)) -> Name TyOpName :: (Qualified Ident) -> Name DctorName :: (Qualified (ProperName ConstructorName)) -> Name TyClassName :: (Qualified (ProperName ClassName)) -> Name -- | Map of module name to list of imported names from that module which -- have been used. type UsedImports = Map ModuleName [Name] instance GHC.Show.Show Language.PureScript.Linter.Imports.Name instance GHC.Classes.Eq Language.PureScript.Linter.Imports.Name -- | This module implements a simple linting pass on the PureScript AST. module Language.PureScript.Linter -- | Lint the PureScript AST. | | Right now, this pass only performs a -- shadowing check. lint :: (MonadWriter MultipleErrors m) => Module -> m () -- | 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 in parallel parseModulesFromFiles :: (MonadError MultipleErrors m) => (k -> FilePath) -> [(k, String)] -> m [(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, Bool) parseLocalDeclaration :: TokenParser Declaration module Language.PureScript.Parser.JS type ForeignJS = String parseForeignModulesFromFiles :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [(FilePath, ForeignJS)] -> m (Map ModuleName FilePath) -- | A collection of parsers for core data types: -- -- module Language.PureScript.Parser -- | Monads for type checking and type inference and associated data types module Language.PureScript.TypeChecker.Monad -- | A substitution of unification variables for types or kinds data Substitution Substitution :: Map Int Type -> Map Int Kind -> Substitution -- | Type substitution [substType] :: Substitution -> Map Int Type -- | Kind substitution [substKind] :: Substitution -> Map Int Kind -- | An empty substitution emptySubstitution :: Substitution -- | State required for type checking data CheckState CheckState :: Environment -> Int -> Int -> Int -> Int -> Maybe ModuleName -> Substitution -> CheckState -- | The current Environment [checkEnv] :: CheckState -> Environment -- | The next type unification variable [checkNextType] :: CheckState -> Int -- | The next kind unification variable [checkNextKind] :: CheckState -> Int -- | The next skolem variable [checkNextSkolem] :: CheckState -> Int -- | The next skolem scope constant [checkNextSkolemScope] :: CheckState -> Int -- | The current module [checkCurrentModule] :: CheckState -> Maybe ModuleName -- | The current substitution [checkSubstitution] :: CheckState -> Substitution -- | Create an empty CheckState emptyCheckState :: Environment -> CheckState -- | Unification variables type Unknown = Int -- | 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 TypeName)) (Kind, TypeKind) -> m a -> m a -- | Temporarily bind a collection of names to types withScopedTypeVars :: (MonadState CheckState m, MonadWriter MultipleErrors 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 map of type class dictionaries getTypeClassDictionaries :: (MonadState CheckState m) => m (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) TypeClassDictionaryInScope))) -- | Lookup type class dictionaries in a module. lookupTypeClassDictionaries :: (MonadState CheckState m) => Maybe ModuleName -> m (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) TypeClassDictionaryInScope)) -- | Temporarily bind a collection of names to local variables bindLocalVariables :: (MonadState CheckState m) => ModuleName -> [(Ident, Type, NameVisibility)] -> m a -> m a -- | Temporarily bind a collection of names to local type variables bindLocalTypeVariables :: (MonadState CheckState m) => ModuleName -> [(ProperName TypeName, Kind)] -> m a -> m a -- | Update the visibility of all names to Defined makeBindingGroupVisible :: (MonadState CheckState m) => m () -- | Update the visibility of all names to Defined in the scope of the -- provided action withBindingGroupVisible :: (MonadState CheckState m) => m a -> m a -- | Perform an action while preserving the names from the -- Environment. preservingNames :: (MonadState CheckState m) => m a -> m a -- | Lookup the type of a value by name in the Environment lookupVariable :: (e ~ MultipleErrors, 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, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m NameVisibility -- | Assert that a name is visible checkVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m () -- | Lookup the kind of a type by name in the Environment lookupTypeVariable :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified (ProperName TypeName) -> m Kind -- | Get the current Environment getEnv :: (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 typechecking monad, starting with an empty -- Environment runCheck :: (Functor m) => StateT CheckState m a -> m (a, Environment) -- | Run a computation in the typechecking monad, failing with an error, or -- succeeding with a return value and the final Environment. runCheck' :: (Functor m) => Environment -> StateT CheckState m a -> m (a, Environment) -- | Make an assertion, failing with an error message guardWith :: (MonadError e m) => e -> Bool -> m () -- | Run a computation in the substitution monad, generating a return value -- and the final substitution. liftUnify :: (MonadState CheckState m, MonadWriter MultipleErrors m, MonadError MultipleErrors m) => m a -> m (a, Substitution) -- | Run a computation in the substitution monad, generating a return -- value, the final substitution and updating warnings values. liftUnifyWarnings :: (MonadState CheckState m, MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (Substitution -> ErrorMessage -> ErrorMessage) -> m a -> m (a, Substitution) -- | This module implements the kind checker module Language.PureScript.TypeChecker.Kinds -- | Infer the kind of a single type kindOf :: (MonadError MultipleErrors m, MonadState CheckState m, MonadWriter MultipleErrors m) => Type -> m Kind -- | Infer the kind of a single type, returning the kinds of any scoped -- type variables kindOfWithScopedVars :: (MonadError MultipleErrors m, MonadState CheckState m, MonadWriter MultipleErrors m) => Type -> m (Kind, [(String, Kind)]) -- | Infer the kind of a type constructor with a collection of arguments -- and a collection of associated data constructors kindsOf :: (MonadError MultipleErrors m, MonadState CheckState m, MonadWriter MultipleErrors m) => Bool -> ModuleName -> ProperName TypeName -> [(String, Maybe Kind)] -> [Type] -> m Kind -- | Simultaneously infer the kinds of several mutually recursive type -- constructors kindsOfAll :: (MonadError MultipleErrors m, MonadState CheckState m, MonadWriter MultipleErrors m) => ModuleName -> [(ProperName TypeName, [(String, Maybe Kind)], Type)] -> [(ProperName TypeName, [(String, Maybe Kind)], [Type])] -> m ([Kind], [Kind]) -- | Functions for replacing fully applied type synonyms module Language.PureScript.TypeChecker.Synonyms replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Type -> m Type -- | 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 :: (MonadError MultipleErrors m) => ModuleName -> [Declaration] -> m [Declaration] -- | Replace all sets of mutually-recursive declarations in a module with -- binding groups createBindingGroupsModule :: (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 :: (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] -- | Replace all top-level binders in a module with case expressions. desugarCasesModule :: (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 :: (MonadSupply m, MonadError MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] typeClassMemberName :: Declaration -> String superClassDictionaryNames :: [Constraint] -> [String] 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 -- | 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 :: (Monad m, MonadReader Options m, MonadSupply m, MonadError MultipleErrors m) => Module Ann -> Maybe JS -> 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 bind from the Prelude.Monad type -- class. module Language.PureScript.Sugar.DoNotation -- | Replace all DoNotationBind and DoNotationValue -- constructors with applications of the Prelude.bind function, and all -- DoNotationLet constructors with let expressions. desugarDoModule :: (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module module Language.PureScript.Sugar.ObjectWildcards desugarObjectConstructors :: (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module -- | This module implements the generic deriving elaboration that takes -- place during desugaring. module Language.PureScript.Sugar.TypeClasses.Deriving -- | Elaborates deriving instance declarations by code generation. deriveInstances :: (MonadError MultipleErrors m, MonadSupply 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 in a module with type -- annotations desugarTypeDeclarationsModule :: (MonadError MultipleErrors m) => [Module] -> m [Module] module Language.PureScript.Sugar.Names.Exports -- | Finds all exportable members of a module, disregarding any explicit -- exports. findExportable :: (MonadError MultipleErrors m) => Module -> m Exports -- | Resolves the exports for a module, filtering out members that have not -- been exported and elaborating re-exports of other modules. resolveExports :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Env -> ModuleName -> Imports -> Exports -> [DeclarationRef] -> m Exports module Language.PureScript.Sugar.Names -- | Replaces all local names with qualified names within a list of -- modules. The modules should be topologically sorted beforehand. desugarImports :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] desugarImportsWithEnv :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m (Env, [Module]) -- | 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. type Env = Map ModuleName (SourceSpan, Imports, Exports) -- | 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). data ImportRecord a ImportRecord :: Qualified a -> ModuleName -> ImportProvenance -> ImportRecord a [importName] :: ImportRecord a -> Qualified a [importSourceModule] :: ImportRecord a -> ModuleName [importProvenance] :: ImportRecord a -> ImportProvenance -- | 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 ImportProvenance FromImplicit :: ImportProvenance FromExplicit :: ImportProvenance Local :: ImportProvenance -- | The imported declarations for a module, including the module's own -- members. data Imports Imports :: Map (Qualified (ProperName TypeName)) [ImportRecord (ProperName TypeName)] -> Map (Qualified Ident) [ImportRecord Ident] -> Map (Qualified (ProperName ConstructorName)) [ImportRecord (ProperName ConstructorName)] -> Map (Qualified (ProperName ClassName)) [ImportRecord (ProperName ClassName)] -> Map (Qualified Ident) [ImportRecord Ident] -> Set ModuleName -> Set ModuleName -> Imports -- | Local names for types within a module mapped to to their qualified -- names [importedTypes] :: Imports -> Map (Qualified (ProperName TypeName)) [ImportRecord (ProperName TypeName)] -- | Local names for type operators within a module mapped to to their -- qualified names [importedTypeOps] :: Imports -> Map (Qualified Ident) [ImportRecord Ident] -- | Local names for data constructors within a module mapped to to their -- qualified names [importedDataConstructors] :: Imports -> Map (Qualified (ProperName ConstructorName)) [ImportRecord (ProperName ConstructorName)] -- | Local names for classes within a module mapped to to their qualified -- names [importedTypeClasses] :: Imports -> Map (Qualified (ProperName ClassName)) [ImportRecord (ProperName ClassName)] -- | Local names for values within a module mapped to to their qualified -- names [importedValues] :: Imports -> Map (Qualified Ident) [ImportRecord Ident] -- | The modules that have been imported into the current scope. [importedModules] :: Imports -> Set ModuleName -- | The names of "virtual" modules that come into existence when "import -- as" is used. [importedVirtualModules] :: Imports -> Set ModuleName -- | The exported declarations from a module. data Exports Exports :: [((ProperName TypeName, [ProperName ConstructorName]), ModuleName)] -> [(Ident, ModuleName)] -> [(ProperName ClassName, ModuleName)] -> [(Ident, ModuleName)] -> Exports -- | The types exported from each module along with the module they -- originally came from. [exportedTypes] :: Exports -> [((ProperName TypeName, [ProperName ConstructorName]), ModuleName)] -- | The type operators exported from each module along with the module -- they originally came from. [exportedTypeOps] :: Exports -> [(Ident, ModuleName)] -- | The classes exported from each module along with the module they -- originally came from. [exportedTypeClasses] :: Exports -> [(ProperName ClassName, ModuleName)] -- | The values exported from each module along with the module they -- originally came from. [exportedValues] :: Exports -> [(Ident, ModuleName)] module Language.PureScript.Sugar.Operators.Common type Chain a = [Either a a] toAssoc :: Associativity -> Assoc token :: (Stream s Identity t) => (t -> Maybe a) -> Parsec s u a parseValue :: Parsec (Chain a) () a parseOp :: (a -> (Maybe (Qualified Ident))) -> Parsec (Chain a) () (Qualified Ident) matchOp :: (a -> (Maybe (Qualified Ident))) -> Qualified Ident -> Parsec (Chain a) () () opTable :: [[(Qualified Ident, Associativity)]] -> (a -> Maybe (Qualified Ident)) -> (Qualified Ident -> a -> a -> a) -> [[Operator (Chain a) () Identity a]] matchOperators :: Show a => (a -> Bool) -> (a -> Maybe (a, a, a)) -> (a -> Maybe (Qualified Ident)) -> (Qualified Ident -> a -> a -> a) -> ([[Operator (Chain a) () Identity a]] -> OperatorTable (Chain a) () Identity a) -> [[(Qualified Ident, Associativity)]] -> a -> a module Language.PureScript.Sugar.Operators.Binders matchBinderOperators :: [[(Qualified Ident, Associativity)]] -> Binder -> Binder module Language.PureScript.Sugar.Operators.Expr matchExprOperators :: [[(Qualified Ident, Associativity)]] -> Expr -> Expr module Language.PureScript.Sugar.Operators.Types matchTypeOperators :: [[(Qualified Ident, Associativity)]] -> Type -> Type -- | 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 :: MonadError MultipleErrors m => [ExternsFile] -> [Module] -> m [Module] removeSignedLiterals :: Module -> Module desugarOperatorSections :: (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module -- | Desugaring passes module Language.PureScript.Sugar -- | The desugaring pipeline proceeds as follows: -- -- desugar :: (MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] -- | Functions relating to type checking for rows module Language.PureScript.TypeChecker.Rows -- | Ensure rows do not contain duplicate labels checkDuplicateLabels :: (MonadError MultipleErrors m, MonadState CheckState m) => Expr -> m () -- | Functions relating to skolemization used during typechecking module Language.PureScript.TypeChecker.Skolems -- | Generate a new skolem constant newSkolemConstant :: (MonadState CheckState m) => m Int -- | Introduce skolem scope at every occurence of a ForAll introduceSkolemScope :: (MonadState CheckState m) => Type -> m Type -- | Generate a new skolem scope newSkolemScope :: (MonadState CheckState m) => m SkolemScope -- | Skolemize a type variable by replacing its instances with fresh skolem -- constants skolemize :: String -> Int -> SkolemScope -> Maybe SourceSpan -> 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 -> Maybe SourceSpan -> Expr -> Expr -- | Ensure skolem variables do not escape their scope skolemEscapeCheck :: (MonadError MultipleErrors m, MonadState CheckState m) => Expr -> m () -- | Functions and instances relating to unification module Language.PureScript.TypeChecker.Unify -- | Generate a fresh type variable freshType :: (MonadState CheckState m) => m Type -- | Update the substitution to solve a type constraint solveType :: (MonadError MultipleErrors m, MonadState CheckState m) => Int -> Type -> m () -- | Apply a substitution to a type substituteType :: Substitution -> Type -> Type -- | Compute a list of all unknowns appearing in a type unknownsInType :: Type -> [Int] -- | Unify two types, updating the current substitution unifyTypes :: (MonadError MultipleErrors m, MonadState CheckState m) => Type -> Type -> m () -- | 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 :: (MonadError MultipleErrors m, MonadState CheckState m) => Type -> Type -> m () -- | Check that two types unify unifiesWith :: Type -> Type -> Bool -- | Replace a single type variable with a new unification variable replaceVarWithUnknown :: (MonadState CheckState m) => String -> Type -> m Type -- | Replace type wildcards with unknowns replaceTypeWildcards :: (MonadWriter MultipleErrors m, MonadState CheckState m) => Type -> m Type -- | Replace outermost unsolved unification variables with named type -- variables varIfUnknown :: Type -> Type -- | Type class entailment module Language.PureScript.TypeChecker.Entailment -- | The Context tracks those constraints which can be satisfied. type Context = Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) TypeClassDictionaryInScope)) -- | Replace type class dictionary placeholders with inferred type class -- dictionaries replaceTypeClassDictionaries :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => Bool -> ModuleName -> Expr -> m (Expr, [(Ident, Constraint)]) -- | Subsumption checking module Language.PureScript.TypeChecker.Subsumption -- | Check that one type subsumes another, rethrowing errors to provide a -- better error message subsumes :: (MonadError MultipleErrors m, MonadState CheckState m) => Maybe Expr -> Type -> Type -> m (Maybe Expr) -- | This module implements the type checker module Language.PureScript.TypeChecker.Types data BindingGroupType RecursiveBindingGroup :: BindingGroupType NonRecursiveBindingGroup :: BindingGroupType -- | Infer the types of multiple mutually-recursive values, and return -- elaborated values including type class dictionaries and type -- annotations. typesOf :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => BindingGroupType -> ModuleName -> [(Ident, Expr)] -> m [(Ident, (Expr, Type))] instance GHC.Classes.Ord Language.PureScript.TypeChecker.Types.BindingGroupType instance GHC.Classes.Eq Language.PureScript.TypeChecker.Types.BindingGroupType instance GHC.Show.Show Language.PureScript.TypeChecker.Types.BindingGroupType -- | 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 :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Module -> m Module -- | A replacement for WriterT IO which uses mutable references. module Control.Monad.Logger -- | A replacement for WriterT IO which uses mutable references. newtype Logger w a Logger :: (IORef w -> IO a) -> Logger w a [runLogger] :: Logger w a -> IORef w -> IO a -- | Run a Logger computation, starting with an empty log. runLogger' :: (Monoid w) => Logger w a -> IO (a, w) instance GHC.Base.Functor (Control.Monad.Logger.Logger w) instance GHC.Base.Monoid w => GHC.Base.Applicative (Control.Monad.Logger.Logger w) instance GHC.Base.Monoid w => GHC.Base.Monad (Control.Monad.Logger.Logger w) instance GHC.Base.Monoid w => Control.Monad.IO.Class.MonadIO (Control.Monad.Logger.Logger w) instance GHC.Base.Monoid w => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Logger.Logger w) instance GHC.Base.Monoid w => Control.Monad.Base.MonadBase GHC.Types.IO (Control.Monad.Logger.Logger w) instance GHC.Base.Monoid w => Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO (Control.Monad.Logger.Logger w) module Language.PureScript.Make -- | Determines when to rebuild a module data RebuildPolicy -- | Never rebuild this module RebuildNever :: RebuildPolicy -- | Always rebuild this module RebuildAlways :: RebuildPolicy -- | Progress messages from the make process data ProgressMessage CompilingModule :: ModuleName -> ProgressMessage -- | Render a progress message renderProgressMessage :: ProgressMessage -> String -- | Actions that require implementations when running in "make" mode. -- -- This type exists to make two things abstract: -- -- data MakeActions m MakeActions :: (ModuleName -> m (Either RebuildPolicy (Maybe UTCTime))) -> (ModuleName -> m (Maybe UTCTime)) -> (ModuleName -> m (FilePath, Externs)) -> (Module Ann -> Environment -> Externs -> SupplyT m ()) -> (ProgressMessage -> m ()) -> MakeActions m -- | Get the timestamp for the input file(s) for a module. If there are -- multiple files (.purs and foreign files, for example) the timestamp -- should be for the most recently modified file. [getInputTimestamp] :: MakeActions m -> ModuleName -> m (Either RebuildPolicy (Maybe UTCTime)) -- | Get the timestamp for the output files for a module. This should be -- the timestamp for the oldest modified file, or Nothing if any of the -- required output files are missing. [getOutputTimestamp] :: MakeActions m -> ModuleName -> m (Maybe UTCTime) -- | Read the externs file for a module as a string and also return the -- actual path for the file. [readExterns] :: MakeActions m -> ModuleName -> m (FilePath, Externs) -- | Run the code generator for the module and write any required output -- files. [codegen] :: MakeActions m -> Module Ann -> Environment -> Externs -> SupplyT m () -- | Respond to a progress update. [progress] :: MakeActions m -> ProgressMessage -> m () -- | Generated code for an externs file. type Externs = String -- | Rebuild a single module rebuildModule :: (Monad m, MonadBaseControl IO m, MonadReader Options m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [ExternsFile] -> Module -> m ExternsFile -- | 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 :: (Monad m, MonadBaseControl IO m, MonadReader Options m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [Module] -> m Environment -- | A monad for running make actions newtype Make a Make :: ReaderT Options (ExceptT MultipleErrors (Logger MultipleErrors)) a -> Make a [unMake] :: Make a -> ReaderT Options (ExceptT MultipleErrors (Logger MultipleErrors)) a -- | Execute a Make monad, returning either errors, or the result of -- the compile plus any warnings. runMake :: Options -> Make a -> IO (Either MultipleErrors a, MultipleErrors) -- | A set of make actions that read and write modules from the given -- directory. buildMakeActions :: FilePath -> Map ModuleName (Either RebuildPolicy FilePath) -> Map ModuleName FilePath -> Bool -> MakeActions Make instance Control.Monad.Reader.Class.MonadReader Language.PureScript.Options.Options Language.PureScript.Make.Make instance Control.Monad.Writer.Class.MonadWriter Language.PureScript.Errors.MultipleErrors Language.PureScript.Make.Make instance Control.Monad.Error.Class.MonadError Language.PureScript.Errors.MultipleErrors Language.PureScript.Make.Make instance Control.Monad.IO.Class.MonadIO Language.PureScript.Make.Make instance GHC.Base.Monad Language.PureScript.Make.Make instance GHC.Base.Applicative Language.PureScript.Make.Make instance GHC.Base.Functor Language.PureScript.Make.Make instance GHC.Classes.Ord Language.PureScript.Make.RebuildPolicy instance GHC.Classes.Eq Language.PureScript.Make.RebuildPolicy instance GHC.Read.Read Language.PureScript.Make.RebuildPolicy instance GHC.Show.Show Language.PureScript.Make.RebuildPolicy instance GHC.Classes.Ord Language.PureScript.Make.ProgressMessage instance GHC.Classes.Eq Language.PureScript.Make.ProgressMessage instance GHC.Read.Read Language.PureScript.Make.ProgressMessage instance GHC.Show.Show Language.PureScript.Make.ProgressMessage instance Control.Monad.Base.MonadBase GHC.Types.IO Language.PureScript.Make.Make instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO Language.PureScript.Make.Make -- | The main compiler module module Language.PureScript version :: Version module Language.PureScript.Errors.JSON data ErrorPosition ErrorPosition :: Int -> Int -> Int -> Int -> ErrorPosition [startLine] :: ErrorPosition -> Int [startColumn] :: ErrorPosition -> Int [endLine] :: ErrorPosition -> Int [endColumn] :: ErrorPosition -> Int data ErrorSuggestion ErrorSuggestion :: String -> ErrorSuggestion [replacement] :: ErrorSuggestion -> String data JSONError JSONError :: Maybe ErrorPosition -> String -> String -> String -> Maybe String -> Maybe String -> Maybe ErrorSuggestion -> JSONError [position] :: JSONError -> Maybe ErrorPosition [message] :: JSONError -> String [errorCode] :: JSONError -> String [errorLink] :: JSONError -> String [filename] :: JSONError -> Maybe String [moduleName] :: JSONError -> Maybe String [suggestion] :: JSONError -> Maybe ErrorSuggestion data JSONResult JSONResult :: [JSONError] -> [JSONError] -> JSONResult [warnings] :: JSONResult -> [JSONError] [errors] :: JSONResult -> [JSONError] toJSONErrors :: Bool -> Level -> MultipleErrors -> [JSONError] toJSONError :: Bool -> Level -> ErrorMessage -> JSONError instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Errors.JSON.ErrorSuggestion instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Errors.JSON.ErrorSuggestion instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Errors.JSON.JSONResult instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Errors.JSON.JSONResult instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Errors.JSON.JSONError instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Errors.JSON.JSONError instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Errors.JSON.ErrorPosition instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Errors.JSON.ErrorPosition instance GHC.Classes.Eq Language.PureScript.Errors.JSON.JSONResult instance GHC.Show.Show Language.PureScript.Errors.JSON.JSONResult instance GHC.Classes.Eq Language.PureScript.Errors.JSON.JSONError instance GHC.Show.Show Language.PureScript.Errors.JSON.JSONError instance GHC.Classes.Eq Language.PureScript.Errors.JSON.ErrorSuggestion instance GHC.Show.Show Language.PureScript.Errors.JSON.ErrorSuggestion instance GHC.Classes.Ord Language.PureScript.Errors.JSON.ErrorPosition instance GHC.Classes.Eq Language.PureScript.Errors.JSON.ErrorPosition instance GHC.Show.Show Language.PureScript.Errors.JSON.ErrorPosition -- | Data types and functions for representing a simplified form of -- PureScript code, intended for use in e.g. HTML documentation. module Language.PureScript.Docs.RenderedCode.Types -- | A single element in a rendered code fragment. The intention is to -- support multiple output formats. For example, plain text, or -- highlighted HTML. data RenderedCodeElement Syntax :: String -> RenderedCodeElement Ident :: String -> ContainingModule -> RenderedCodeElement Ctor :: String -> ContainingModule -> RenderedCodeElement Kind :: String -> RenderedCodeElement Keyword :: String -> RenderedCodeElement Space :: RenderedCodeElement asRenderedCodeElement :: Parse String RenderedCodeElement -- | This type is isomorphic to Maybe ModuleName. It makes -- code a bit easier to read, as the meaning is more explicit. data ContainingModule ThisModule :: ContainingModule OtherModule :: ModuleName -> ContainingModule asContainingModule :: Parse e ContainingModule -- | Convert a ContainingModule to a Maybe ModuleName, -- using the obvious isomorphism. containingModuleToMaybe :: ContainingModule -> Maybe ModuleName -- | Convert a Maybe ModuleName to a ContainingModule, -- using the obvious isomorphism. maybeToContainingModule :: Maybe ModuleName -> ContainingModule -- | A version of fromMaybe for ContainingModule values. fromContainingModule :: ModuleName -> ContainingModule -> ModuleName -- | A type representing a highly simplified version of PureScript code, -- intended for use in output formats like plain text or HTML. data RenderedCode asRenderedCode :: Parse String RenderedCode -- | This function allows conversion of a RenderedCode value into a -- value of some other type (for example, plain text, or HTML). The first -- argument is a function specifying how each individual -- RenderedCodeElement should be rendered. outputWith :: Monoid a => (RenderedCodeElement -> a) -> RenderedCode -> a -- | A RenderedCode fragment representing a space. sp :: RenderedCode syntax :: String -> RenderedCode ident :: String -> RenderedCode ident' :: String -> ContainingModule -> RenderedCode ctor :: String -> ContainingModule -> RenderedCode kind :: String -> RenderedCode keyword :: String -> RenderedCode keywordForall :: RenderedCode keywordData :: RenderedCode keywordNewtype :: RenderedCode keywordType :: RenderedCode keywordClass :: RenderedCode keywordInstance :: RenderedCode keywordWhere :: RenderedCode keywordFixity :: Associativity -> RenderedCode instance GHC.Base.Monoid Language.PureScript.Docs.RenderedCode.Types.RenderedCode instance GHC.Classes.Ord Language.PureScript.Docs.RenderedCode.Types.RenderedCode instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.RenderedCode instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.RenderedCode instance GHC.Classes.Ord Language.PureScript.Docs.RenderedCode.Types.RenderedCodeElement instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.RenderedCodeElement instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.RenderedCodeElement instance GHC.Classes.Ord Language.PureScript.Docs.RenderedCode.Types.ContainingModule instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.ContainingModule instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.ContainingModule instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.RenderedCode.Types.RenderedCodeElement instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.RenderedCode.Types.ContainingModule instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.RenderedCode.Types.RenderedCode -- | Functions for producing RenderedCode values from PureScript Type -- values. module Language.PureScript.Docs.RenderedCode.Render -- | Render code representing a Type renderType :: Type -> RenderedCode -- | Render code representing a Type, as it should appear inside -- parentheses renderTypeAtom :: Type -> RenderedCode -- | Render code representing a Row renderRow :: Type -> RenderedCode -- | Render code representing a Kind renderKind :: Kind -> RenderedCode data RenderTypeOptions RenderTypeOptions :: Bool -> Maybe ModuleName -> RenderTypeOptions [prettyPrintObjects] :: RenderTypeOptions -> Bool [currentModule] :: RenderTypeOptions -> Maybe ModuleName defaultRenderTypeOptions :: RenderTypeOptions renderTypeWithOptions :: RenderTypeOptions -> Type -> RenderedCode -- | Data types and functions for representing a simplified form of -- PureScript code, intended for use in e.g. HTML documentation. module Language.PureScript.Docs.RenderedCode module Language.PureScript.Docs.Types data Package a Package :: PackageMeta -> Version -> String -> [Module] -> [Bookmark] -> [(PackageName, Version)] -> (GithubUser, GithubRepo) -> a -> Version -> Package a [pkgMeta] :: Package a -> PackageMeta [pkgVersion] :: Package a -> Version [pkgVersionTag] :: Package a -> String [pkgModules] :: Package a -> [Module] [pkgBookmarks] :: Package a -> [Bookmark] [pkgResolvedDependencies] :: Package a -> [(PackageName, Version)] [pkgGithub] :: Package a -> (GithubUser, GithubRepo) [pkgUploader] :: Package a -> a -- | The version of the PureScript compiler which was used to generate this -- data. We store this in order to reject packages which are too old. [pkgCompilerVersion] :: Package a -> Version data NotYetKnown NotYetKnown :: NotYetKnown type UploadedPackage = Package NotYetKnown type VerifiedPackage = Package GithubUser verifyPackage :: GithubUser -> UploadedPackage -> VerifiedPackage packageName :: Package a -> PackageName data Module Module :: ModuleName -> Maybe String -> [Declaration] -> [(ModuleName, [Declaration])] -> Module [modName] :: Module -> ModuleName [modComments] :: Module -> Maybe String [modDeclarations] :: Module -> [Declaration] [modReExports] :: Module -> [(ModuleName, [Declaration])] data Declaration Declaration :: String -> Maybe String -> Maybe SourceSpan -> [ChildDeclaration] -> Maybe Fixity -> DeclarationInfo -> Declaration [declTitle] :: Declaration -> String [declComments] :: Declaration -> Maybe String [declSourceSpan] :: Declaration -> Maybe SourceSpan [declChildren] :: Declaration -> [ChildDeclaration] [declFixity] :: Declaration -> Maybe Fixity [declInfo] :: Declaration -> DeclarationInfo -- | A value of this type contains information that is specific to a -- particular kind of declaration (as opposed to information which exists -- in all kinds of declarations, which goes into the Declaration -- type directly). -- -- Many of the constructors are very similar to their equivalents in the -- real PureScript AST, except that they have their name elided, since -- this is already available via the rdTitle field of Declaration. data DeclarationInfo -- | A value declaration, with its type. ValueDeclaration :: Type -> DeclarationInfo -- | A data/newtype declaration, with the kind of declaration (data or -- newtype) and its type arguments. Constructors are represented as child -- declarations. DataDeclaration :: DataDeclType -> [(String, Maybe Kind)] -> DeclarationInfo -- | A data type foreign import, with its kind. ExternDataDeclaration :: Kind -> DeclarationInfo -- | A type synonym, with its type arguments and its type. TypeSynonymDeclaration :: [(String, Maybe Kind)] -> Type -> DeclarationInfo -- | A type class, with its type arguments and its superclasses. Instances -- and members are represented as child declarations. TypeClassDeclaration :: [(String, Maybe Kind)] -> [Constraint] -> DeclarationInfo -- | An operator alias declaration, with the member the alias is for and -- the operator's fixity. AliasDeclaration :: (Qualified FixityAlias) -> Fixity -> DeclarationInfo declInfoToString :: DeclarationInfo -> String isTypeClass :: Declaration -> Bool isValue :: Declaration -> Bool isType :: Declaration -> Bool isValueAlias :: Declaration -> Bool isTypeAlias :: Declaration -> Bool -- | Discard any children which do not satisfy the given predicate. filterChildren :: (ChildDeclaration -> Bool) -> Declaration -> Declaration data ChildDeclaration ChildDeclaration :: String -> Maybe String -> Maybe SourceSpan -> ChildDeclarationInfo -> ChildDeclaration [cdeclTitle] :: ChildDeclaration -> String [cdeclComments] :: ChildDeclaration -> Maybe String [cdeclSourceSpan] :: ChildDeclaration -> Maybe SourceSpan [cdeclInfo] :: ChildDeclaration -> ChildDeclarationInfo data ChildDeclarationInfo -- | A type instance declaration, with its dependencies and its type. ChildInstance :: [Constraint] -> Type -> ChildDeclarationInfo -- | A data constructor, with its type arguments. ChildDataConstructor :: [Type] -> ChildDeclarationInfo -- | A type class member, with its type. Note that the type does not -- include the type class constraint; this may be added manually if -- desired. For example, pure from Applicative would be -- `forall a. a -> f a`. ChildTypeClassMember :: Type -> ChildDeclarationInfo childDeclInfoToString :: ChildDeclarationInfo -> String isTypeClassMember :: ChildDeclaration -> Bool isDataConstructor :: ChildDeclaration -> Bool newtype GithubUser GithubUser :: String -> GithubUser [runGithubUser] :: GithubUser -> String newtype GithubRepo GithubRepo :: String -> GithubRepo [runGithubRepo] :: GithubRepo -> String data PackageError -- | Minimum allowable version for generating data with the current parser, -- and actual version used. CompilerTooOld :: Version -> Version -> PackageError ErrorInPackageMeta :: BowerError -> PackageError InvalidVersion :: PackageError InvalidDeclarationType :: String -> PackageError InvalidChildDeclarationType :: String -> PackageError InvalidFixity :: PackageError InvalidKind :: String -> PackageError InvalidDataDeclType :: String -> PackageError type Bookmark = InPackage (ModuleName, String) data InPackage a Local :: a -> InPackage a FromDep :: PackageName -> a -> InPackage a takeLocal :: InPackage a -> Maybe a takeLocals :: [InPackage a] -> [a] ignorePackage :: InPackage a -> a parseUploadedPackage :: Version -> ByteString -> Either (ParseError PackageError) UploadedPackage parseVerifiedPackage :: Version -> ByteString -> Either (ParseError PackageError) VerifiedPackage asPackage :: Version -> (forall e. Parse e a) -> Parse PackageError (Package a) asUploadedPackage :: Version -> Parse PackageError UploadedPackage asNotYetKnown :: Parse e NotYetKnown asVerifiedPackage :: Version -> Parse PackageError VerifiedPackage displayPackageError :: PackageError -> Text asGithubUser :: Parse e GithubUser asVersion :: Parse PackageError Version parseVersion' :: String -> Maybe Version asModule :: Parse PackageError Module asDeclaration :: Parse PackageError Declaration asReExport :: Parse PackageError (ModuleName, [Declaration]) asInPackage :: Parse BowerError a -> Parse BowerError (InPackage a) asFixity :: Parse PackageError Fixity parseAssociativity :: String -> Maybe Associativity asAssociativity :: Parse PackageError Associativity asDeclarationInfo :: Parse PackageError DeclarationInfo asAliasFor :: Parse e (Qualified FixityAlias) asTypeArguments :: Parse PackageError [(String, Maybe Kind)] asKind :: Parse e Kind asType :: Parse e Type asDataDeclType :: Parse PackageError DataDeclType asChildDeclaration :: Parse PackageError ChildDeclaration asChildDeclarationInfo :: Parse PackageError ChildDeclarationInfo asSourcePos :: Parse e SourcePos asConstraint :: Parse PackageError Constraint asQualifiedProperName :: Parse e (Qualified (ProperName a)) asQualifiedIdent :: Parse e (Qualified Ident) asBookmarks :: Parse BowerError [Bookmark] asBookmark :: Parse BowerError Bookmark asResolvedDependencies :: Parse PackageError [(PackageName, Version)] asGithub :: Parse e (GithubUser, GithubRepo) asSourceSpan :: Parse e SourceSpan -- | Given a function for turning association list keys into JSON object -- keys, and a function for turning association list values to JSON -- string values, turns an association list into a JSON object. -- -- For example: assocListToJSON T.pack T.pack [("a", "b")] will -- give {"a": "b"}. assocListToJSON :: (a -> Text) -> (b -> Text) -> [(a, b)] -> Value instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.Docs.Types.Package a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Docs.Types.Package a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Docs.Types.Package a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.Docs.Types.InPackage a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Docs.Types.InPackage a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Docs.Types.InPackage a) instance GHC.Classes.Ord Language.PureScript.Docs.Types.PackageError instance GHC.Classes.Eq Language.PureScript.Docs.Types.PackageError instance GHC.Show.Show Language.PureScript.Docs.Types.PackageError instance GHC.Classes.Ord Language.PureScript.Docs.Types.GithubRepo instance GHC.Classes.Eq Language.PureScript.Docs.Types.GithubRepo instance GHC.Show.Show Language.PureScript.Docs.Types.GithubRepo instance GHC.Classes.Ord Language.PureScript.Docs.Types.GithubUser instance GHC.Classes.Eq Language.PureScript.Docs.Types.GithubUser instance GHC.Show.Show Language.PureScript.Docs.Types.GithubUser instance GHC.Classes.Ord Language.PureScript.Docs.Types.Module instance GHC.Classes.Eq Language.PureScript.Docs.Types.Module instance GHC.Show.Show Language.PureScript.Docs.Types.Module instance GHC.Classes.Ord Language.PureScript.Docs.Types.Declaration instance GHC.Classes.Eq Language.PureScript.Docs.Types.Declaration instance GHC.Show.Show Language.PureScript.Docs.Types.Declaration instance GHC.Classes.Ord Language.PureScript.Docs.Types.ChildDeclaration instance GHC.Classes.Eq Language.PureScript.Docs.Types.ChildDeclaration instance GHC.Show.Show Language.PureScript.Docs.Types.ChildDeclaration instance GHC.Classes.Ord Language.PureScript.Docs.Types.ChildDeclarationInfo instance GHC.Classes.Eq Language.PureScript.Docs.Types.ChildDeclarationInfo instance GHC.Show.Show Language.PureScript.Docs.Types.ChildDeclarationInfo instance GHC.Classes.Ord Language.PureScript.Docs.Types.DeclarationInfo instance GHC.Classes.Eq Language.PureScript.Docs.Types.DeclarationInfo instance GHC.Show.Show Language.PureScript.Docs.Types.DeclarationInfo instance GHC.Classes.Ord Language.PureScript.Docs.Types.NotYetKnown instance GHC.Classes.Eq Language.PureScript.Docs.Types.NotYetKnown instance GHC.Show.Show Language.PureScript.Docs.Types.NotYetKnown instance GHC.Base.Functor Language.PureScript.Docs.Types.InPackage instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Docs.Types.NotYetKnown instance Data.Aeson.Types.Class.FromJSON a => Data.Aeson.Types.Class.FromJSON (Language.PureScript.Docs.Types.Package a) instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Docs.Types.GithubUser instance Data.Aeson.Types.Class.ToJSON a => Data.Aeson.Types.Class.ToJSON (Language.PureScript.Docs.Types.Package a) instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.Types.NotYetKnown instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.Types.Module instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.Types.Declaration instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.Types.ChildDeclaration instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.Types.DeclarationInfo instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.Types.ChildDeclarationInfo instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.Types.GithubUser instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Docs.Types.GithubRepo instance Data.Aeson.Types.Class.ToJSON a => Data.Aeson.Types.Class.ToJSON (Language.PureScript.Docs.Types.InPackage a) -- | Functions for creating RenderedCode values from data types in -- Language.PureScript.Docs.Types. -- -- These functions are the ones that are used in markdown/html -- documentation generation, but the intention is that you are able to -- supply your own instead if necessary. For example, the Hoogle input -- file generator substitutes some of these module Language.PureScript.Docs.Render renderDeclaration :: Declaration -> RenderedCode renderDeclarationWithOptions :: RenderTypeOptions -> Declaration -> RenderedCode renderChildDeclaration :: ChildDeclaration -> RenderedCode renderChildDeclarationWithOptions :: RenderTypeOptions -> ChildDeclaration -> RenderedCode renderConstraint :: Constraint -> RenderedCode renderConstraintWithOptions :: RenderTypeOptions -> Constraint -> RenderedCode renderConstraints :: [Constraint] -> Maybe RenderedCode renderConstraintsWithOptions :: RenderTypeOptions -> [Constraint] -> Maybe RenderedCode notQualified :: String -> Qualified (ProperName a) typeApp :: String -> [(String, Maybe Kind)] -> Type toTypeVar :: (String, Maybe Kind) -> Type module Language.PureScript.Docs.Convert.ReExports -- | Given: -- -- -- -- This function adds all the missing re-exports. updateReExports :: Env -> [ModuleName] -> Map ModuleName Module -> Map ModuleName Module instance GHC.Show.Show Language.PureScript.Docs.Convert.ReExports.TypeClassEnv instance GHC.Base.Monoid Language.PureScript.Docs.Convert.ReExports.TypeClassEnv module Language.PureScript.Docs.Convert.Single -- | Convert a single Module, but ignore re-exports; any re-exported types -- or values will not appear in the result. convertSingleModule :: Module -> Module -- | Go through a PureScript module and extract a list of Bookmarks; -- references to data types or values, to be used as a kind of index. -- These are used for generating links in the HTML documentation, for -- example. collectBookmarks :: InPackage Module -> [Bookmark] -- | Functions for converting PureScript ASTs into values of the data types -- from Language.PureScript.Docs. module Language.PureScript.Docs.Convert -- | Convert a group of modules to the intermediate format, designed for -- producing documentation from. It is also necessary to pass an Env -- containing imports/exports information about the list of modules, -- which is needed for documenting re-exports. -- -- Note that the whole module dependency graph must be included in the -- list; if some modules import things from other modules, then those -- modules must also be included. -- -- For value declarations, if explicit type signatures are omitted, or a -- wildcard type is used, then we typecheck the modules and use the -- inferred types. convertModules :: (MonadError MultipleErrors m) => [Module] -> m [Module] -- | Like convertModules, except that it takes a list of modules, together -- with their dependency status, and discards dependency modules in the -- resulting documentation. convertModulesInPackage :: (MonadError MultipleErrors m) => [InPackage Module] -> m [Module] -- | Go through a PureScript module and extract a list of Bookmarks; -- references to data types or values, to be used as a kind of index. -- These are used for generating links in the HTML documentation, for -- example. collectBookmarks :: InPackage Module -> [Bookmark] module Language.PureScript.Docs.ParseAndBookmark -- | Given: -- -- -- -- This function does the following: -- -- parseAndBookmark :: (MonadError MultipleErrors m, MonadIO m) => [FilePath] -> [(PackageName, FilePath)] -> m ([InPackage Module], [Bookmark]) -- | Data types and functions for rendering generated documentation from -- PureScript code, in a variety of formats. module Language.PureScript.Docs module Language.PureScript.Docs.AsMarkdown -- | Take a list of modules and render them all in order, returning a -- single Markdown-formatted String. renderModulesAsMarkdown :: (MonadError MultipleErrors m) => [Module] -> m String type Docs = Writer [String] () runDocs :: Docs -> String modulesAsMarkdown :: [Module] -> Docs codeToString :: RenderedCode -> String instance GHC.Classes.Ord Language.PureScript.Docs.AsMarkdown.First instance GHC.Classes.Eq Language.PureScript.Docs.AsMarkdown.First instance GHC.Read.Read Language.PureScript.Docs.AsMarkdown.First instance GHC.Show.Show Language.PureScript.Docs.AsMarkdown.First module Language.PureScript.Publish.ErrorsWarnings -- | An error which meant that it was not possible to retrieve metadata for -- a package. data PackageError UserError :: UserError -> PackageError InternalError :: InternalError -> PackageError OtherError :: OtherError -> PackageError data PackageWarning NoResolvedVersion :: PackageName -> PackageWarning UndeclaredDependency :: PackageName -> PackageWarning UnacceptableVersion :: (PackageName, String) -> PackageWarning DirtyWorkingTree_Warn :: PackageWarning -- | An error that should be fixed by the user. data UserError BowerJSONNotFound :: UserError LicenseNotFound :: UserError BowerExecutableNotFound :: [String] -> UserError CouldntDecodeBowerJSON :: (ParseError BowerError) -> UserError TagMustBeCheckedOut :: UserError AmbiguousVersions :: [Version] -> UserError BadRepositoryField :: RepositoryFieldError -> UserError NoLicenseSpecified :: UserError MissingDependencies :: (NonEmpty PackageName) -> UserError CompileError :: MultipleErrors -> UserError DirtyWorkingTree :: UserError -- | An error that probably indicates a bug in this module. data InternalError JSONError :: JSONSource -> (ParseError BowerError) -> InternalError data OtherError ProcessFailed :: String -> [String] -> IOException -> OtherError IOExceptionThrown :: IOException -> OtherError data RepositoryFieldError RepositoryFieldMissing :: RepositoryFieldError BadRepositoryType :: String -> RepositoryFieldError NotOnGithub :: RepositoryFieldError data JSONSource FromFile :: FilePath -> JSONSource FromBowerList :: JSONSource printError :: PackageError -> IO () printErrorToStdout :: PackageError -> IO () renderError :: PackageError -> Box printWarnings :: [PackageWarning] -> IO () renderWarnings :: [PackageWarning] -> Box instance GHC.Classes.Ord Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings instance GHC.Classes.Eq Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.PackageError instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.OtherError instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.InternalError instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.JSONSource instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.UserError instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.RepositoryFieldError instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.PackageWarning instance GHC.Base.Monoid Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings module Language.PureScript.Publish -- | Attempt to retrieve package metadata from the current directory. -- Returns a PackageError on failure preparePackage :: PublishOptions -> IO (Either PackageError UploadedPackage) preparePackage' :: PublishOptions -> PrepareM UploadedPackage -- | Attempt to retrieve package metadata from the current directory. Calls -- exitFailure if no package metadata could be retrieved. unsafePreparePackage :: PublishOptions -> IO UploadedPackage data PrepareM a runPrepareM :: PrepareM a -> IO (Either PackageError (a, [PackageWarning])) warn :: PackageWarning -> PrepareM () userError :: UserError -> PrepareM a internalError :: InternalError -> PrepareM a otherError :: OtherError -> PrepareM a data PublishOptions PublishOptions :: PrepareM (String, Version) -> PrepareM () -> PublishOptions -- | How to obtain the version tag and version that the data being -- generated will refer to. [publishGetVersion] :: PublishOptions -> PrepareM (String, Version) -- | What to do when the working tree is dirty [publishWorkingTreeDirty] :: PublishOptions -> PrepareM () defaultPublishOptions :: PublishOptions getGitWorkingTreeStatus :: PrepareM TreeStatus checkCleanWorkingTree :: PublishOptions -> PrepareM () getVersionFromGitTag :: PrepareM (String, Version) getBowerRepositoryInfo :: PackageMeta -> PrepareM (GithubUser, GithubRepo) getModulesAndBookmarks :: PrepareM ([Bookmark], [Module]) getResolvedDependencies :: [PackageName] -> PrepareM [(PackageName, Version)] instance GHC.Classes.Eq Language.PureScript.Publish.DependencyStatus instance GHC.Read.Read Language.PureScript.Publish.DependencyStatus instance GHC.Show.Show Language.PureScript.Publish.DependencyStatus instance GHC.Enum.Enum Language.PureScript.Publish.TreeStatus instance GHC.Classes.Ord Language.PureScript.Publish.TreeStatus instance GHC.Classes.Eq Language.PureScript.Publish.TreeStatus instance GHC.Read.Read Language.PureScript.Publish.TreeStatus instance GHC.Show.Show Language.PureScript.Publish.TreeStatus instance Control.Monad.Error.Class.MonadError Language.PureScript.Publish.ErrorsWarnings.PackageError Language.PureScript.Publish.PrepareM instance Control.Monad.Writer.Class.MonadWriter [Language.PureScript.Publish.ErrorsWarnings.PackageWarning] Language.PureScript.Publish.PrepareM instance GHC.Base.Monad Language.PureScript.Publish.PrepareM instance GHC.Base.Applicative Language.PureScript.Publish.PrepareM instance GHC.Base.Functor Language.PureScript.Publish.PrepareM instance Control.Monad.IO.Class.MonadIO Language.PureScript.Publish.PrepareM -- | Type definitions for psc-ide module Language.PureScript.Ide.Types type Ident = Text type DeclIdent = Text type ModuleIdent = Text data ExternDecl -- | A function/value declaration ValueDeclaration :: Ident -> Type -> ExternDecl TypeDeclaration :: (ProperName TypeName) -> Kind -> ExternDecl TypeSynonymDeclaration :: (ProperName TypeName) -> Type -> ExternDecl -- | A Dependency onto another Module Dependency :: ModuleIdent -> [Text] -> (Maybe Text) -> ExternDecl -- | A module declaration ModuleDecl :: ModuleIdent -> [DeclIdent] -> ExternDecl -- | A data/newtype declaration DataConstructor :: DeclIdent -> (ProperName TypeName) -> Type -> ExternDecl -- | An exported module TypeClassDeclaration :: (ProperName ClassName) -> ExternDecl Export :: ModuleIdent -> ExternDecl type Module = (ModuleIdent, [ExternDecl]) data Configuration Configuration :: FilePath -> Bool -> Configuration [confOutputPath] :: Configuration -> FilePath [confDebug] :: Configuration -> Bool data PscIdeEnvironment PscIdeEnvironment :: TVar PscIdeState -> Configuration -> PscIdeEnvironment [envStateVar] :: PscIdeEnvironment -> TVar PscIdeState [envConfiguration] :: PscIdeEnvironment -> Configuration type PscIde m = (MonadIO m, MonadReader PscIdeEnvironment m) data PscIdeState PscIdeState :: Map Text [ExternDecl] -> Map ModuleName ExternsFile -> PscIdeState [pscStateModules] :: PscIdeState -> Map Text [ExternDecl] [externsFiles] :: PscIdeState -> Map ModuleName ExternsFile emptyPscIdeState :: PscIdeState data Match Match :: ModuleIdent -> ExternDecl -> Match newtype Completion Completion :: (ModuleIdent, DeclIdent, Text) -> Completion data ModuleImport ModuleImport :: ModuleIdent -> ImportDeclarationType -> Maybe Text -> ModuleImport [importModuleName] :: ModuleImport -> ModuleIdent [importType] :: ModuleImport -> ImportDeclarationType [importQualifier] :: ModuleImport -> Maybe Text identifierFromDeclarationRef :: DeclarationRef -> String data Success CompletionResult :: [Completion] -> Success TextResult :: Text -> Success MultilineTextResult :: [Text] -> Success PursuitResult :: [PursuitResponse] -> Success ImportList :: [ModuleImport] -> Success ModuleList :: [ModuleIdent] -> Success RebuildSuccess :: [JSONError] -> Success encodeSuccess :: (ToJSON a) => a -> Value newtype PursuitQuery PursuitQuery :: Text -> PursuitQuery data PursuitSearchType Package :: PursuitSearchType Identifier :: PursuitSearchType data PursuitResponse -- | A Pursuit Response for a module. Consists of the modules name and the -- package it belongs to ModuleResponse :: ModuleIdent -> Text -> PursuitResponse -- | A Pursuit Response for a declaration. Consist of the declarations -- type, module, name and package DeclarationResponse :: Text -> ModuleIdent -> DeclIdent -> Text -> PursuitResponse typeParse :: Text -> Either Text (Text, Text) instance GHC.Classes.Eq Language.PureScript.Ide.Types.Success instance GHC.Show.Show Language.PureScript.Ide.Types.Success instance GHC.Classes.Eq Language.PureScript.Ide.Types.PursuitResponse instance GHC.Show.Show Language.PureScript.Ide.Types.PursuitResponse instance GHC.Classes.Eq Language.PureScript.Ide.Types.PursuitSearchType instance GHC.Show.Show Language.PureScript.Ide.Types.PursuitSearchType instance GHC.Classes.Eq Language.PureScript.Ide.Types.PursuitQuery instance GHC.Show.Show Language.PureScript.Ide.Types.PursuitQuery instance GHC.Show.Show Language.PureScript.Ide.Types.ModuleImport instance GHC.Classes.Eq Language.PureScript.Ide.Types.Completion instance GHC.Show.Show Language.PureScript.Ide.Types.Completion instance GHC.Classes.Eq Language.PureScript.Ide.Types.Match instance GHC.Show.Show Language.PureScript.Ide.Types.Match instance GHC.Show.Show Language.PureScript.Ide.Types.PscIdeState instance GHC.Classes.Ord Language.PureScript.Ide.Types.ExternDecl instance GHC.Classes.Eq Language.PureScript.Ide.Types.ExternDecl instance GHC.Show.Show Language.PureScript.Ide.Types.ExternDecl instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Ide.Types.Completion instance GHC.Classes.Eq Language.PureScript.Ide.Types.ModuleImport instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Ide.Types.ModuleImport instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Ide.Types.Success instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Ide.Types.PursuitSearchType instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Ide.Types.PursuitQuery instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Ide.Types.PursuitResponse instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Ide.Types.PursuitResponse -- | Error types for psc-ide module Language.PureScript.Ide.Error type ErrorMsg = String data PscIdeError GeneralError :: ErrorMsg -> PscIdeError NotFound :: Text -> PscIdeError ModuleNotFound :: ModuleIdent -> PscIdeError ModuleFileNotFound :: ModuleIdent -> PscIdeError ParseError :: ParseError -> ErrorMsg -> PscIdeError RebuildError :: [JSONError] -> PscIdeError textError :: PscIdeError -> Text instance Data.Aeson.Types.Class.ToJSON Language.PureScript.Ide.Error.PscIdeError -- | Pursuit client for psc-ide module Language.PureScript.Ide.Pursuit queryPursuit :: Text -> IO ByteString handler :: HttpException -> IO [a] searchPursuitForDeclarations :: Text -> IO [PursuitResponse] findPackagesForModuleIdent :: Text -> IO [PursuitResponse] -- | Resolves reexports for psc-ide module Language.PureScript.Ide.Reexports getReexports :: Module -> [ExternDecl] dependencyToExport :: ExternDecl -> ExternDecl replaceExportWithAliases :: [ExternDecl] -> ModuleIdent -> [ExternDecl] replaceReexport :: ExternDecl -> Module -> Module -> Module emptyModule :: Module isExport :: ExternDecl -> Bool removeExportDecls :: Module -> Module replaceReexports :: Module -> Map ModuleIdent [ExternDecl] -> Module resolveReexports :: Map ModuleIdent [ExternDecl] -> Module -> Module -- | Generally useful functions and conversions module Language.PureScript.Ide.Util runProperNameT :: ProperName a -> Text runIdentT :: Ident -> Text prettyTypeT :: Type -> Text identifierFromExternDecl :: ExternDecl -> Text identifierFromMatch :: Match -> Text completionFromMatch :: Match -> Maybe Completion encodeT :: (ToJSON a) => a -> Text decodeT :: (FromJSON a) => Text -> Maybe a -- | Handles externs files for psc-ide module Language.PureScript.Ide.Externs data ExternDecl -- | A function/value declaration ValueDeclaration :: Ident -> Type -> ExternDecl TypeDeclaration :: (ProperName TypeName) -> Kind -> ExternDecl TypeSynonymDeclaration :: (ProperName TypeName) -> Type -> ExternDecl -- | A Dependency onto another Module Dependency :: ModuleIdent -> [Text] -> (Maybe Text) -> ExternDecl -- | A module declaration ModuleDecl :: ModuleIdent -> [DeclIdent] -> ExternDecl -- | A data/newtype declaration DataConstructor :: DeclIdent -> (ProperName TypeName) -> Type -> ExternDecl -- | An exported module TypeClassDeclaration :: (ProperName ClassName) -> ExternDecl Export :: ModuleIdent -> ExternDecl type ModuleIdent = Text type DeclIdent = Text readExternFile :: (MonadIO m, MonadError PscIdeError m) => FilePath -> m ExternsFile convertExterns :: ExternsFile -> Module unwrapPositioned :: Declaration -> Declaration unwrapPositionedRef :: DeclarationRef -> DeclarationRef -- | Getting declarations from PureScript sourcefiles module Language.PureScript.Ide.SourceFile parseModuleFromFile :: (MonadIO m, MonadError PscIdeError m) => FilePath -> m Module getDeclarations :: Module -> [Declaration] getImports :: Module -> [Declaration] getImportsForFile :: (MonadIO m, MonadError PscIdeError m) => FilePath -> m [ModuleImport] getPositionedImports :: Module -> [Declaration] getDeclPosition :: Module -> String -> Maybe SourceSpan goToDefinition :: String -> FilePath -> IO (Maybe SourceSpan) -- | Functions to access psc-ide's state module Language.PureScript.Ide.State getPscIdeState :: (PscIde m) => m (Map ModuleIdent [ExternDecl]) getExternFiles :: (PscIde m) => m (Map ModuleName ExternsFile) getExternFile :: (PscIde m) => ModuleName -> m (Maybe ExternsFile) getAllDecls :: (PscIde m) => m [ExternDecl] getAllModules :: (PscIde m) => m [Module] getAllModulesWithReexports :: (PscIde m, MonadLogger m) => m [Module] getModule :: (PscIde m, MonadLogger m) => ModuleIdent -> m (Maybe Module) getModuleWithReexports :: (PscIde m, MonadLogger m) => ModuleIdent -> m (Maybe Module) insertModule :: (PscIde m, MonadLogger m) => ExternsFile -> m () insertModule' :: TVar PscIdeState -> ExternsFile -> STM () -- | Casesplitting and adding function clauses module Language.PureScript.Ide.CaseSplit data WildcardAnnotations explicitAnnotations :: WildcardAnnotations noAnnotations :: WildcardAnnotations -- | Constructs Patterns to insert into a sourcefile makePattern :: Text -> Int -> Int -> WildcardAnnotations -> [Constructor] -> [Text] addClause :: Text -> WildcardAnnotations -> [Text] caseSplit :: (PscIde m, MonadLogger m, MonadError PscIdeError m) => Text -> m [Constructor] module Language.PureScript.Ide.Rebuild rebuildFile :: (PscIde m, MonadLogger m, MonadError PscIdeError m) => FilePath -> m Success sortExterns :: (PscIde m, MonadError PscIdeError m) => Module -> Map ModuleName ExternsFile -> m [ExternsFile] -- | File watcher for externs files module Language.PureScript.Ide.Watcher reloadFile :: TVar PscIdeState -> FilePath -> IO () watcher :: TVar PscIdeState -> FilePath -> IO () -- | Filters for psc-ide commands module Language.PureScript.Ide.Filter data Filter -- | Only keeps the given Modules moduleFilter :: [ModuleIdent] -> Filter -- | Only keeps Identifiers that start with the given prefix prefixFilter :: Text -> Filter -- | Only keeps Identifiers that are equal to the search string equalityFilter :: Text -> Filter -- | Only keeps the given Modules and all of their dependencies dependencyFilter :: [ModuleIdent] -> Filter runFilter :: Filter -> [Module] -> [Module] applyFilters :: [Filter] -> [Module] -> [Module] instance GHC.Base.Monoid Language.PureScript.Ide.Filter.Filter instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Ide.Filter.Filter -- | Matchers for psc-ide commands module Language.PureScript.Ide.Matcher data Matcher -- | Matches any occurence of the search string with intersections -- -- The scoring measures how far the matches span the string where closer -- is better. Examples: flMa matches flexMatcher. Score: 14.28 sons -- matches sortCompletions. Score: 6.25 flexMatcher :: Text -> Matcher runMatcher :: Matcher -> [Match] -> [Match] instance GHC.Base.Monoid Language.PureScript.Ide.Matcher.Matcher instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Ide.Matcher.Matcher -- | Datatypes for the commands psc-ide accepts module Language.PureScript.Ide.Command data Command Load :: [ModuleIdent] -> [ModuleIdent] -> Command [loadModules] :: Command -> [ModuleIdent] [loadDependencies] :: Command -> [ModuleIdent] Type :: DeclIdent -> [Filter] -> Command [typeSearch] :: Command -> DeclIdent [typeFilters] :: Command -> [Filter] Complete :: [Filter] -> Matcher -> Command [completeFilters] :: Command -> [Filter] [completeMatcher] :: Command -> Matcher Pursuit :: PursuitQuery -> PursuitSearchType -> Command [pursuitQuery] :: Command -> PursuitQuery [pursuitSearchType] :: Command -> PursuitSearchType CaseSplit :: Text -> Int -> Int -> WildcardAnnotations -> Text -> Command [caseSplitLine] :: Command -> Text [caseSplitBegin] :: Command -> Int [caseSplitEnd] :: Command -> Int [caseSplitAnnotations] :: Command -> WildcardAnnotations [caseSplitType] :: Command -> Text AddClause :: Text -> WildcardAnnotations -> Command [addClauseLine] :: Command -> Text [addClauseAnnotations] :: Command -> WildcardAnnotations Import :: FilePath -> (Maybe FilePath) -> [Filter] -> ImportCommand -> Command List :: ListType -> Command [listType] :: Command -> ListType -- | Rebuild the specified file using the loaded externs Rebuild :: FilePath -> Command Cwd :: Command Quit :: Command data ImportCommand AddImplicitImport :: ModuleName -> ImportCommand AddImportForIdentifier :: DeclIdent -> ImportCommand data ListType LoadedModules :: ListType Imports :: FilePath -> ListType AvailableModules :: ListType instance GHC.Classes.Eq Language.PureScript.Ide.Command.ImportCommand instance GHC.Show.Show Language.PureScript.Ide.Command.ImportCommand instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Ide.Command.ImportCommand instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Ide.Command.ListType instance Data.Aeson.Types.Class.FromJSON Language.PureScript.Ide.Command.Command module Language.PureScript.Ide.Completion -- | Applies the CompletionFilters and the Matcher to the given Modules and -- sorts the found Completions according to the Matching Score getCompletions :: [Filter] -> Matcher -> [Module] -> [Match] getExactMatches :: DeclIdent -> [Filter] -> [Module] -> [Match] -- | Provides functionality to manage imports module Language.PureScript.Ide.Imports -- | Adds an implicit import like import Prelude to a Sourcefile. addImplicitImport :: (MonadIO m, MonadError PscIdeError m) => FilePath -> ModuleName -> m [Text] -- | Looks up the given identifier in the currently loaded modules. -- -- addImportForIdentifier :: (PscIde m, MonadError PscIdeError m, MonadLogger m) => FilePath -> Text -> [Filter] -> m (Either [Match] [Text]) -- | Writes a list of lines to Just filepath and responds with a -- TextResult, or returns the lines as a -- MultilineTextResult if Nothing was given as the -- first argument. answerRequest :: (MonadIO m) => Maybe FilePath -> [Text] -> m Success -- | Test and ghci helper parseImport :: Text -> Maybe Import prettyPrintImportSection :: [Import] -> [Text] addImplicitImport' :: [Import] -> ModuleName -> [Text] addExplicitImport' :: ExternDecl -> ModuleName -> [Import] -> [Import] sliceImportSection :: [Text] -> Either String (ModuleName, [Text], [Import], [Text]) prettyPrintImport' :: Import -> Text data Import Import :: ModuleName -> ImportDeclarationType -> (Maybe ModuleName) -> Import instance GHC.Show.Show Language.PureScript.Ide.Imports.Import instance GHC.Classes.Eq Language.PureScript.Ide.Imports.Import instance GHC.Classes.Ord Language.PureScript.Ide.Imports.Import -- | Interface for the psc-ide-server module Language.PureScript.Ide handleCommand :: (PscIde m, MonadLogger m, MonadError PscIdeError m) => Command -> m Success printModules :: (PscIde m) => m Success