-- 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.15.11 -- | 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) -- | 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) instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Supply.SupplyT m) instance GHC.Base.MonadPlus m => GHC.Base.Alternative (Control.Monad.Supply.SupplyT m) 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 peek :: MonadSupply m => m Integer fresh :: (MonadSupply m, MonadTrans t, MonadSupply n, m ~ t n) => m Integer peek :: (MonadSupply m, MonadTrans t, MonadSupply n, m ~ t n) => m Integer freshName :: MonadSupply m => m Text 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) instance (GHC.Base.Monoid w, Control.Monad.Supply.Class.MonadSupply m) => Control.Monad.Supply.Class.MonadSupply (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance (GHC.Base.Monoid w, Control.Monad.Supply.Class.MonadSupply m) => Control.Monad.Supply.Class.MonadSupply (Control.Monad.Trans.RWS.Lazy.RWST r w s m) -- | 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 -- | A module is identified by its module name and its type. data ModuleIdentifier ModuleIdentifier :: String -> ModuleType -> ModuleIdentifier -- | Modules are either "regular modules" (i.e. those generated by the -- PureScript compiler) 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 UnsupportedImport :: ErrorMessage UnsupportedExport :: ErrorMessage ErrorInModule :: ModuleIdentifier -> ErrorMessage -> ErrorMessage MissingEntryPoint :: String -> ErrorMessage MissingMainModule :: String -> ErrorMessage -- | Prepare an error message for consumption by humans. printErrorMessage :: ErrorMessage -> [String] data ForeignModuleExports ForeignModuleExports :: [String] -> [String] -> ForeignModuleExports [cjsExports] :: ForeignModuleExports -> [String] [esExports] :: ForeignModuleExports -> [String] getExportedIdentifiers :: forall m. MonadError ErrorMessage m => String -> JSAST -> m ForeignModuleExports data ForeignModuleImports ForeignModuleImports :: [String] -> [String] -> ForeignModuleImports [cjsImports] :: ForeignModuleImports -> [String] [esImports] :: ForeignModuleImports -> [String] getImportedModules :: forall m. MonadError ErrorMessage m => String -> JSAST -> m ForeignModuleImports -- | A module is just a list of elements of the types listed above. data Module instance GHC.Classes.Ord Language.PureScript.Bundle.ModuleType instance GHC.Classes.Eq Language.PureScript.Bundle.ModuleType instance GHC.Show.Show Language.PureScript.Bundle.ModuleType instance GHC.Classes.Ord Language.PureScript.Bundle.ModuleIdentifier instance GHC.Classes.Eq Language.PureScript.Bundle.ModuleIdentifier instance GHC.Show.Show Language.PureScript.Bundle.ModuleIdentifier instance GHC.Show.Show Language.PureScript.Bundle.ErrorMessage instance GHC.Classes.Ord Language.PureScript.Bundle.Visibility instance GHC.Classes.Eq Language.PureScript.Bundle.Visibility instance GHC.Show.Show Language.PureScript.Bundle.Visibility 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.Show.Show Language.PureScript.Bundle.ModuleElement instance GHC.Show.Show Language.PureScript.Bundle.Module instance GHC.Show.Show Language.PureScript.Bundle.ForeignModuleExports instance GHC.Show.Show Language.PureScript.Bundle.ForeignModuleImports instance GHC.Base.Semigroup Language.PureScript.Bundle.ForeignModuleImports instance GHC.Base.Monoid Language.PureScript.Bundle.ForeignModuleImports instance GHC.Base.Semigroup Language.PureScript.Bundle.ForeignModuleExports instance GHC.Base.Monoid Language.PureScript.Bundle.ForeignModuleExports instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Bundle.Module instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Bundle.ModuleElement instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Bundle.ModuleIdentifier -- | Defines the types of source code comments module Language.PureScript.Comments data Comment LineComment :: Text -> Comment BlockComment :: Text -> Comment instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Comments.Comment instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Comments.Comment instance GHC.Generics.Generic Language.PureScript.Comments.Comment instance GHC.Classes.Ord Language.PureScript.Comments.Comment instance GHC.Classes.Eq Language.PureScript.Comments.Comment instance GHC.Show.Show Language.PureScript.Comments.Comment instance Control.DeepSeq.NFData Language.PureScript.Comments.Comment instance Codec.Serialise.Class.Serialise Language.PureScript.Comments.Comment -- | Source position information module Language.PureScript.AST.SourcePos -- | Source annotation - position information and comments. type SourceAnn = (SourceSpan, [Comment]) -- | Source position information data SourcePos SourcePos :: Int -> Int -> SourcePos -- | Line number [sourcePosLine] :: SourcePos -> Int -- | Column number [sourcePosColumn] :: SourcePos -> Int displaySourcePos :: SourcePos -> Text displaySourcePosShort :: SourcePos -> Text data SourceSpan SourceSpan :: String -> SourcePos -> SourcePos -> SourceSpan -- | Source name [spanName] :: SourceSpan -> String -- | Start of the span [spanStart] :: SourceSpan -> SourcePos -- | End of the span [spanEnd] :: SourceSpan -> SourcePos displayStartEndPos :: SourceSpan -> Text displayStartEndPosShort :: SourceSpan -> Text displaySourceSpan :: FilePath -> SourceSpan -> Text internalModuleSourceSpan :: String -> SourceSpan nullSourceSpan :: SourceSpan nullSourceAnn :: SourceAnn pattern NullSourceSpan :: SourceSpan pattern NullSourceAnn :: SourceAnn nonEmptySpan :: SourceAnn -> Maybe SourceSpan widenSourceSpan :: SourceSpan -> SourceSpan -> SourceSpan widenSourceAnn :: SourceAnn -> SourceAnn -> SourceAnn instance Codec.Serialise.Class.Serialise Language.PureScript.AST.SourcePos.SourcePos instance Control.DeepSeq.NFData Language.PureScript.AST.SourcePos.SourcePos instance GHC.Generics.Generic Language.PureScript.AST.SourcePos.SourcePos instance GHC.Classes.Ord Language.PureScript.AST.SourcePos.SourcePos instance GHC.Classes.Eq Language.PureScript.AST.SourcePos.SourcePos instance GHC.Show.Show Language.PureScript.AST.SourcePos.SourcePos instance Codec.Serialise.Class.Serialise Language.PureScript.AST.SourcePos.SourceSpan instance Control.DeepSeq.NFData Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Generics.Generic Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Classes.Ord Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Classes.Eq Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Show.Show Language.PureScript.AST.SourcePos.SourceSpan instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.SourcePos.SourceSpan instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.SourcePos.SourceSpan instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.SourcePos.SourcePos instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.SourcePos.SourcePos module Language.PureScript.AST.Declarations.ChainId -- | For a given instance chain, stores the chain's file name and the -- starting source pos of the first instance in the chain. This data is -- used to determine which instances are part of the same instance chain. data ChainId mkChainId :: String -> SourcePos -> ChainId instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Declarations.ChainId.ChainId instance Control.DeepSeq.NFData Language.PureScript.AST.Declarations.ChainId.ChainId instance GHC.Show.Show Language.PureScript.AST.Declarations.ChainId.ChainId instance GHC.Classes.Ord Language.PureScript.AST.Declarations.ChainId.ChainId instance GHC.Classes.Eq Language.PureScript.AST.Declarations.ChainId.ChainId module Language.PureScript.Crash -- | Request a CallStack. -- -- NOTE: The implicit parameter ?callStack :: CallStack is an -- implementation detail and should not be considered part of the -- CallStack API, we may decide to change the implementation in -- the future. type HasCallStack = ?callStack :: CallStack -- | Exit with an error message and a crash report link. internalError :: HasCallStack => String -> a -- | 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.Generics.Generic Language.PureScript.AST.Operators.Associativity instance GHC.Classes.Ord Language.PureScript.AST.Operators.Associativity instance GHC.Classes.Eq Language.PureScript.AST.Operators.Associativity instance GHC.Show.Show Language.PureScript.AST.Operators.Associativity instance GHC.Generics.Generic Language.PureScript.AST.Operators.Fixity instance GHC.Classes.Ord Language.PureScript.AST.Operators.Fixity instance GHC.Classes.Eq Language.PureScript.AST.Operators.Fixity instance GHC.Show.Show Language.PureScript.AST.Operators.Fixity instance Control.DeepSeq.NFData Language.PureScript.AST.Operators.Fixity instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Operators.Fixity instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Operators.Fixity instance Control.DeepSeq.NFData Language.PureScript.AST.Operators.Associativity instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Operators.Associativity instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Operators.Associativity instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Operators.Associativity module Language.PureScript.Docs.Css -- | An embedded copy of normalize.css as a UTF-8 encoded ByteString; this -- should be included before pursuit.css in any HTML page using -- pursuit.css. normalizeCss :: ByteString -- | Like normalizeCss, but as a Text. normalizeCssT :: Text -- | CSS for use with generated HTML docs, as a UTF-8 encoded ByteString. pursuitCss :: ByteString -- | Like pursuitCss, but as a Text. pursuitCssT :: Text module Language.PureScript.Docs.Utils.MonoidExtras mintersperse :: Monoid m => m -> [m] -> m module Language.PureScript.Ide.Filter.Declaration data DeclarationType Value :: DeclarationType Type :: DeclarationType Synonym :: DeclarationType DataConstructor :: DeclarationType TypeClass :: DeclarationType ValueOperator :: DeclarationType TypeOperator :: DeclarationType Module :: DeclarationType instance GHC.Classes.Ord Language.PureScript.Ide.Filter.Declaration.DeclarationType instance GHC.Classes.Eq Language.PureScript.Ide.Filter.Declaration.DeclarationType instance GHC.Show.Show Language.PureScript.Ide.Filter.Declaration.DeclarationType instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Filter.Declaration.DeclarationType instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Ide.Filter.Declaration.DeclarationType module Language.PureScript.Interactive.IO -- | Locates the node executable. Checks for either nodejs or -- node. findNodeProcess :: IO (Either String String) readNodeProcessWithExitCode :: Maybe FilePath -> [String] -> String -> IO (Either String (ExitCode, String, String)) -- | Grabs the filename where the history is stored. getHistoryFilename :: IO FilePath -- | Data types for names module Language.PureScript.Names -- | A sum of the possible name types, useful for error and lint messages. data Name IdentName :: Ident -> Name ValOpName :: OpName 'ValueOpName -> Name TyName :: ProperName 'TypeName -> Name TyOpName :: OpName 'TypeOpName -> Name DctorName :: ProperName 'ConstructorName -> Name TyClassName :: ProperName 'ClassName -> Name ModName :: ModuleName -> Name getIdentName :: Name -> Maybe Ident getValOpName :: Name -> Maybe (OpName 'ValueOpName) getTypeName :: Name -> Maybe (ProperName 'TypeName) getTypeOpName :: Name -> Maybe (OpName 'TypeOpName) getDctorName :: Name -> Maybe (ProperName 'ConstructorName) getClassName :: Name -> Maybe (ProperName 'ClassName) -- | This type is meant to be extended with any new uses for idents that -- come along. Adding constructors to this type is cheaper than adding -- them to Ident because functions that match on Ident can -- ignore all InternalIdents with a single pattern, and thus don't -- have to change if a new InternalIdentData constructor is -- created. data InternalIdentData RuntimeLazyFactory :: InternalIdentData Lazy :: !Text -> InternalIdentData -- | Names for value identifiers data Ident -- | An alphanumeric identifier Ident :: Text -> Ident -- | A generated name for an identifier GenIdent :: Maybe Text -> Integer -> Ident -- | A generated name used only for type-checking UnusedIdent :: Ident -- | A generated name used only for internal transformations InternalIdent :: !InternalIdentData -> Ident unusedIdent :: Text runIdent :: Ident -> Text showIdent :: Ident -> Text freshIdent :: MonadSupply m => Text -> m Ident freshIdent' :: MonadSupply m => m Ident isPlainIdent :: Ident -> Bool -- | Operator alias names. newtype OpName (a :: OpNameType) OpName :: Text -> OpName (a :: OpNameType) [runOpName] :: OpName (a :: OpNameType) -> Text showOp :: OpName a -> Text -- | The closed set of operator alias types. data OpNameType ValueOpName :: OpNameType TypeOpName :: OpNameType AnyOpName :: OpNameType eraseOpName :: OpName a -> OpName 'AnyOpName coerceOpName :: OpName a -> OpName b -- | Proper names, i.e. capitalized names for e.g. module names, type//data -- constructors. newtype ProperName (a :: ProperNameType) ProperName :: Text -> ProperName (a :: ProperNameType) [runProperName] :: ProperName (a :: ProperNameType) -> Text -- | 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 :: Text -> ModuleName runModuleName :: ModuleName -> Text moduleNameFromString :: Text -> ModuleName isBuiltinModuleName :: ModuleName -> Bool data QualifiedBy BySourcePos :: SourcePos -> QualifiedBy ByModuleName :: ModuleName -> QualifiedBy pattern ByNullSourcePos :: QualifiedBy isBySourcePos :: QualifiedBy -> Bool byMaybeModuleName :: Maybe ModuleName -> QualifiedBy toMaybeModuleName :: QualifiedBy -> Maybe ModuleName -- | A qualified name, i.e. a name with an optional module name data Qualified a Qualified :: QualifiedBy -> a -> Qualified a showQualified :: (a -> Text) -> Qualified a -> Text getQual :: Qualified a -> Maybe ModuleName -- | 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 -- | Remove the qualification from a value when it is qualified with a -- particular module name. disqualifyFor :: Maybe ModuleName -> Qualified a -> Maybe 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.ToJSON.ToJSON Language.PureScript.Names.Ident instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Names.Ident instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Names.InternalIdentData instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Names.InternalIdentData instance GHC.Generics.Generic Language.PureScript.Names.InternalIdentData instance GHC.Classes.Ord Language.PureScript.Names.InternalIdentData instance GHC.Classes.Eq Language.PureScript.Names.InternalIdentData instance GHC.Show.Show Language.PureScript.Names.InternalIdentData instance GHC.Generics.Generic Language.PureScript.Names.Ident instance GHC.Classes.Ord Language.PureScript.Names.Ident instance GHC.Classes.Eq Language.PureScript.Names.Ident instance GHC.Show.Show Language.PureScript.Names.Ident instance GHC.Generics.Generic (Language.PureScript.Names.OpName a) instance GHC.Classes.Ord (Language.PureScript.Names.OpName a) instance GHC.Classes.Eq (Language.PureScript.Names.OpName a) instance GHC.Show.Show (Language.PureScript.Names.OpName a) instance GHC.Generics.Generic (Language.PureScript.Names.ProperName a) instance GHC.Classes.Ord (Language.PureScript.Names.ProperName a) instance GHC.Classes.Eq (Language.PureScript.Names.ProperName a) instance GHC.Show.Show (Language.PureScript.Names.ProperName a) instance Codec.Serialise.Class.Serialise Language.PureScript.Names.ModuleName instance GHC.Generics.Generic Language.PureScript.Names.ModuleName instance GHC.Classes.Ord Language.PureScript.Names.ModuleName instance GHC.Classes.Eq Language.PureScript.Names.ModuleName instance GHC.Show.Show Language.PureScript.Names.ModuleName instance GHC.Generics.Generic Language.PureScript.Names.Name instance GHC.Show.Show Language.PureScript.Names.Name instance GHC.Classes.Ord Language.PureScript.Names.Name instance GHC.Classes.Eq Language.PureScript.Names.Name instance GHC.Generics.Generic Language.PureScript.Names.QualifiedBy instance GHC.Classes.Ord Language.PureScript.Names.QualifiedBy instance GHC.Classes.Eq Language.PureScript.Names.QualifiedBy instance GHC.Show.Show Language.PureScript.Names.QualifiedBy instance GHC.Generics.Generic (Language.PureScript.Names.Qualified a) instance Data.Traversable.Traversable Language.PureScript.Names.Qualified instance Data.Foldable.Foldable Language.PureScript.Names.Qualified 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.Show.Show a => GHC.Show.Show (Language.PureScript.Names.Qualified a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Names.Qualified a) instance Codec.Serialise.Class.Serialise a => Codec.Serialise.Class.Serialise (Language.PureScript.Names.Qualified a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Names.Qualified a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Names.Qualified a) instance Control.DeepSeq.NFData Language.PureScript.Names.QualifiedBy instance Codec.Serialise.Class.Serialise Language.PureScript.Names.QualifiedBy instance Control.DeepSeq.NFData Language.PureScript.Names.Name instance Codec.Serialise.Class.Serialise Language.PureScript.Names.Name instance Control.DeepSeq.NFData Language.PureScript.Names.ModuleName instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Names.ModuleName instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Names.ModuleName instance Data.Aeson.Types.ToJSON.ToJSONKey Language.PureScript.Names.ModuleName instance Data.Aeson.Types.FromJSON.FromJSONKey Language.PureScript.Names.ModuleName instance Control.DeepSeq.NFData (Language.PureScript.Names.ProperName a) instance Codec.Serialise.Class.Serialise (Language.PureScript.Names.ProperName a) instance Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Names.ProperName a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Names.ProperName a) instance Control.DeepSeq.NFData (Language.PureScript.Names.OpName a) instance Codec.Serialise.Class.Serialise (Language.PureScript.Names.OpName a) instance Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Names.OpName a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Names.OpName a) instance Control.DeepSeq.NFData Language.PureScript.Names.Ident instance Codec.Serialise.Class.Serialise Language.PureScript.Names.Ident instance Control.DeepSeq.NFData Language.PureScript.Names.InternalIdentData instance Codec.Serialise.Class.Serialise Language.PureScript.Names.InternalIdentData module Language.PureScript.Make.Cache -- | Defines the hash algorithm we use for cache invalidation of input -- files. data ContentHash hash :: ByteString -> ContentHash type CacheDb = Map ModuleName CacheInfo -- | A CacheInfo contains all of the information we need to store about a -- particular module in the cache database. newtype CacheInfo CacheInfo :: Map FilePath (UTCTime, ContentHash) -> CacheInfo [unCacheInfo] :: CacheInfo -> Map FilePath (UTCTime, ContentHash) -- | Given a module name, and a map containing the associated input files -- together with current metadata i.e. timestamps and hashes, check -- whether the input files have changed, based on comparing with the -- database stored in the monadic state. -- -- The CacheInfo in the return value should be stored in the cache for -- future builds. -- -- The Bool in the return value indicates whether it is safe to use -- existing build artifacts for this module, at least based on the -- timestamps and hashes of the module's input files. -- -- If the timestamps are the same as those in the database, assume the -- file is unchanged, and return True without checking hashes. -- -- If any of the timestamps differ from what is in the database, check -- the hashes of those files. In this case, update the database with any -- changed timestamps and hashes, and return True if and only if all of -- the hashes are unchanged. checkChanged :: Monad m => CacheDb -> ModuleName -> FilePath -> Map FilePath (UTCTime, m ContentHash) -> m (CacheInfo, Bool) -- | Remove any modules from the given set from the cache database; used -- when they failed to build. removeModules :: Set ModuleName -> CacheDb -> CacheDb -- |
    --
  1. Any path that is beneath our current working directory will be -- stored as a normalised relative path
  2. --
  3. Any path that isn't will be stored as an absolute path
  4. --
normaliseForCache :: FilePath -> FilePath -> FilePath instance GHC.Classes.Ord Language.PureScript.Make.Cache.ContentHash instance GHC.Classes.Eq Language.PureScript.Make.Cache.ContentHash instance GHC.Show.Show Language.PureScript.Make.Cache.ContentHash instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Make.Cache.CacheInfo instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Make.Cache.CacheInfo instance GHC.Base.Monoid Language.PureScript.Make.Cache.CacheInfo instance GHC.Base.Semigroup Language.PureScript.Make.Cache.CacheInfo instance GHC.Classes.Ord Language.PureScript.Make.Cache.CacheInfo instance GHC.Classes.Eq Language.PureScript.Make.Cache.CacheInfo instance GHC.Show.Show Language.PureScript.Make.Cache.CacheInfo instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Make.Cache.ContentHash instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Make.Cache.ContentHash -- | 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 -- | The contained value is a where clause IsWhere :: Meta -- | The contained function application was synthesized by the compiler IsSyntheticApp :: Meta -- | Data constructor metadata data ConstructorType -- | The constructor is for a type with a single constructor ProductType :: ConstructorType -- | The constructor is for a type with multiple constructors SumType :: ConstructorType instance GHC.Classes.Ord Language.PureScript.CoreFn.Meta.ConstructorType instance GHC.Classes.Eq Language.PureScript.CoreFn.Meta.ConstructorType instance GHC.Show.Show Language.PureScript.CoreFn.Meta.ConstructorType instance GHC.Classes.Ord Language.PureScript.CoreFn.Meta.Meta instance GHC.Classes.Eq Language.PureScript.CoreFn.Meta.Meta instance GHC.Show.Show Language.PureScript.CoreFn.Meta.Meta module Language.PureScript.CoreFn.Ann -- | Type alias for basic annotations type Ann = (SourceSpan, [Comment], Maybe Meta) -- | An annotation empty of metadata aside from a source span. ssAnn :: SourceSpan -> Ann -- | Remove the comments from an annotation removeComments :: Ann -> Ann -- | Various constants which refer to things in Prim module Language.PureScript.Constants.Prim pattern Text :: Qualified (ProperName 'TypeName) pattern QuoteLabel :: Qualified (ProperName 'TypeName) pattern Quote :: Qualified (ProperName 'TypeName) pattern Doc :: Qualified (ProperName 'TypeName) pattern Beside :: Qualified (ProperName 'TypeName) pattern Above :: Qualified (ProperName 'TypeName) pattern Warn :: Qualified (ProperName 'ClassName) pattern Fail :: Qualified (ProperName 'ClassName) pattern M_Prim_TypeError :: ModuleName pattern SymbolCons :: Qualified (ProperName 'ClassName) pattern SymbolCompare :: Qualified (ProperName 'ClassName) pattern SymbolAppend :: Qualified (ProperName 'ClassName) pattern M_Prim_Symbol :: ModuleName pattern RowListNil :: Qualified (ProperName 'TypeName) pattern RowListCons :: Qualified (ProperName 'TypeName) pattern RowToList :: Qualified (ProperName 'ClassName) pattern RowList :: Qualified (ProperName 'TypeName) pattern M_Prim_RowList :: ModuleName pattern RowUnion :: Qualified (ProperName 'ClassName) pattern RowNub :: Qualified (ProperName 'ClassName) pattern RowLacks :: Qualified (ProperName 'ClassName) pattern RowCons :: Qualified (ProperName 'ClassName) pattern M_Prim_Row :: ModuleName pattern LT :: Qualified (ProperName 'TypeName) pattern GT :: Qualified (ProperName 'TypeName) pattern EQ :: Qualified (ProperName 'TypeName) pattern TypeOrdering :: Qualified (ProperName 'TypeName) pattern M_Prim_Ordering :: ModuleName pattern IntToString :: Qualified (ProperName 'ClassName) pattern IntMul :: Qualified (ProperName 'ClassName) pattern IntCompare :: Qualified (ProperName 'ClassName) pattern IntAdd :: Qualified (ProperName 'ClassName) pattern M_Prim_Int :: ModuleName pattern Coercible :: Qualified (ProperName 'ClassName) pattern M_Prim_Coerce :: ModuleName pattern True :: Qualified (ProperName 'TypeName) pattern False :: Qualified (ProperName 'TypeName) pattern M_Prim_Boolean :: ModuleName pattern I_undefined :: Qualified Ident pattern S_undefined :: forall a_aXYK. (Eq a_aXYK, IsString a_aXYK) => a_aXYK pattern Type :: Qualified (ProperName 'TypeName) pattern Symbol :: Qualified (ProperName 'TypeName) pattern String :: Qualified (ProperName 'TypeName) pattern Row :: Qualified (ProperName 'TypeName) pattern Record :: Qualified (ProperName 'TypeName) pattern Number :: Qualified (ProperName 'TypeName) pattern Int :: Qualified (ProperName 'TypeName) pattern Function :: Qualified (ProperName 'TypeName) pattern Constraint :: Qualified (ProperName 'TypeName) pattern Char :: Qualified (ProperName 'TypeName) pattern Boolean :: Qualified (ProperName 'TypeName) pattern Array :: Qualified (ProperName 'TypeName) pattern Partial :: Qualified (ProperName 'ClassName) pattern M_Prim :: ModuleName primModules :: [ModuleName] -- | Common code generation utility functions module Language.PureScript.CodeGen.JS.Common moduleNameToJs :: ModuleName -> Text -- | Convert an Ident into a valid JavaScript identifier: -- -- identToJs :: Ident -> Text -- | Convert a ProperName into a valid JavaScript identifier: -- -- properToJs :: ProperName a -> Text -- | Convert any name into a valid JavaScript identifier. -- -- Note that this function assumes that the argument is a valid -- PureScript identifier (either an Ident or a ProperName) -- to begin with; as such it will not produce valid JavaScript -- identifiers if the argument e.g. begins with a digit. Prefer -- identToJs or properToJs where possible. anyNameToJs :: Text -> Text -- | Test if a string is a valid JavaScript identifier as-is. Note that, -- while a return value of True guarantees that the string is a -- valid JS identifier, a return value of False does not guarantee -- that the string is not a valid JS identifier. That is, this check is -- more conservative than absolutely necessary. isValidJsIdentifier :: Text -> Bool -- | Attempts to find a human-readable name for a symbol, if none has been -- specified returns the ordinal value. identCharToText :: Char -> Text -- | Checks whether an identifier name is reserved in JavaScript. nameIsJsReserved :: Text -> Bool -- | Checks whether a name matches a built-in value in JavaScript. nameIsJsBuiltIn :: Text -> Bool jsAnyReserved :: [Text] jsKeywords :: [Text] jsSometimesReserved :: [Text] jsFutureReserved :: [Text] jsFutureReservedStrict :: [Text] jsOldReserved :: [Text] jsLiterals :: [Text] -- | The data type of compiler options module Language.PureScript.Options -- | The data type of compiler options data Options Options :: Bool -> Bool -> Set CodegenTarget -> Options -- | Verbose error message [optionsVerboseErrors] :: Options -> Bool -- | Remove the comments from the generated js [optionsNoComments] :: Options -> Bool -- | Codegen targets (JS, CoreFn, etc.) [optionsCodegenTargets] :: Options -> Set CodegenTarget defaultOptions :: Options data CodegenTarget JS :: CodegenTarget JSSourceMap :: CodegenTarget CoreFn :: CodegenTarget Docs :: CodegenTarget codegenTargets :: Map String CodegenTarget instance GHC.Show.Show Language.PureScript.Options.CodegenTarget instance GHC.Classes.Ord Language.PureScript.Options.CodegenTarget instance GHC.Classes.Eq Language.PureScript.Options.CodegenTarget instance GHC.Show.Show Language.PureScript.Options.Options module Language.PureScript.PSString -- | Strings in PureScript are sequences of UTF-16 code units, which do not -- necessarily represent UTF-16 encoded text. For example, it is -- permissible for a string to contain *lone surrogates,* i.e. characters -- in the range U+D800 to U+DFFF which do not appear as a part of a -- surrogate pair. -- -- The Show instance for PSString produces a string literal which would -- represent the same data were it inserted into a PureScript source -- file. -- -- Because JSON parsers vary wildly in terms of how they deal with lone -- surrogates in JSON strings, the ToJSON instance for PSString produces -- JSON strings where that would be safe (i.e. when there are no lone -- surrogates), and arrays of UTF-16 code units (integers) otherwise. data PSString toUTF16CodeUnits :: PSString -> [Word16] -- | Attempt to decode a PSString as UTF-16 text. This will fail (returning -- Nothing) if the argument contains lone surrogates. decodeString :: PSString -> Maybe Text -- | Decode a PSString as UTF-16. Lone surrogates in the input are -- represented in the output with the Left constructor; characters which -- were successfully decoded are represented with the Right constructor. decodeStringEither :: PSString -> [Either Word16 Char] -- | Decode a PSString as UTF-16 text. Lone surrogates will be replaced -- with U+FFFD REPLACEMENT CHARACTER decodeStringWithReplacement :: PSString -> String -- | Pretty print a PSString, using PureScript escape sequences. prettyPrintString :: PSString -> Text -- | Pretty print a PSString, using JavaScript escape sequences. Intended -- for use in compiled JS output. prettyPrintStringJS :: PSString -> Text mkString :: Text -> PSString instance GHC.Generics.Generic Language.PureScript.PSString.PSString instance GHC.Base.Monoid Language.PureScript.PSString.PSString instance GHC.Base.Semigroup Language.PureScript.PSString.PSString instance GHC.Classes.Ord Language.PureScript.PSString.PSString instance GHC.Classes.Eq Language.PureScript.PSString.PSString instance Control.DeepSeq.NFData Language.PureScript.PSString.PSString instance Codec.Serialise.Class.Serialise Language.PureScript.PSString.PSString instance GHC.Show.Show Language.PureScript.PSString.PSString instance Data.String.IsString Language.PureScript.PSString.PSString instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.PSString.PSString instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.PSString.PSString module Language.PureScript.Label -- | Labels are used as record keys and row entry names. Labels newtype -- PSString because records are indexable by PureScript strings at -- runtime. newtype Label Label :: PSString -> Label [runLabel] :: Label -> PSString instance GHC.Generics.Generic Language.PureScript.Label.Label instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Label.Label instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Label.Label instance GHC.Base.Monoid Language.PureScript.Label.Label instance GHC.Base.Semigroup Language.PureScript.Label.Label instance Data.String.IsString Language.PureScript.Label.Label instance GHC.Classes.Ord Language.PureScript.Label.Label instance GHC.Classes.Eq Language.PureScript.Label.Label instance GHC.Show.Show Language.PureScript.Label.Label instance Control.DeepSeq.NFData Language.PureScript.Label.Label instance Codec.Serialise.Class.Serialise Language.PureScript.Label.Label -- | Various constants which refer to things in the Prelude and other core -- libraries module Language.PureScript.Constants.Libs stRefValue :: forall a. IsString a => a data EffectDictionaries EffectDictionaries :: PSString -> PSString -> PSString -> PSString -> PSString -> EffectDictionaries [edApplicativeDict] :: EffectDictionaries -> PSString [edBindDict] :: EffectDictionaries -> PSString [edMonadDict] :: EffectDictionaries -> PSString [edWhile] :: EffectDictionaries -> PSString [edUntil] :: EffectDictionaries -> PSString effDictionaries :: EffectDictionaries effectDictionaries :: EffectDictionaries stDictionaries :: EffectDictionaries pattern P_unsafeCoerce :: forall a_a1aDa. (Eq a_a1aDa, IsString a_a1aDa) => (ModuleName, a_a1aDa) pattern M_Unsafe_Coerce :: ModuleName pattern P_runSTFn :: forall a_a1aD9. (Eq a_a1aD9, IsString a_a1aD9) => (ModuleName, a_a1aD9) pattern P_mkSTFn :: forall a_a1aD8. (Eq a_a1aD8, IsString a_a1aD8) => (ModuleName, a_a1aD8) pattern M_Control_Monad_ST_Uncurried :: ModuleName pattern P_write :: forall a_a1aD7. (Eq a_a1aD7, IsString a_a1aD7) => (ModuleName, a_a1aD7) pattern P_run :: forall a_a1aD6. (Eq a_a1aD6, IsString a_a1aD6) => (ModuleName, a_a1aD6) pattern P_read :: forall a_a1aD5. (Eq a_a1aD5, IsString a_a1aD5) => (ModuleName, a_a1aD5) pattern P_new :: forall a_a1aD4. (Eq a_a1aD4, IsString a_a1aD4) => (ModuleName, a_a1aD4) pattern P_modify :: forall a_a1aD3. (Eq a_a1aD3, IsString a_a1aD3) => (ModuleName, a_a1aD3) pattern M_Control_Monad_ST_Internal :: ModuleName pattern I_profunctorRmap :: Qualified Ident pattern I_lcmap :: Qualified Ident pattern I_dimap :: Qualified Ident pattern S_dimap :: forall a_a1aD2. (Eq a_a1aD2, IsString a_a1aD2) => a_a1aD2 pattern Profunctor :: Qualified (ProperName 'ClassName) pattern M_Data_Profunctor :: ModuleName pattern I_unsafePartial :: Qualified Ident pattern P_unsafePartial :: forall a_a1aD1. (Eq a_a1aD1, IsString a_a1aD1) => (ModuleName, a_a1aD1) pattern M_Partial_Unsafe :: ModuleName pattern Newtype :: Qualified (ProperName 'ClassName) pattern M_Data_Newtype :: ModuleName pattern P_zshr :: forall a_a1aD0. (Eq a_a1aD0, IsString a_a1aD0) => (ModuleName, a_a1aD0) pattern P_xor :: forall a_a1aCZ. (Eq a_a1aCZ, IsString a_a1aCZ) => (ModuleName, a_a1aCZ) pattern P_shr :: forall a_a1aCY. (Eq a_a1aCY, IsString a_a1aCY) => (ModuleName, a_a1aCY) pattern P_shl :: forall a_a1aCX. (Eq a_a1aCX, IsString a_a1aCX) => (ModuleName, a_a1aCX) pattern P_or :: forall a_a1aCW. (Eq a_a1aCW, IsString a_a1aCW) => (ModuleName, a_a1aCW) pattern P_complement :: forall a_a1aCV. (Eq a_a1aCV, IsString a_a1aCV) => (ModuleName, a_a1aCV) pattern P_and :: forall a_a1aCU. (Eq a_a1aCU, IsString a_a1aCU) => (ModuleName, a_a1aCU) pattern M_Data_Int_Bits :: ModuleName pattern P_runFn :: forall a_a1aCT. (Eq a_a1aCT, IsString a_a1aCT) => (ModuleName, a_a1aCT) pattern S_runFn :: forall a_a1aCS. (Eq a_a1aCS, IsString a_a1aCS) => a_a1aCS pattern P_mkFn :: forall a_a1aCR. (Eq a_a1aCR, IsString a_a1aCR) => (ModuleName, a_a1aCR) pattern S_mkFn :: forall a_a1aCQ. (Eq a_a1aCQ, IsString a_a1aCQ) => a_a1aCQ pattern M_Data_Function_Uncurried :: ModuleName pattern S_sequence :: forall a_a1aCP. (Eq a_a1aCP, IsString a_a1aCP) => a_a1aCP pattern S_traverse :: forall a_a1aCO. (Eq a_a1aCO, IsString a_a1aCO) => a_a1aCO pattern I_traverse :: Qualified Ident pattern Traversable :: Qualified (ProperName 'ClassName) pattern M_Data_Traversable :: ModuleName pattern I_foldr :: Qualified Ident pattern S_foldr :: forall a_a1aCN. (Eq a_a1aCN, IsString a_a1aCN) => a_a1aCN pattern I_foldl :: Qualified Ident pattern S_foldl :: forall a_a1aCM. (Eq a_a1aCM, IsString a_a1aCM) => a_a1aCM pattern I_foldMap :: Qualified Ident pattern S_foldMap :: forall a_a1aCL. (Eq a_a1aCL, IsString a_a1aCL) => a_a1aCL pattern Foldable :: Qualified (ProperName 'ClassName) pattern M_Data_Foldable :: ModuleName pattern I_rtraverse :: Qualified Ident pattern I_ltraverse :: Qualified Ident pattern S_bisequence :: forall a_a1aCK. (Eq a_a1aCK, IsString a_a1aCK) => a_a1aCK pattern S_bitraverse :: forall a_a1aCJ. (Eq a_a1aCJ, IsString a_a1aCJ) => a_a1aCJ pattern I_bitraverse :: Qualified Ident pattern Bitraversable :: Qualified (ProperName 'ClassName) pattern M_Data_Bitraversable :: ModuleName pattern I_bifoldr :: Qualified Ident pattern S_bifoldr :: forall a_a1aCI. (Eq a_a1aCI, IsString a_a1aCI) => a_a1aCI pattern I_bifoldl :: Qualified Ident pattern S_bifoldl :: forall a_a1aCH. (Eq a_a1aCH, IsString a_a1aCH) => a_a1aCH pattern I_bifoldMap :: Qualified Ident pattern S_bifoldMap :: forall a_a1aCG. (Eq a_a1aCG, IsString a_a1aCG) => a_a1aCG pattern Bifoldable :: Qualified (ProperName 'ClassName) pattern M_Data_Bifoldable :: ModuleName pattern P_runEffectFn :: forall a_a1aCF. (Eq a_a1aCF, IsString a_a1aCF) => (ModuleName, a_a1aCF) pattern P_mkEffectFn :: forall a_a1aCE. (Eq a_a1aCE, IsString a_a1aCE) => (ModuleName, a_a1aCE) pattern M_Effect_Uncurried :: ModuleName pattern M_Effect :: ModuleName pattern P_runEffFn :: forall a_a1aCD. (Eq a_a1aCD, IsString a_a1aCD) => (ModuleName, a_a1aCD) pattern P_mkEffFn :: forall a_a1aCC. (Eq a_a1aCC, IsString a_a1aCC) => (ModuleName, a_a1aCC) pattern M_Control_Monad_Eff_Uncurried :: ModuleName pattern M_Control_Monad_Eff :: ModuleName pattern I_cmap :: Qualified Ident pattern S_cmap :: forall a_a1aCB. (Eq a_a1aCB, IsString a_a1aCB) => a_a1aCB pattern Contravariant :: Qualified (ProperName 'ClassName) pattern M_Data_Functor_Contravariant :: ModuleName pattern I_rmap :: Qualified Ident pattern I_lmap :: Qualified Ident pattern I_bimap :: Qualified Ident pattern S_bimap :: forall a_a1aCA. (Eq a_a1aCA, IsString a_a1aCA) => a_a1aCA pattern Bifunctor :: Qualified (ProperName 'ClassName) pattern M_Data_Bifunctor :: ModuleName pattern P_unsafeIndex :: forall a_a1aCz. (Eq a_a1aCz, IsString a_a1aCz) => (ModuleName, a_a1aCz) pattern M_Data_Array :: ModuleName pattern IsSymbol :: Qualified (ProperName 'ClassName) pattern M_Data_Symbol :: ModuleName pattern P_semiringNumber :: forall a_a1aCy. (Eq a_a1aCy, IsString a_a1aCy) => (ModuleName, a_a1aCy) pattern P_semiringInt :: forall a_a1aCx. (Eq a_a1aCx, IsString a_a1aCx) => (ModuleName, a_a1aCx) pattern P_zero :: forall a_a1aCw. (Eq a_a1aCw, IsString a_a1aCw) => (ModuleName, a_a1aCw) pattern P_one :: forall a_a1aCv. (Eq a_a1aCv, IsString a_a1aCv) => (ModuleName, a_a1aCv) pattern P_mul :: forall a_a1aCu. (Eq a_a1aCu, IsString a_a1aCu) => (ModuleName, a_a1aCu) pattern P_add :: forall a_a1aCt. (Eq a_a1aCt, IsString a_a1aCt) => (ModuleName, a_a1aCt) pattern M_Data_Semiring :: ModuleName pattern P_semigroupString :: forall a_a1aCs. (Eq a_a1aCs, IsString a_a1aCs) => (ModuleName, a_a1aCs) pattern P_append :: forall a_a1aCr. (Eq a_a1aCr, IsString a_a1aCr) => (ModuleName, a_a1aCr) pattern I_append :: Qualified Ident pattern M_Data_Semigroup :: ModuleName pattern P_ringNumber :: forall a_a1aCq. (Eq a_a1aCq, IsString a_a1aCq) => (ModuleName, a_a1aCq) pattern P_ringInt :: forall a_a1aCp. (Eq a_a1aCp, IsString a_a1aCp) => (ModuleName, a_a1aCp) pattern P_sub :: forall a_a1aCo. (Eq a_a1aCo, IsString a_a1aCo) => (ModuleName, a_a1aCo) pattern S_sub :: forall a_a1aCn. (Eq a_a1aCn, IsString a_a1aCn) => a_a1aCn pattern P_negate :: forall a_a1aCm. (Eq a_a1aCm, IsString a_a1aCm) => (ModuleName, a_a1aCm) pattern S_negate :: forall a_a1aCl. (Eq a_a1aCl, IsString a_a1aCl) => a_a1aCl pattern M_Data_Ring :: ModuleName pattern Reflectable :: Qualified (ProperName 'ClassName) pattern M_Data_Reflectable :: ModuleName pattern C_LT :: Qualified (ProperName 'ConstructorName) pattern C_GT :: Qualified (ProperName 'ConstructorName) pattern C_EQ :: Qualified (ProperName 'ConstructorName) pattern Ordering :: Qualified (ProperName 'TypeName) pattern M_Data_Ordering :: ModuleName pattern P_ordString :: forall a_a1aCk. (Eq a_a1aCk, IsString a_a1aCk) => (ModuleName, a_a1aCk) pattern P_ordNumber :: forall a_a1aCj. (Eq a_a1aCj, IsString a_a1aCj) => (ModuleName, a_a1aCj) pattern P_ordInt :: forall a_a1aCi. (Eq a_a1aCi, IsString a_a1aCi) => (ModuleName, a_a1aCi) pattern P_ordChar :: forall a_a1aCh. (Eq a_a1aCh, IsString a_a1aCh) => (ModuleName, a_a1aCh) pattern P_ordBoolean :: forall a_a1aCg. (Eq a_a1aCg, IsString a_a1aCg) => (ModuleName, a_a1aCg) pattern P_lessThanOrEq :: forall a_a1aCf. (Eq a_a1aCf, IsString a_a1aCf) => (ModuleName, a_a1aCf) pattern P_lessThan :: forall a_a1aCe. (Eq a_a1aCe, IsString a_a1aCe) => (ModuleName, a_a1aCe) pattern P_greaterThanOrEq :: forall a_a1aCd. (Eq a_a1aCd, IsString a_a1aCd) => (ModuleName, a_a1aCd) pattern P_greaterThan :: forall a_a1aCc. (Eq a_a1aCc, IsString a_a1aCc) => (ModuleName, a_a1aCc) pattern I_compare1 :: Qualified Ident pattern S_compare1 :: forall a_a1aCb. (Eq a_a1aCb, IsString a_a1aCb) => a_a1aCb pattern Ord1 :: Qualified (ProperName 'ClassName) pattern I_compare :: Qualified Ident pattern S_compare :: forall a_a1aCa. (Eq a_a1aCa, IsString a_a1aCa) => a_a1aCa pattern Ord :: Qualified (ProperName 'ClassName) pattern M_Data_Ord :: ModuleName pattern I_mempty :: Qualified Ident pattern M_Data_Monoid :: ModuleName pattern P_heytingAlgebraBoolean :: forall a_a1aC9. (Eq a_a1aC9, IsString a_a1aC9) => (ModuleName, a_a1aC9) pattern P_not :: forall a_a1aC8. (Eq a_a1aC8, IsString a_a1aC8) => (ModuleName, a_a1aC8) pattern I_not :: Qualified Ident pattern P_disj :: forall a_a1aC7. (Eq a_a1aC7, IsString a_a1aC7) => (ModuleName, a_a1aC7) pattern I_disj :: Qualified Ident pattern P_conj :: forall a_a1aC6. (Eq a_a1aC6, IsString a_a1aC6) => (ModuleName, a_a1aC6) pattern I_conj :: Qualified Ident pattern M_Data_HeytingAlgebra :: ModuleName pattern C_Inr :: Qualified (ProperName 'ConstructorName) pattern C_Inl :: Qualified (ProperName 'ConstructorName) pattern Sum :: Qualified (ProperName 'TypeName) pattern C_Product :: Qualified (ProperName 'ConstructorName) pattern Product :: Qualified (ProperName 'TypeName) pattern C_NoConstructors :: Qualified (ProperName 'ConstructorName) pattern NoConstructors :: Qualified (ProperName 'TypeName) pattern C_NoArguments :: Qualified (ProperName 'ConstructorName) pattern NoArguments :: Qualified (ProperName 'TypeName) pattern C_Constructor :: Qualified (ProperName 'ConstructorName) pattern Constructor :: Qualified (ProperName 'TypeName) pattern C_Argument :: Qualified (ProperName 'ConstructorName) pattern Argument :: Qualified (ProperName 'TypeName) pattern I_to :: Qualified Ident pattern I_from :: Qualified Ident pattern Generic :: Qualified (ProperName 'ClassName) pattern M_Data_Generic_Rep :: ModuleName pattern I_map :: Qualified Ident pattern S_map :: forall a_a1aC5. (Eq a_a1aC5, IsString a_a1aC5) => a_a1aC5 pattern Functor :: Qualified (ProperName 'ClassName) pattern M_Data_Functor :: ModuleName pattern I_flip :: Qualified Ident pattern I_const :: Qualified Ident pattern I_functionApplyFlipped :: Qualified Ident pattern I_functionApply :: Qualified Ident pattern M_Data_Function :: ModuleName pattern P_euclideanRingNumber :: forall a_a1aC4. (Eq a_a1aC4, IsString a_a1aC4) => (ModuleName, a_a1aC4) pattern P_div :: forall a_a1aC3. (Eq a_a1aC3, IsString a_a1aC3) => (ModuleName, a_a1aC3) pattern M_Data_EuclideanRing :: ModuleName pattern P_eqString :: forall a_a1aC2. (Eq a_a1aC2, IsString a_a1aC2) => (ModuleName, a_a1aC2) pattern P_eqNumber :: forall a_a1aC1. (Eq a_a1aC1, IsString a_a1aC1) => (ModuleName, a_a1aC1) pattern P_eqInt :: forall a_a1aC0. (Eq a_a1aC0, IsString a_a1aC0) => (ModuleName, a_a1aC0) pattern P_eqChar :: forall a_a1aBZ. (Eq a_a1aBZ, IsString a_a1aBZ) => (ModuleName, a_a1aBZ) pattern P_eqBoolean :: forall a_a1aBY. (Eq a_a1aBY, IsString a_a1aBY) => (ModuleName, a_a1aBY) pattern P_notEq :: forall a_a1aBX. (Eq a_a1aBX, IsString a_a1aBX) => (ModuleName, a_a1aBX) pattern I_eq1 :: Qualified Ident pattern S_eq1 :: forall a_a1aBW. (Eq a_a1aBW, IsString a_a1aBW) => a_a1aBW pattern Eq1 :: Qualified (ProperName 'ClassName) pattern I_eq :: Qualified Ident pattern P_eq :: forall a_a1aBV. (Eq a_a1aBV, IsString a_a1aBV) => (ModuleName, a_a1aBV) pattern S_eq :: forall a_a1aBU. (Eq a_a1aBU, IsString a_a1aBU) => a_a1aBU pattern Eq :: Qualified (ProperName 'ClassName) pattern M_Data_Eq :: ModuleName pattern P_boundedBoolean :: forall a_a1aBT. (Eq a_a1aBT, IsString a_a1aBT) => (ModuleName, a_a1aBT) pattern P_top :: forall a_a1aBS. (Eq a_a1aBS, IsString a_a1aBS) => (ModuleName, a_a1aBS) pattern P_bottom :: forall a_a1aBR. (Eq a_a1aBR, IsString a_a1aBR) => (ModuleName, a_a1aBR) pattern M_Data_Bounded :: ModuleName pattern P_semigroupoidFn :: forall a_a1aBQ. (Eq a_a1aBQ, IsString a_a1aBQ) => (ModuleName, a_a1aBQ) pattern P_composeFlipped :: forall a_a1aBP. (Eq a_a1aBP, IsString a_a1aBP) => (ModuleName, a_a1aBP) pattern P_compose :: forall a_a1aBO. (Eq a_a1aBO, IsString a_a1aBO) => (ModuleName, a_a1aBO) pattern M_Control_Semigroupoid :: ModuleName pattern P_categoryFn :: forall a_a1aBN. (Eq a_a1aBN, IsString a_a1aBN) => (ModuleName, a_a1aBN) pattern P_identity :: forall a_a1aBM. (Eq a_a1aBM, IsString a_a1aBM) => (ModuleName, a_a1aBM) pattern I_identity :: Qualified Ident pattern M_Control_Category :: ModuleName pattern P_discardUnit :: forall a_a1aBL. (Eq a_a1aBL, IsString a_a1aBL) => (ModuleName, a_a1aBL) pattern P_discard :: forall a_a1aBK. (Eq a_a1aBK, IsString a_a1aBK) => (ModuleName, a_a1aBK) pattern S_discard :: forall a_a1aBJ. (Eq a_a1aBJ, IsString a_a1aBJ) => a_a1aBJ pattern Discard :: Qualified (ProperName 'ClassName) pattern P_bind :: forall a_a1aBI. (Eq a_a1aBI, IsString a_a1aBI) => (ModuleName, a_a1aBI) pattern S_bind :: forall a_a1aBH. (Eq a_a1aBH, IsString a_a1aBH) => a_a1aBH pattern M_Control_Bind :: ModuleName pattern I_pure :: Qualified Ident pattern P_pure :: forall a_a1aBG. (Eq a_a1aBG, IsString a_a1aBG) => (ModuleName, a_a1aBG) pattern S_pure :: forall a_a1aBF. (Eq a_a1aBF, IsString a_a1aBF) => a_a1aBF pattern M_Control_Applicative :: ModuleName pattern I_apply :: Qualified Ident pattern S_apply :: forall a_a1aBE. (Eq a_a1aBE, IsString a_a1aBE) => a_a1aBE pattern M_Control_Apply :: ModuleName -- | 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 :: PSString -> 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 :: [(PSString, a)] -> Literal a instance GHC.Base.Functor Language.PureScript.AST.Literals.Literal 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) -- | 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.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Binders.Binder a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CoreFn.Binders.Binder a) instance GHC.Classes.Eq a => GHC.Classes.Eq (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 -> PSString -> Expr a -> Expr a -- | Partial record update (original value, fields to copy (if known), -- fields to update) ObjectUpdate :: a -> Expr a -> Maybe [PSString] -> [(PSString, 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.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Expr.Bind a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CoreFn.Expr.Bind a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CoreFn.Expr.Bind a) instance GHC.Base.Functor Language.PureScript.CoreFn.Expr.Expr instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Expr.Expr a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CoreFn.Expr.Expr a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CoreFn.Expr.Expr a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Expr.CaseAlternative a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CoreFn.Expr.CaseAlternative a) instance GHC.Classes.Eq a => GHC.Classes.Eq (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) -- | Apply the provided functions to the top level of AST nodes. -- -- This function is useful as a building block for recursive functions, -- but doesn't actually recurse itself. traverseCoreFn :: forall f a. Applicative f => (Bind a -> f (Bind a)) -> (Expr a -> f (Expr a)) -> (Binder a -> f (Binder a)) -> (CaseAlternative a -> f (CaseAlternative a)) -> (Bind a -> f (Bind a), Expr a -> f (Expr a), Binder a -> f (Binder a), CaseAlternative a -> f (CaseAlternative a)) module Language.PureScript.CoreFn.Module -- | The CoreFn module representation data Module a Module :: SourceSpan -> [Comment] -> ModuleName -> FilePath -> [(a, ModuleName)] -> [Ident] -> Map ModuleName [Ident] -> [Ident] -> [Bind a] -> Module a [moduleSourceSpan] :: Module a -> SourceSpan [moduleComments] :: Module a -> [Comment] [moduleName] :: Module a -> ModuleName [modulePath] :: Module a -> FilePath [moduleImports] :: Module a -> [(a, ModuleName)] [moduleExports] :: Module a -> [Ident] [moduleReExports] :: Module a -> Map ModuleName [Ident] [moduleForeign] :: Module a -> [Ident] [moduleDecls] :: Module a -> [Bind a] instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Module.Module a) instance GHC.Base.Functor Language.PureScript.CoreFn.Module.Module 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] bulletedListT :: (a -> Text) -> [a] -> [Box] printToStderr :: Box -> IO () -- | A compatibility module that allows a restricted set of purs.json -- manifest | files to be used for publishing. The manifest must -- described a package | available on GitHub, and it must be convertable -- to a Bower manifest. | | Fully supporting the registry manifest format -- will require `purs publish` | and by extension Pursuit to relax the -- requirement that packages are hosted | on GitHub, because the registry -- does not have this requirement. module Language.PureScript.Publish.Registry.Compat -- | Convert a valid purs.json manifest into a bower.json manifest toBowerPackage :: PursJson -> Either BowerError PackageMeta -- | A partial representation of the purs.json manifest format, including -- only | the fields required for publishing. | | -- https://github.com/purescript/registry/blob/master/v1/Manifest.dhall -- -- This type is intended for compatibility with the Bower publishing -- pipeline, and does not accurately reflect all possible purs.json -- manifests. However, supporting purs.json manifests properly introduces -- breaking changes to the compiler and to Pursuit. data PursJson PursJson :: Text -> Text -> Text -> Maybe Text -> Map Text Text -> PursJson -- | The name of the package [pursJsonName] :: PursJson -> Text -- | The SPDX identifier representing the package license [pursJsonLicense] :: PursJson -> Text -- | The GitHub repository hosting the package [pursJsonLocation] :: PursJson -> Text -- | An optional description of the package [pursJsonDescription] :: PursJson -> Maybe Text -- | A map of dependencies, where keys are package names and values are | -- dependency ranges of the form '>=X.Y.Z <X.Y.Z' [pursJsonDependencies] :: PursJson -> Map Text Text data PursJsonError MalformedLocationField :: PursJsonError showPursJsonError :: PursJsonError -> Text asPursJson :: Parse PursJsonError PursJson instance GHC.Generics.Generic Language.PureScript.Publish.Registry.Compat.PursJsonError instance GHC.Classes.Ord Language.PureScript.Publish.Registry.Compat.PursJsonError instance GHC.Show.Show Language.PureScript.Publish.Registry.Compat.PursJsonError instance GHC.Classes.Eq Language.PureScript.Publish.Registry.Compat.PursJsonError instance Control.DeepSeq.NFData Language.PureScript.Publish.Registry.Compat.PursJsonError 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 -- | Data types for roles. module Language.PureScript.Roles -- | The role of a type constructor's parameter. data Role -- | This parameter's identity affects the representation of the type it is -- parameterising. Nominal :: Role -- | This parameter's representation affects the representation of the type -- it is parameterising. Representational :: Role -- | This parameter has no effect on the representation of the type it is -- parameterising. Phantom :: Role displayRole :: Role -> Text instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Roles.Role instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Roles.Role instance GHC.Generics.Generic Language.PureScript.Roles.Role instance GHC.Classes.Ord Language.PureScript.Roles.Role instance GHC.Classes.Eq Language.PureScript.Roles.Role instance GHC.Show.Show Language.PureScript.Roles.Role instance Control.DeepSeq.NFData Language.PureScript.Roles.Role instance Codec.Serialise.Class.Serialise Language.PureScript.Roles.Role -- | This module contains data types for the entire PureScript surface -- language. Every token is represented in the tree, and every token is -- annotated with whitespace and comments (both leading and trailing). -- This means one can write an exact printer so that `print . parse = -- id`. Every constructor is laid out with tokens in left-to-right order. -- The core productions are given a slot for arbitrary annotations, -- however this is not used by the parser. module Language.PureScript.CST.Types data SourcePos SourcePos :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> SourcePos [srcLine] :: SourcePos -> {-# UNPACK #-} !Int [srcColumn] :: SourcePos -> {-# UNPACK #-} !Int data SourceRange SourceRange :: !SourcePos -> !SourcePos -> SourceRange [srcStart] :: SourceRange -> !SourcePos [srcEnd] :: SourceRange -> !SourcePos data Comment l Comment :: !Text -> Comment l Space :: {-# UNPACK #-} !Int -> Comment l Line :: !l -> Comment l data LineFeed LF :: LineFeed CRLF :: LineFeed data TokenAnn TokenAnn :: !SourceRange -> ![Comment LineFeed] -> ![Comment Void] -> TokenAnn [tokRange] :: TokenAnn -> !SourceRange [tokLeadingComments] :: TokenAnn -> ![Comment LineFeed] [tokTrailingComments] :: TokenAnn -> ![Comment Void] data SourceStyle ASCII :: SourceStyle Unicode :: SourceStyle data Token TokLeftParen :: Token TokRightParen :: Token TokLeftBrace :: Token TokRightBrace :: Token TokLeftSquare :: Token TokRightSquare :: Token TokLeftArrow :: !SourceStyle -> Token TokRightArrow :: !SourceStyle -> Token TokRightFatArrow :: !SourceStyle -> Token TokDoubleColon :: !SourceStyle -> Token TokForall :: !SourceStyle -> Token TokEquals :: Token TokPipe :: Token TokTick :: Token TokDot :: Token TokComma :: Token TokUnderscore :: Token TokBackslash :: Token TokLowerName :: ![Text] -> !Text -> Token TokUpperName :: ![Text] -> !Text -> Token TokOperator :: ![Text] -> !Text -> Token TokSymbolName :: ![Text] -> !Text -> Token TokSymbolArr :: !SourceStyle -> Token TokHole :: !Text -> Token TokChar :: !Text -> !Char -> Token TokString :: !Text -> !PSString -> Token TokRawString :: !Text -> Token TokInt :: !Text -> !Integer -> Token TokNumber :: !Text -> !Double -> Token TokLayoutStart :: Token TokLayoutSep :: Token TokLayoutEnd :: Token TokEof :: Token data SourceToken SourceToken :: !TokenAnn -> !Token -> SourceToken [tokAnn] :: SourceToken -> !TokenAnn [tokValue] :: SourceToken -> !Token data Ident Ident :: Text -> Ident [getIdent] :: Ident -> Text data Name a Name :: SourceToken -> a -> Name a [nameTok] :: Name a -> SourceToken [nameValue] :: Name a -> a data QualifiedName a QualifiedName :: SourceToken -> Maybe ModuleName -> a -> QualifiedName a [qualTok] :: QualifiedName a -> SourceToken [qualModule] :: QualifiedName a -> Maybe ModuleName [qualName] :: QualifiedName a -> a data Label Label :: SourceToken -> PSString -> Label [lblTok] :: Label -> SourceToken [lblName] :: Label -> PSString data Wrapped a Wrapped :: SourceToken -> a -> SourceToken -> Wrapped a [wrpOpen] :: Wrapped a -> SourceToken [wrpValue] :: Wrapped a -> a [wrpClose] :: Wrapped a -> SourceToken data Separated a Separated :: a -> [(SourceToken, a)] -> Separated a [sepHead] :: Separated a -> a [sepTail] :: Separated a -> [(SourceToken, a)] data Labeled a b Labeled :: a -> SourceToken -> b -> Labeled a b [lblLabel] :: Labeled a b -> a [lblSep] :: Labeled a b -> SourceToken [lblValue] :: Labeled a b -> b type Delimited a = Wrapped (Maybe (Separated a)) type DelimitedNonEmpty a = Wrapped (Separated a) data OneOrDelimited a One :: a -> OneOrDelimited a Many :: DelimitedNonEmpty a -> OneOrDelimited a data Type a TypeVar :: a -> Name Ident -> Type a TypeConstructor :: a -> QualifiedName (ProperName 'TypeName) -> Type a TypeWildcard :: a -> SourceToken -> Type a TypeHole :: a -> Name Ident -> Type a TypeString :: a -> SourceToken -> PSString -> Type a TypeInt :: a -> Maybe SourceToken -> SourceToken -> Integer -> Type a TypeRow :: a -> Wrapped (Row a) -> Type a TypeRecord :: a -> Wrapped (Row a) -> Type a TypeForall :: a -> SourceToken -> NonEmpty (TypeVarBinding a) -> SourceToken -> Type a -> Type a TypeKinded :: a -> Type a -> SourceToken -> Type a -> Type a TypeApp :: a -> Type a -> Type a -> Type a TypeOp :: a -> Type a -> QualifiedName (OpName 'TypeOpName) -> Type a -> Type a TypeOpName :: a -> QualifiedName (OpName 'TypeOpName) -> Type a TypeArr :: a -> Type a -> SourceToken -> Type a -> Type a TypeArrName :: a -> SourceToken -> Type a TypeConstrained :: a -> Constraint a -> SourceToken -> Type a -> Type a TypeParens :: a -> Wrapped (Type a) -> Type a TypeUnaryRow :: a -> SourceToken -> Type a -> Type a data TypeVarBinding a TypeVarKinded :: Wrapped (Labeled (Maybe SourceToken, Name Ident) (Type a)) -> TypeVarBinding a TypeVarName :: (Maybe SourceToken, Name Ident) -> TypeVarBinding a data Constraint a Constraint :: a -> QualifiedName (ProperName 'ClassName) -> [Type a] -> Constraint a ConstraintParens :: a -> Wrapped (Constraint a) -> Constraint a data Row a Row :: Maybe (Separated (Labeled Label (Type a))) -> Maybe (SourceToken, Type a) -> Row a [rowLabels] :: Row a -> Maybe (Separated (Labeled Label (Type a))) [rowTail] :: Row a -> Maybe (SourceToken, Type a) data Module a Module :: a -> SourceToken -> Name ModuleName -> Maybe (DelimitedNonEmpty (Export a)) -> SourceToken -> [ImportDecl a] -> [Declaration a] -> [Comment LineFeed] -> Module a [modAnn] :: Module a -> a [modKeyword] :: Module a -> SourceToken [modNamespace] :: Module a -> Name ModuleName [modExports] :: Module a -> Maybe (DelimitedNonEmpty (Export a)) [modWhere] :: Module a -> SourceToken [modImports] :: Module a -> [ImportDecl a] [modDecls] :: Module a -> [Declaration a] [modTrailingComments] :: Module a -> [Comment LineFeed] data Export a ExportValue :: a -> Name Ident -> Export a ExportOp :: a -> Name (OpName 'ValueOpName) -> Export a ExportType :: a -> Name (ProperName 'TypeName) -> Maybe (DataMembers a) -> Export a ExportTypeOp :: a -> SourceToken -> Name (OpName 'TypeOpName) -> Export a ExportClass :: a -> SourceToken -> Name (ProperName 'ClassName) -> Export a ExportModule :: a -> SourceToken -> Name ModuleName -> Export a data DataMembers a DataAll :: a -> SourceToken -> DataMembers a DataEnumerated :: a -> Delimited (Name (ProperName 'ConstructorName)) -> DataMembers a data Declaration a DeclData :: a -> DataHead a -> Maybe (SourceToken, Separated (DataCtor a)) -> Declaration a DeclType :: a -> DataHead a -> SourceToken -> Type a -> Declaration a DeclNewtype :: a -> DataHead a -> SourceToken -> Name (ProperName 'ConstructorName) -> Type a -> Declaration a DeclClass :: a -> ClassHead a -> Maybe (SourceToken, NonEmpty (Labeled (Name Ident) (Type a))) -> Declaration a DeclInstanceChain :: a -> Separated (Instance a) -> Declaration a DeclDerive :: a -> SourceToken -> Maybe SourceToken -> InstanceHead a -> Declaration a DeclKindSignature :: a -> SourceToken -> Labeled (Name (ProperName 'TypeName)) (Type a) -> Declaration a DeclSignature :: a -> Labeled (Name Ident) (Type a) -> Declaration a DeclValue :: a -> ValueBindingFields a -> Declaration a DeclFixity :: a -> FixityFields -> Declaration a DeclForeign :: a -> SourceToken -> SourceToken -> Foreign a -> Declaration a DeclRole :: a -> SourceToken -> SourceToken -> Name (ProperName 'TypeName) -> NonEmpty Role -> Declaration a data Instance a Instance :: InstanceHead a -> Maybe (SourceToken, NonEmpty (InstanceBinding a)) -> Instance a [instHead] :: Instance a -> InstanceHead a [instBody] :: Instance a -> Maybe (SourceToken, NonEmpty (InstanceBinding a)) data InstanceBinding a InstanceBindingSignature :: a -> Labeled (Name Ident) (Type a) -> InstanceBinding a InstanceBindingName :: a -> ValueBindingFields a -> InstanceBinding a data ImportDecl a ImportDecl :: a -> SourceToken -> Name ModuleName -> Maybe (Maybe SourceToken, DelimitedNonEmpty (Import a)) -> Maybe (SourceToken, Name ModuleName) -> ImportDecl a [impAnn] :: ImportDecl a -> a [impKeyword] :: ImportDecl a -> SourceToken [impModule] :: ImportDecl a -> Name ModuleName [impNames] :: ImportDecl a -> Maybe (Maybe SourceToken, DelimitedNonEmpty (Import a)) [impQual] :: ImportDecl a -> Maybe (SourceToken, Name ModuleName) data Import a ImportValue :: a -> Name Ident -> Import a ImportOp :: a -> Name (OpName 'ValueOpName) -> Import a ImportType :: a -> Name (ProperName 'TypeName) -> Maybe (DataMembers a) -> Import a ImportTypeOp :: a -> SourceToken -> Name (OpName 'TypeOpName) -> Import a ImportClass :: a -> SourceToken -> Name (ProperName 'ClassName) -> Import a data DataHead a DataHead :: SourceToken -> Name (ProperName 'TypeName) -> [TypeVarBinding a] -> DataHead a [dataHdKeyword] :: DataHead a -> SourceToken [dataHdName] :: DataHead a -> Name (ProperName 'TypeName) [dataHdVars] :: DataHead a -> [TypeVarBinding a] data DataCtor a DataCtor :: a -> Name (ProperName 'ConstructorName) -> [Type a] -> DataCtor a [dataCtorAnn] :: DataCtor a -> a [dataCtorName] :: DataCtor a -> Name (ProperName 'ConstructorName) [dataCtorFields] :: DataCtor a -> [Type a] data ClassHead a ClassHead :: SourceToken -> Maybe (OneOrDelimited (Constraint a), SourceToken) -> Name (ProperName 'ClassName) -> [TypeVarBinding a] -> Maybe (SourceToken, Separated ClassFundep) -> ClassHead a [clsKeyword] :: ClassHead a -> SourceToken [clsSuper] :: ClassHead a -> Maybe (OneOrDelimited (Constraint a), SourceToken) [clsName] :: ClassHead a -> Name (ProperName 'ClassName) [clsVars] :: ClassHead a -> [TypeVarBinding a] [clsFundeps] :: ClassHead a -> Maybe (SourceToken, Separated ClassFundep) data ClassFundep FundepDetermined :: SourceToken -> NonEmpty (Name Ident) -> ClassFundep FundepDetermines :: NonEmpty (Name Ident) -> SourceToken -> NonEmpty (Name Ident) -> ClassFundep data InstanceHead a InstanceHead :: SourceToken -> Maybe (Name Ident, SourceToken) -> Maybe (OneOrDelimited (Constraint a), SourceToken) -> QualifiedName (ProperName 'ClassName) -> [Type a] -> InstanceHead a [instKeyword] :: InstanceHead a -> SourceToken [instNameSep] :: InstanceHead a -> Maybe (Name Ident, SourceToken) [instConstraints] :: InstanceHead a -> Maybe (OneOrDelimited (Constraint a), SourceToken) [instClass] :: InstanceHead a -> QualifiedName (ProperName 'ClassName) [instTypes] :: InstanceHead a -> [Type a] data Fixity Infix :: Fixity Infixl :: Fixity Infixr :: Fixity data FixityOp FixityValue :: QualifiedName (Either Ident (ProperName 'ConstructorName)) -> SourceToken -> Name (OpName 'ValueOpName) -> FixityOp FixityType :: SourceToken -> QualifiedName (ProperName 'TypeName) -> SourceToken -> Name (OpName 'TypeOpName) -> FixityOp data FixityFields FixityFields :: (SourceToken, Fixity) -> (SourceToken, Integer) -> FixityOp -> FixityFields [fxtKeyword] :: FixityFields -> (SourceToken, Fixity) [fxtPrec] :: FixityFields -> (SourceToken, Integer) [fxtOp] :: FixityFields -> FixityOp data ValueBindingFields a ValueBindingFields :: Name Ident -> [Binder a] -> Guarded a -> ValueBindingFields a [valName] :: ValueBindingFields a -> Name Ident [valBinders] :: ValueBindingFields a -> [Binder a] [valGuarded] :: ValueBindingFields a -> Guarded a data Guarded a Unconditional :: SourceToken -> Where a -> Guarded a Guarded :: NonEmpty (GuardedExpr a) -> Guarded a data GuardedExpr a GuardedExpr :: SourceToken -> Separated (PatternGuard a) -> SourceToken -> Where a -> GuardedExpr a [grdBar] :: GuardedExpr a -> SourceToken [grdPatterns] :: GuardedExpr a -> Separated (PatternGuard a) [grdSep] :: GuardedExpr a -> SourceToken [grdWhere] :: GuardedExpr a -> Where a data PatternGuard a PatternGuard :: Maybe (Binder a, SourceToken) -> Expr a -> PatternGuard a [patBinder] :: PatternGuard a -> Maybe (Binder a, SourceToken) [patExpr] :: PatternGuard a -> Expr a data Foreign a ForeignValue :: Labeled (Name Ident) (Type a) -> Foreign a ForeignData :: SourceToken -> Labeled (Name (ProperName 'TypeName)) (Type a) -> Foreign a ForeignKind :: SourceToken -> Name (ProperName 'TypeName) -> Foreign a data Role Role :: SourceToken -> Role -> Role [roleTok] :: Role -> SourceToken [roleValue] :: Role -> Role data Expr a ExprHole :: a -> Name Ident -> Expr a ExprSection :: a -> SourceToken -> Expr a ExprIdent :: a -> QualifiedName Ident -> Expr a ExprConstructor :: a -> QualifiedName (ProperName 'ConstructorName) -> Expr a ExprBoolean :: a -> SourceToken -> Bool -> Expr a ExprChar :: a -> SourceToken -> Char -> Expr a ExprString :: a -> SourceToken -> PSString -> Expr a ExprNumber :: a -> SourceToken -> Either Integer Double -> Expr a ExprArray :: a -> Delimited (Expr a) -> Expr a ExprRecord :: a -> Delimited (RecordLabeled (Expr a)) -> Expr a ExprParens :: a -> Wrapped (Expr a) -> Expr a ExprTyped :: a -> Expr a -> SourceToken -> Type a -> Expr a ExprInfix :: a -> Expr a -> Wrapped (Expr a) -> Expr a -> Expr a ExprOp :: a -> Expr a -> QualifiedName (OpName 'ValueOpName) -> Expr a -> Expr a ExprOpName :: a -> QualifiedName (OpName 'ValueOpName) -> Expr a ExprNegate :: a -> SourceToken -> Expr a -> Expr a ExprRecordAccessor :: a -> RecordAccessor a -> Expr a ExprRecordUpdate :: a -> Expr a -> DelimitedNonEmpty (RecordUpdate a) -> Expr a ExprApp :: a -> Expr a -> Expr a -> Expr a ExprVisibleTypeApp :: a -> Expr a -> SourceToken -> Type a -> Expr a ExprLambda :: a -> Lambda a -> Expr a ExprIf :: a -> IfThenElse a -> Expr a ExprCase :: a -> CaseOf a -> Expr a ExprLet :: a -> LetIn a -> Expr a ExprDo :: a -> DoBlock a -> Expr a ExprAdo :: a -> AdoBlock a -> Expr a data RecordLabeled a RecordPun :: Name Ident -> RecordLabeled a RecordField :: Label -> SourceToken -> a -> RecordLabeled a data RecordUpdate a RecordUpdateLeaf :: Label -> SourceToken -> Expr a -> RecordUpdate a RecordUpdateBranch :: Label -> DelimitedNonEmpty (RecordUpdate a) -> RecordUpdate a data RecordAccessor a RecordAccessor :: Expr a -> SourceToken -> Separated Label -> RecordAccessor a [recExpr] :: RecordAccessor a -> Expr a [recDot] :: RecordAccessor a -> SourceToken [recPath] :: RecordAccessor a -> Separated Label data Lambda a Lambda :: SourceToken -> NonEmpty (Binder a) -> SourceToken -> Expr a -> Lambda a [lmbSymbol] :: Lambda a -> SourceToken [lmbBinders] :: Lambda a -> NonEmpty (Binder a) [lmbArr] :: Lambda a -> SourceToken [lmbBody] :: Lambda a -> Expr a data IfThenElse a IfThenElse :: SourceToken -> Expr a -> SourceToken -> Expr a -> SourceToken -> Expr a -> IfThenElse a [iteIf] :: IfThenElse a -> SourceToken [iteCond] :: IfThenElse a -> Expr a [iteThen] :: IfThenElse a -> SourceToken [iteTrue] :: IfThenElse a -> Expr a [iteElse] :: IfThenElse a -> SourceToken [iteFalse] :: IfThenElse a -> Expr a data CaseOf a CaseOf :: SourceToken -> Separated (Expr a) -> SourceToken -> NonEmpty (Separated (Binder a), Guarded a) -> CaseOf a [caseKeyword] :: CaseOf a -> SourceToken [caseHead] :: CaseOf a -> Separated (Expr a) [caseOf] :: CaseOf a -> SourceToken [caseBranches] :: CaseOf a -> NonEmpty (Separated (Binder a), Guarded a) data LetIn a LetIn :: SourceToken -> NonEmpty (LetBinding a) -> SourceToken -> Expr a -> LetIn a [letKeyword] :: LetIn a -> SourceToken [letBindings] :: LetIn a -> NonEmpty (LetBinding a) [letIn] :: LetIn a -> SourceToken [letBody] :: LetIn a -> Expr a data Where a Where :: Expr a -> Maybe (SourceToken, NonEmpty (LetBinding a)) -> Where a [whereExpr] :: Where a -> Expr a [whereBindings] :: Where a -> Maybe (SourceToken, NonEmpty (LetBinding a)) data LetBinding a LetBindingSignature :: a -> Labeled (Name Ident) (Type a) -> LetBinding a LetBindingName :: a -> ValueBindingFields a -> LetBinding a LetBindingPattern :: a -> Binder a -> SourceToken -> Where a -> LetBinding a data DoBlock a DoBlock :: SourceToken -> NonEmpty (DoStatement a) -> DoBlock a [doKeyword] :: DoBlock a -> SourceToken [doStatements] :: DoBlock a -> NonEmpty (DoStatement a) data DoStatement a DoLet :: SourceToken -> NonEmpty (LetBinding a) -> DoStatement a DoDiscard :: Expr a -> DoStatement a DoBind :: Binder a -> SourceToken -> Expr a -> DoStatement a data AdoBlock a AdoBlock :: SourceToken -> [DoStatement a] -> SourceToken -> Expr a -> AdoBlock a [adoKeyword] :: AdoBlock a -> SourceToken [adoStatements] :: AdoBlock a -> [DoStatement a] [adoIn] :: AdoBlock a -> SourceToken [adoResult] :: AdoBlock a -> Expr a data Binder a BinderWildcard :: a -> SourceToken -> Binder a BinderVar :: a -> Name Ident -> Binder a BinderNamed :: a -> Name Ident -> SourceToken -> Binder a -> Binder a BinderConstructor :: a -> QualifiedName (ProperName 'ConstructorName) -> [Binder a] -> Binder a BinderBoolean :: a -> SourceToken -> Bool -> Binder a BinderChar :: a -> SourceToken -> Char -> Binder a BinderString :: a -> SourceToken -> PSString -> Binder a BinderNumber :: a -> Maybe SourceToken -> SourceToken -> Either Integer Double -> Binder a BinderArray :: a -> Delimited (Binder a) -> Binder a BinderRecord :: a -> Delimited (RecordLabeled (Binder a)) -> Binder a BinderParens :: a -> Wrapped (Binder a) -> Binder a BinderTyped :: a -> Binder a -> SourceToken -> Type a -> Binder a BinderOp :: a -> Binder a -> QualifiedName (OpName 'ValueOpName) -> Binder a -> Binder a instance GHC.Generics.Generic Language.PureScript.CST.Types.SourcePos instance GHC.Classes.Ord Language.PureScript.CST.Types.SourcePos instance GHC.Classes.Eq Language.PureScript.CST.Types.SourcePos instance GHC.Show.Show Language.PureScript.CST.Types.SourcePos instance GHC.Generics.Generic Language.PureScript.CST.Types.SourceRange instance GHC.Classes.Ord Language.PureScript.CST.Types.SourceRange instance GHC.Classes.Eq Language.PureScript.CST.Types.SourceRange instance GHC.Show.Show Language.PureScript.CST.Types.SourceRange instance GHC.Base.Functor Language.PureScript.CST.Types.Comment instance GHC.Generics.Generic (Language.PureScript.CST.Types.Comment l) instance GHC.Classes.Ord l => GHC.Classes.Ord (Language.PureScript.CST.Types.Comment l) instance GHC.Classes.Eq l => GHC.Classes.Eq (Language.PureScript.CST.Types.Comment l) instance GHC.Show.Show l => GHC.Show.Show (Language.PureScript.CST.Types.Comment l) instance GHC.Generics.Generic Language.PureScript.CST.Types.LineFeed instance GHC.Classes.Ord Language.PureScript.CST.Types.LineFeed instance GHC.Classes.Eq Language.PureScript.CST.Types.LineFeed instance GHC.Show.Show Language.PureScript.CST.Types.LineFeed instance GHC.Generics.Generic Language.PureScript.CST.Types.TokenAnn instance GHC.Classes.Ord Language.PureScript.CST.Types.TokenAnn instance GHC.Classes.Eq Language.PureScript.CST.Types.TokenAnn instance GHC.Show.Show Language.PureScript.CST.Types.TokenAnn instance GHC.Generics.Generic Language.PureScript.CST.Types.SourceStyle instance GHC.Classes.Ord Language.PureScript.CST.Types.SourceStyle instance GHC.Classes.Eq Language.PureScript.CST.Types.SourceStyle instance GHC.Show.Show Language.PureScript.CST.Types.SourceStyle instance GHC.Generics.Generic Language.PureScript.CST.Types.Token instance GHC.Classes.Ord Language.PureScript.CST.Types.Token instance GHC.Classes.Eq Language.PureScript.CST.Types.Token instance GHC.Show.Show Language.PureScript.CST.Types.Token instance GHC.Generics.Generic Language.PureScript.CST.Types.SourceToken instance GHC.Classes.Ord Language.PureScript.CST.Types.SourceToken instance GHC.Classes.Eq Language.PureScript.CST.Types.SourceToken instance GHC.Show.Show Language.PureScript.CST.Types.SourceToken instance GHC.Generics.Generic Language.PureScript.CST.Types.Ident instance GHC.Classes.Ord Language.PureScript.CST.Types.Ident instance GHC.Classes.Eq Language.PureScript.CST.Types.Ident instance GHC.Show.Show Language.PureScript.CST.Types.Ident instance GHC.Generics.Generic (Language.PureScript.CST.Types.Name a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Name instance Data.Foldable.Foldable Language.PureScript.CST.Types.Name instance GHC.Base.Functor Language.PureScript.CST.Types.Name instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Name a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Name a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Name a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.QualifiedName a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.QualifiedName instance Data.Foldable.Foldable Language.PureScript.CST.Types.QualifiedName instance GHC.Base.Functor Language.PureScript.CST.Types.QualifiedName instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.QualifiedName a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.QualifiedName a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.QualifiedName a) instance GHC.Generics.Generic Language.PureScript.CST.Types.Label instance GHC.Classes.Ord Language.PureScript.CST.Types.Label instance GHC.Classes.Eq Language.PureScript.CST.Types.Label instance GHC.Show.Show Language.PureScript.CST.Types.Label instance GHC.Generics.Generic (Language.PureScript.CST.Types.Wrapped a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Wrapped instance Data.Foldable.Foldable Language.PureScript.CST.Types.Wrapped instance GHC.Base.Functor Language.PureScript.CST.Types.Wrapped instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Wrapped a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Wrapped a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Wrapped a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Separated a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Separated instance Data.Foldable.Foldable Language.PureScript.CST.Types.Separated instance GHC.Base.Functor Language.PureScript.CST.Types.Separated instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Separated a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Separated a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Separated a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Labeled a b) instance Data.Traversable.Traversable (Language.PureScript.CST.Types.Labeled a) instance Data.Foldable.Foldable (Language.PureScript.CST.Types.Labeled a) instance GHC.Base.Functor (Language.PureScript.CST.Types.Labeled a) instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Language.PureScript.CST.Types.Labeled a b) instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Language.PureScript.CST.Types.Labeled a b) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Language.PureScript.CST.Types.Labeled a b) instance GHC.Generics.Generic (Language.PureScript.CST.Types.OneOrDelimited a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.OneOrDelimited instance Data.Foldable.Foldable Language.PureScript.CST.Types.OneOrDelimited instance GHC.Base.Functor Language.PureScript.CST.Types.OneOrDelimited instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.OneOrDelimited a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.OneOrDelimited a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.OneOrDelimited a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.TypeVarBinding a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.TypeVarBinding instance Data.Foldable.Foldable Language.PureScript.CST.Types.TypeVarBinding instance GHC.Base.Functor Language.PureScript.CST.Types.TypeVarBinding instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.TypeVarBinding a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.TypeVarBinding a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.TypeVarBinding a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Constraint a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Constraint instance Data.Foldable.Foldable Language.PureScript.CST.Types.Constraint instance GHC.Base.Functor Language.PureScript.CST.Types.Constraint instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Constraint a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Constraint a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Constraint a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Type a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Type instance Data.Foldable.Foldable Language.PureScript.CST.Types.Type instance GHC.Base.Functor Language.PureScript.CST.Types.Type instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Type a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Type a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Type a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Row a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Row instance Data.Foldable.Foldable Language.PureScript.CST.Types.Row instance GHC.Base.Functor Language.PureScript.CST.Types.Row instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Row a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Row a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Row a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.DataMembers a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.DataMembers instance Data.Foldable.Foldable Language.PureScript.CST.Types.DataMembers instance GHC.Base.Functor Language.PureScript.CST.Types.DataMembers instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.DataMembers a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.DataMembers a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.DataMembers a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Export a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Export instance Data.Foldable.Foldable Language.PureScript.CST.Types.Export instance GHC.Base.Functor Language.PureScript.CST.Types.Export instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Export a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Export a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Export a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Import a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Import instance Data.Foldable.Foldable Language.PureScript.CST.Types.Import instance GHC.Base.Functor Language.PureScript.CST.Types.Import instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Import a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Import a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Import a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.ImportDecl a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.ImportDecl instance Data.Foldable.Foldable Language.PureScript.CST.Types.ImportDecl instance GHC.Base.Functor Language.PureScript.CST.Types.ImportDecl instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.ImportDecl a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.ImportDecl a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.ImportDecl a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.DataHead a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.DataHead instance Data.Foldable.Foldable Language.PureScript.CST.Types.DataHead instance GHC.Base.Functor Language.PureScript.CST.Types.DataHead instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.DataHead a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.DataHead a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.DataHead a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.DataCtor a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.DataCtor instance Data.Foldable.Foldable Language.PureScript.CST.Types.DataCtor instance GHC.Base.Functor Language.PureScript.CST.Types.DataCtor instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.DataCtor a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.DataCtor a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.DataCtor a) instance GHC.Generics.Generic Language.PureScript.CST.Types.ClassFundep instance GHC.Classes.Ord Language.PureScript.CST.Types.ClassFundep instance GHC.Classes.Eq Language.PureScript.CST.Types.ClassFundep instance GHC.Show.Show Language.PureScript.CST.Types.ClassFundep instance GHC.Generics.Generic (Language.PureScript.CST.Types.ClassHead a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.ClassHead instance Data.Foldable.Foldable Language.PureScript.CST.Types.ClassHead instance GHC.Base.Functor Language.PureScript.CST.Types.ClassHead instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.ClassHead a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.ClassHead a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.ClassHead a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.InstanceHead a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.InstanceHead instance Data.Foldable.Foldable Language.PureScript.CST.Types.InstanceHead instance GHC.Base.Functor Language.PureScript.CST.Types.InstanceHead instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.InstanceHead a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.InstanceHead a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.InstanceHead a) instance GHC.Generics.Generic Language.PureScript.CST.Types.Fixity instance GHC.Classes.Ord Language.PureScript.CST.Types.Fixity instance GHC.Classes.Eq Language.PureScript.CST.Types.Fixity instance GHC.Show.Show Language.PureScript.CST.Types.Fixity instance GHC.Generics.Generic Language.PureScript.CST.Types.FixityOp instance GHC.Classes.Ord Language.PureScript.CST.Types.FixityOp instance GHC.Classes.Eq Language.PureScript.CST.Types.FixityOp instance GHC.Show.Show Language.PureScript.CST.Types.FixityOp instance GHC.Generics.Generic Language.PureScript.CST.Types.FixityFields instance GHC.Classes.Ord Language.PureScript.CST.Types.FixityFields instance GHC.Classes.Eq Language.PureScript.CST.Types.FixityFields instance GHC.Show.Show Language.PureScript.CST.Types.FixityFields instance GHC.Generics.Generic (Language.PureScript.CST.Types.Foreign a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Foreign instance Data.Foldable.Foldable Language.PureScript.CST.Types.Foreign instance GHC.Base.Functor Language.PureScript.CST.Types.Foreign instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Foreign a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Foreign a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Foreign a) instance GHC.Generics.Generic Language.PureScript.CST.Types.Role instance GHC.Classes.Ord Language.PureScript.CST.Types.Role instance GHC.Classes.Eq Language.PureScript.CST.Types.Role instance GHC.Show.Show Language.PureScript.CST.Types.Role instance GHC.Generics.Generic (Language.PureScript.CST.Types.RecordLabeled a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.RecordLabeled instance Data.Foldable.Foldable Language.PureScript.CST.Types.RecordLabeled instance GHC.Base.Functor Language.PureScript.CST.Types.RecordLabeled instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.RecordLabeled a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.RecordLabeled a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.RecordLabeled a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Binder a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Binder instance Data.Foldable.Foldable Language.PureScript.CST.Types.Binder instance GHC.Base.Functor Language.PureScript.CST.Types.Binder instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Binder a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Binder a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Binder a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.PatternGuard a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.PatternGuard instance Data.Foldable.Foldable Language.PureScript.CST.Types.PatternGuard instance GHC.Base.Functor Language.PureScript.CST.Types.PatternGuard instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.PatternGuard a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.PatternGuard a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.PatternGuard a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.GuardedExpr a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.GuardedExpr instance Data.Foldable.Foldable Language.PureScript.CST.Types.GuardedExpr instance GHC.Base.Functor Language.PureScript.CST.Types.GuardedExpr instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.GuardedExpr a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.GuardedExpr a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.GuardedExpr a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.RecordUpdate a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.RecordUpdate instance Data.Foldable.Foldable Language.PureScript.CST.Types.RecordUpdate instance GHC.Base.Functor Language.PureScript.CST.Types.RecordUpdate instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.RecordUpdate a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.RecordUpdate a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.RecordUpdate a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.RecordAccessor a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.RecordAccessor instance Data.Foldable.Foldable Language.PureScript.CST.Types.RecordAccessor instance GHC.Base.Functor Language.PureScript.CST.Types.RecordAccessor instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.RecordAccessor a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.RecordAccessor a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.RecordAccessor a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Lambda a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Lambda instance Data.Foldable.Foldable Language.PureScript.CST.Types.Lambda instance GHC.Base.Functor Language.PureScript.CST.Types.Lambda instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Lambda a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Lambda a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Lambda a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.IfThenElse a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.IfThenElse instance Data.Foldable.Foldable Language.PureScript.CST.Types.IfThenElse instance GHC.Base.Functor Language.PureScript.CST.Types.IfThenElse instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.IfThenElse a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.IfThenElse a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.IfThenElse a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.CaseOf a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.CaseOf instance Data.Foldable.Foldable Language.PureScript.CST.Types.CaseOf instance GHC.Base.Functor Language.PureScript.CST.Types.CaseOf instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.CaseOf a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.CaseOf a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.CaseOf a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.LetIn a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.LetIn instance Data.Foldable.Foldable Language.PureScript.CST.Types.LetIn instance GHC.Base.Functor Language.PureScript.CST.Types.LetIn instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.LetIn a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.LetIn a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.LetIn a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.DoBlock a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.DoBlock instance Data.Foldable.Foldable Language.PureScript.CST.Types.DoBlock instance GHC.Base.Functor Language.PureScript.CST.Types.DoBlock instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.DoBlock a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.DoBlock a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.DoBlock a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.DoStatement a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.DoStatement instance Data.Foldable.Foldable Language.PureScript.CST.Types.DoStatement instance GHC.Base.Functor Language.PureScript.CST.Types.DoStatement instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.DoStatement a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.DoStatement a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.DoStatement a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.AdoBlock a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.AdoBlock instance Data.Foldable.Foldable Language.PureScript.CST.Types.AdoBlock instance GHC.Base.Functor Language.PureScript.CST.Types.AdoBlock instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.AdoBlock a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.AdoBlock a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.AdoBlock a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Expr a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Expr instance Data.Foldable.Foldable Language.PureScript.CST.Types.Expr instance GHC.Base.Functor Language.PureScript.CST.Types.Expr instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Expr a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Expr a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Expr a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.LetBinding a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.LetBinding instance Data.Foldable.Foldable Language.PureScript.CST.Types.LetBinding instance GHC.Base.Functor Language.PureScript.CST.Types.LetBinding instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.LetBinding a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.LetBinding a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.LetBinding a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Where a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Where instance Data.Foldable.Foldable Language.PureScript.CST.Types.Where instance GHC.Base.Functor Language.PureScript.CST.Types.Where instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Where a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Where a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Where a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Guarded a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Guarded instance Data.Foldable.Foldable Language.PureScript.CST.Types.Guarded instance GHC.Base.Functor Language.PureScript.CST.Types.Guarded instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Guarded a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Guarded a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Guarded a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.ValueBindingFields a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.ValueBindingFields instance Data.Foldable.Foldable Language.PureScript.CST.Types.ValueBindingFields instance GHC.Base.Functor Language.PureScript.CST.Types.ValueBindingFields instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.ValueBindingFields a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.ValueBindingFields a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.ValueBindingFields a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.InstanceBinding a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.InstanceBinding instance Data.Foldable.Foldable Language.PureScript.CST.Types.InstanceBinding instance GHC.Base.Functor Language.PureScript.CST.Types.InstanceBinding instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.InstanceBinding a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.InstanceBinding a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.InstanceBinding a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Instance a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Instance instance Data.Foldable.Foldable Language.PureScript.CST.Types.Instance instance GHC.Base.Functor Language.PureScript.CST.Types.Instance instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Instance a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Instance a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Instance a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Declaration a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Declaration instance Data.Foldable.Foldable Language.PureScript.CST.Types.Declaration instance GHC.Base.Functor Language.PureScript.CST.Types.Declaration instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Declaration a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Declaration a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Declaration a) instance GHC.Generics.Generic (Language.PureScript.CST.Types.Module a) instance Data.Traversable.Traversable Language.PureScript.CST.Types.Module instance Data.Foldable.Foldable Language.PureScript.CST.Types.Module instance GHC.Base.Functor Language.PureScript.CST.Types.Module instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.CST.Types.Module a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Types.Module a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Types.Module a) module Language.PureScript.CST.Traversals everythingOnSeparated :: (r -> r -> r) -> (a -> r) -> Separated a -> r module Language.PureScript.CST.Traversals.Type everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r -- | This module contains utilities for calculating positions and offsets. -- While tokens are annotated with ranges, CST nodes are not, but they -- can be dynamically derived with the functions in this module, which -- will return the first and last tokens for a given node. module Language.PureScript.CST.Positions advanceToken :: SourcePos -> Token -> SourcePos advanceLeading :: SourcePos -> [Comment LineFeed] -> SourcePos advanceTrailing :: SourcePos -> [Comment Void] -> SourcePos tokenDelta :: Token -> (Int, Int) qualDelta :: [Text] -> Int multiLine :: Int -> (Int, Int) -> (Int, Int) commentDelta :: (a -> (Int, Int)) -> Comment a -> (Int, Int) lineDelta :: LineFeed -> (Int, Int) textDelta :: Text -> (Int, Int) applyDelta :: SourcePos -> (Int, Int) -> SourcePos sepLast :: Separated a -> a type TokenRange = (SourceToken, SourceToken) toSourceRange :: TokenRange -> SourceRange widen :: SourceRange -> SourceRange -> SourceRange srcRange :: SourceToken -> SourceRange nameRange :: Name a -> TokenRange qualRange :: QualifiedName a -> TokenRange wrappedRange :: Wrapped a -> TokenRange moduleRange :: Module a -> TokenRange exportRange :: Export a -> TokenRange importDeclRange :: ImportDecl a -> TokenRange importRange :: Import a -> TokenRange dataMembersRange :: DataMembers a -> TokenRange declRange :: Declaration a -> TokenRange dataHeadRange :: DataHead a -> TokenRange dataCtorRange :: DataCtor a -> TokenRange classHeadRange :: ClassHead a -> TokenRange classFundepRange :: ClassFundep -> TokenRange instanceRange :: Instance a -> TokenRange instanceHeadRange :: InstanceHead a -> TokenRange instanceBindingRange :: InstanceBinding a -> TokenRange foreignRange :: Foreign a -> TokenRange valueBindingFieldsRange :: ValueBindingFields a -> TokenRange guardedRange :: Guarded a -> TokenRange guardedExprRange :: GuardedExpr a -> TokenRange whereRange :: Where a -> TokenRange typeRange :: Type a -> TokenRange constraintRange :: Constraint a -> TokenRange typeVarBindingRange :: TypeVarBinding a -> TokenRange exprRange :: Expr a -> TokenRange letBindingRange :: LetBinding a -> TokenRange doStatementRange :: DoStatement a -> TokenRange binderRange :: Binder a -> TokenRange recordUpdateRange :: RecordUpdate a -> TokenRange -- | ## High-Level Summary -- -- This section provides a high-level summary of this file. For those who -- know more about compiler-development, the below explanation is likely -- enough. For everyone else, see the next section. -- -- The parser itself is unaware of indentation, and instead only parses -- explicit delimiters which are inserted by this layout algorithm (much -- like Haskell). This is convenient because the actual grammar can be -- specified apart from the indentation rules. Haskell has a few -- problematic productions which make it impossible to implement a purely -- lexical layout algorithm, so it also has an additional (and somewhat -- contentious) parser error side condition. PureScript does not have -- these problematic productions (particularly foo, bar :: SomeType -- syntax in declarations), but it does have a few gotchas of it's own. -- The algorithm is "non-trivial" to say the least, but it is implemented -- as a purely lexical delimiter parser on a token-by-token basis, which -- is highly convenient, since it can be replicated in any language or -- toolchain. There is likely room to simplify it, but there are some -- seemingly innocuous things that complicate it. -- -- Naked commas (case, patterns, guards, fundeps) are a constant -- source of complexity, and indeed too much of this is what prevents -- Haskell from having such an algorithm. Unquoted properties for layout -- keywords introduce a domino effect of complexity since we have to mask -- and unmask any usage of . (also in foralls!) or labels in record -- literals. -- -- ## Detailed Summary -- -- ### The Problem -- -- The parser itself is unaware of indentation or other such layout -- concerns. Rather than dealing with it explicitly, the parser and its -- grammar rules are only aware of normal tokens (e.g. -- TokLowerName) and three special zero-width tokens, -- TokLayoutStart, TokLayoutSep, and -- TokLayoutEnd. This is convenient because the actual grammar -- can be specified apart from the indentation rules and other such -- layout concerns. -- -- For a simple example, the parser parses all three examples of the code -- below using the exact same grammar rules for the let keyword -- despite each example using different indentations levels: -- --
--   -- Example 1
--   let foo = 5
--       x = 2 in foo
--   
--   -- Example 2
--   let
--     bar = 5
--     y = 2
--   in bar
--   
--   -- Example 3
--   let        baz
--                    =
--                5
--              z= 2 in baz
--   
-- -- Each block of code might appear to the parser as a stream of the -- following source tokens where the { sequence represents -- TokLayoutStart, the ; sequence represents -- TokLayoutSep, and the } sequence represents -- TokLayoutEnd: - let {foo = 5;x = 2} in foo - let -- {bar = 5;y = 2} in bar - let {baz = 5;z = 2} in baz -- -- For a more complex example, consider commas: -- --
--   case one, { twoA, twoB }, [ three1
--      , three2
--      ,   do
--        { three3, three4 } <- case arg1, arg2 of
--           Nothing, _ -> { three3: 1, three4: 2 }
--           Just _, Nothing -> { three3: 2, three4: 3 }
--           _, _ -> { three3: 3, three4: 4 }
--        pure $ three3 + three4
--      ] of
--   
-- -- Which of the above 13 commas function as the separators between the -- case binders (e.g. one) in the outermost case ... of -- context? -- -- ### The Solution -- -- The parser doesn't have to care about layout concerns (e.g. -- indentation or what starts and ends a context, such as a case binder) -- because the lexer solves that problem instead. -- -- So, how does the lexer solve this problem? It follows this general -- algorithm: 1. Lex the source code text into an initial stream of -- SourceTokens that do not have any of the three special tokens -- mentioned previously. 2. On a token-by-token basis, determine whether -- the lexer should 1. insert one of the three special tokens, 2. modify -- the current context (e.g. are we within a case binder? Are we in a -- record expression?) -- -- Step 2 is handled via insertLayout and is essentially a state -- machine. The layout delimiters, (e.g. LytCase, LytBrace, -- LytProperty, and LytOf in the next section's example) -- either stop certain "rules" from applying or ensure that certain -- "rules" now apply. By "rules", we mean whether and where one of the -- three special tokens are added. The comments in the source code for -- the insertLayout algorithm call pushing these delimiters onto -- the stack "masking" and popping them off as "unmasking". Seeing when a -- layout delimiter is pushed and popped are the keys to understanding -- this algorithm. -- -- ### Walking Through an Example -- -- Before showing an example, let's remember a few things. 1. The -- TokLowerName "case" token (i.e. a "case" keyword) indicates -- the start of a case ... of context. That context includes -- case binders (like the example shown previously) that can get quite -- complex. When encountered, we may need to insert one or more of the -- three special tokens here until we encounter the terminating -- TokLowerName "of" token that signifies its end. 2. "case" and -- "of" can also appear as a record field's name. In such a context, they -- would not start or end a case ... of block. -- -- Given the below source code... -- --
--   case { case: "foo", of: "bar" } of
--   
-- -- the lexer would go through something like the following states: 1. -- Encountered TokLowerName "case". Update current context to -- "within a case of expression" by pushing the LytCase delimiter -- onto the layout delimiter stack. Insert the case token into -- the stream of source tokens. 2. Encountered TokLeftBrace. -- Update current context to "within a record expression" by pushing the -- LytBrace delimiter. Since we expect a field name to be the next -- token we see, which may include a reserved keyword, update the current -- context again to "expecting a field name" by pushing the -- LytProperty. delimiter. Insert the { token into the -- stream of source tokens. 3. Encountered TokLowerName "case". -- Check the current context. Since it's a LytProperty, this is a -- field name and we shouldn't assume that the next few tokens will be -- case binders. However, since this might be a record with no more -- fields, update the current context back to "within a record -- expression" by popping the LytProperty off the layout delimiter -- stack. Insert the case token 4. Encountered -- TokColon. Insert the : token 5. Encountered -- TokLowerName "foo". Insert the foo token. 6. -- Encountered TokComma. Check the current context. Since it's a -- LytBrace, we're in a record expression and there is another -- field. Update the current context by pushing LytProperty as we -- expect a field name again. 7. Encountered TokLowerName "of". -- Check the current context. Since it's a LytProperty, this is a -- field name rather than the end of a case binder. Thus, we don't expect -- the next tokens to be the body in a case ... of body -- expression. However, since this might be a record with no more fields, -- update the current context back to "within a record expression" by -- popping the LytProperty off the stack. Insert the of -- token. 8. Encountered TokRightBrace. Check the current -- context. Since it's a LytBrace, this is the end of a record -- expression. Update the current context to "within a case of -- expression" by popping the LytBrace off the stack. Insert the -- } token. 9. Encountered TokLowername "of". Check the -- current context. Since it's a LytCase, this is the end of a -- case ... of expression and the body will follow. Update the -- current context to "body of a case of expression" by pushing -- LytOf onto the layout stack. Insert the of token into -- the stream of tokens. module Language.PureScript.CST.Layout type LayoutStack = [(SourcePos, LayoutDelim)] data LayoutDelim LytRoot :: LayoutDelim LytTopDecl :: LayoutDelim LytTopDeclHead :: LayoutDelim LytDeclGuard :: LayoutDelim LytCase :: LayoutDelim LytCaseBinders :: LayoutDelim LytCaseGuard :: LayoutDelim LytLambdaBinders :: LayoutDelim LytParen :: LayoutDelim LytBrace :: LayoutDelim LytSquare :: LayoutDelim LytIf :: LayoutDelim LytThen :: LayoutDelim LytProperty :: LayoutDelim LytForall :: LayoutDelim LytTick :: LayoutDelim LytLet :: LayoutDelim LytLetStmt :: LayoutDelim LytWhere :: LayoutDelim LytOf :: LayoutDelim LytDo :: LayoutDelim LytAdo :: LayoutDelim isIndented :: LayoutDelim -> Bool isTopDecl :: SourcePos -> LayoutStack -> Bool lytToken :: SourcePos -> Token -> SourceToken insertLayout :: SourceToken -> SourcePos -> LayoutStack -> (LayoutStack, [SourceToken]) unwindLayout :: SourcePos -> [Comment LineFeed] -> LayoutStack -> [SourceToken] instance GHC.Classes.Ord Language.PureScript.CST.Layout.LayoutDelim instance GHC.Classes.Eq Language.PureScript.CST.Layout.LayoutDelim instance GHC.Show.Show Language.PureScript.CST.Layout.LayoutDelim module Language.PureScript.CST.Flatten flattenModule :: Module a -> DList SourceToken flattenDataHead :: DataHead a -> DList SourceToken flattenDataCtor :: DataCtor a -> DList SourceToken flattenClassHead :: ClassHead a -> DList SourceToken flattenClassFundep :: ClassFundep -> DList SourceToken flattenInstance :: Instance a -> DList SourceToken flattenInstanceHead :: InstanceHead a -> DList SourceToken flattenInstanceBinding :: InstanceBinding a -> DList SourceToken flattenValueBindingFields :: ValueBindingFields a -> DList SourceToken flattenBinder :: Binder a -> DList SourceToken flattenRecordLabeled :: (a -> DList SourceToken) -> RecordLabeled a -> DList SourceToken flattenRecordAccessor :: RecordAccessor a -> DList SourceToken flattenRecordUpdate :: RecordUpdate a -> DList SourceToken flattenLambda :: Lambda a -> DList SourceToken flattenIfThenElse :: IfThenElse a -> DList SourceToken flattenCaseOf :: CaseOf a -> DList SourceToken flattenLetIn :: LetIn a -> DList SourceToken flattenDoBlock :: DoBlock a -> DList SourceToken flattenAdoBlock :: AdoBlock a -> DList SourceToken flattenDoStatement :: DoStatement a -> DList SourceToken flattenExpr :: Expr a -> DList SourceToken flattenLetBinding :: LetBinding a -> DList SourceToken flattenWhere :: Where a -> DList SourceToken flattenPatternGuard :: PatternGuard a -> DList SourceToken flattenGuardedExpr :: GuardedExpr a -> DList SourceToken flattenGuarded :: Guarded a -> DList SourceToken flattenFixityFields :: FixityFields -> DList SourceToken flattenFixityOp :: FixityOp -> DList SourceToken flattenForeign :: Foreign a -> DList SourceToken flattenRole :: Role -> DList SourceToken flattenDeclaration :: Declaration a -> DList SourceToken flattenQualifiedName :: QualifiedName a -> DList SourceToken flattenName :: Name a -> DList SourceToken flattenLabel :: Label -> DList SourceToken flattenExport :: Export a -> DList SourceToken flattenDataMembers :: DataMembers a -> DList SourceToken flattenImportDecl :: ImportDecl a -> DList SourceToken flattenImport :: Import a -> DList SourceToken flattenWrapped :: (a -> DList SourceToken) -> Wrapped a -> DList SourceToken flattenSeparated :: (a -> DList SourceToken) -> Separated a -> DList SourceToken flattenOneOrDelimited :: (a -> DList SourceToken) -> OneOrDelimited a -> DList SourceToken flattenLabeled :: (a -> DList SourceToken) -> (b -> DList SourceToken) -> Labeled a b -> DList SourceToken flattenType :: Type a -> DList SourceToken flattenRow :: Row a -> DList SourceToken flattenTypeVarBinding :: TypeVarBinding a -> DList SourceToken flattenConstraint :: Constraint a -> DList SourceToken -- | This is just a simple token printer. It's not a full fledged -- formatter, but it is used by the layout golden tests. Printing each -- token in the tree with this printer will result in the exact input -- that was given to the lexer. module Language.PureScript.CST.Print printToken :: Token -> Text printTokens :: [SourceToken] -> Text printModule :: Module a -> Text printLeadingComment :: Comment LineFeed -> Text printTrailingComment :: Comment void -> Text module Language.PureScript.CST.Errors data ParserErrorInfo a ParserErrorInfo :: SourceRange -> [SourceToken] -> LayoutStack -> a -> ParserErrorInfo a [errRange] :: ParserErrorInfo a -> SourceRange [errToks] :: ParserErrorInfo a -> [SourceToken] [errStack] :: ParserErrorInfo a -> LayoutStack [errType] :: ParserErrorInfo a -> a data ParserErrorType ErrWildcardInType :: ParserErrorType ErrConstraintInKind :: ParserErrorType ErrHoleInType :: ParserErrorType ErrExprInBinder :: ParserErrorType ErrExprInDeclOrBinder :: ParserErrorType ErrExprInDecl :: ParserErrorType ErrBinderInDecl :: ParserErrorType ErrRecordUpdateInCtr :: ParserErrorType ErrRecordPunInUpdate :: ParserErrorType ErrRecordCtrInUpdate :: ParserErrorType ErrTypeInConstraint :: ParserErrorType ErrElseInDecl :: ParserErrorType ErrInstanceNameMismatch :: ParserErrorType ErrUnknownFundep :: ParserErrorType ErrImportInDecl :: ParserErrorType ErrGuardInLetBinder :: ParserErrorType ErrKeywordVar :: ParserErrorType ErrKeywordSymbol :: ParserErrorType ErrQuotedPun :: ParserErrorType ErrToken :: ParserErrorType ErrLineFeedInString :: ParserErrorType ErrAstralCodePointInChar :: ParserErrorType ErrCharEscape :: ParserErrorType ErrNumberOutOfRange :: ParserErrorType ErrLeadingZero :: ParserErrorType ErrExpectedFraction :: ParserErrorType ErrExpectedExponent :: ParserErrorType ErrExpectedHex :: ParserErrorType ErrReservedSymbol :: ParserErrorType ErrCharInGap :: Char -> ParserErrorType ErrModuleName :: ParserErrorType ErrQualifiedName :: ParserErrorType ErrEmptyDo :: ParserErrorType ErrLexeme :: Maybe String -> [String] -> ParserErrorType ErrConstraintInForeignImportSyntax :: ParserErrorType ErrEof :: ParserErrorType ErrCustom :: String -> ParserErrorType data ParserWarningType WarnDeprecatedRowSyntax :: ParserWarningType WarnDeprecatedForeignKindSyntax :: ParserWarningType WarnDeprecatedKindImportSyntax :: ParserWarningType WarnDeprecatedKindExportSyntax :: ParserWarningType WarnDeprecatedCaseOfOffsideSyntax :: ParserWarningType type ParserError = ParserErrorInfo ParserErrorType type ParserWarning = ParserErrorInfo ParserWarningType prettyPrintError :: ParserError -> String prettyPrintErrorMessage :: ParserError -> String prettyPrintWarningMessage :: ParserWarning -> String instance GHC.Classes.Ord Language.PureScript.CST.Errors.ParserErrorType instance GHC.Classes.Eq Language.PureScript.CST.Errors.ParserErrorType instance GHC.Show.Show Language.PureScript.CST.Errors.ParserErrorType instance GHC.Classes.Ord Language.PureScript.CST.Errors.ParserWarningType instance GHC.Classes.Eq Language.PureScript.CST.Errors.ParserWarningType instance GHC.Show.Show Language.PureScript.CST.Errors.ParserWarningType instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.CST.Errors.ParserErrorInfo a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Errors.ParserErrorInfo a) module Language.PureScript.CST.Monad type LexResult = Either (LexState, ParserError) SourceToken data LexState LexState :: SourcePos -> [Comment LineFeed] -> Text -> LayoutStack -> LexState [lexPos] :: LexState -> SourcePos [lexLeading] :: LexState -> [Comment LineFeed] [lexSource] :: LexState -> Text [lexStack] :: LexState -> LayoutStack data ParserState ParserState :: [LexResult] -> [ParserError] -> [ParserWarning] -> ParserState [parserBuff] :: ParserState -> [LexResult] [parserErrors] :: ParserState -> [ParserError] [parserWarnings] :: ParserState -> [ParserWarning] -- | A bare bones, CPS'ed `StateT s (Except e) a`. newtype ParserM e s a Parser :: (forall r. s -> (s -> e -> r) -> (s -> a -> r) -> r) -> ParserM e s a type Parser = ParserM ParserError ParserState runParser :: ParserState -> Parser a -> (ParserState, Either (NonEmpty ParserError) a) runTokenParser :: Parser a -> [LexResult] -> Either (NonEmpty ParserError) ([ParserWarning], a) throw :: e -> ParserM e s a parseError :: SourceToken -> Parser a mkParserError :: LayoutStack -> [SourceToken] -> a -> ParserErrorInfo a addFailure :: [SourceToken] -> ParserErrorType -> Parser () parseFail' :: [SourceToken] -> ParserErrorType -> Parser a parseFail :: SourceToken -> ParserErrorType -> Parser a addWarning :: [SourceToken] -> ParserWarningType -> Parser () pushBack :: SourceToken -> Parser () tryPrefix :: Parser a -> Parser b -> Parser (Maybe a, b) oneOf :: NonEmpty (Parser a) -> Parser a manyDelimited :: Token -> Token -> Token -> Parser a -> Parser [a] token :: Token -> Parser SourceToken munch :: Parser SourceToken instance GHC.Show.Show Language.PureScript.CST.Monad.LexState instance GHC.Show.Show Language.PureScript.CST.Monad.ParserState instance GHC.Base.Functor (Language.PureScript.CST.Monad.ParserM e s) instance GHC.Base.Applicative (Language.PureScript.CST.Monad.ParserM e s) instance GHC.Base.Monad (Language.PureScript.CST.Monad.ParserM e s) module Language.PureScript.CST.Utils -- | A newtype for a qualified proper name whose ProperNameType has not yet -- been determined. This is a workaround for Happy's limited support for -- polymorphism; it is used inside the parser to allow us to write just -- one parser for qualified proper names which can be used for all of the -- different ProperNameTypes (via a call to getQualifiedProperName). newtype QualifiedProperName QualifiedProperName :: (forall a. QualifiedName (ProperName a)) -> QualifiedProperName [getQualifiedProperName] :: QualifiedProperName -> forall a. QualifiedName (ProperName a) qualifiedProperName :: QualifiedName (ProperName a) -> QualifiedProperName -- | A newtype for a proper name whose ProperNameType has not yet been -- determined. This is a workaround for Happy's limited support for -- polymorphism; it is used inside the parser to allow us to write just -- one parser for proper names which can be used for all of the different -- ProperNameTypes (via a call to getProperName). newtype ProperName ProperName :: (forall a. Name (ProperName a)) -> ProperName [_getProperName] :: ProperName -> forall a. Name (ProperName a) properName :: Name (ProperName a) -> ProperName getProperName :: forall a. ProperName -> Name (ProperName a) -- | A newtype for a qualified operator name whose OpNameType has not yet -- been determined. This is a workaround for Happy's limited support for -- polymorphism; it is used inside the parser to allow us to write just -- one parser for qualified operator names which can be used for all of -- the different OpNameTypes (via a call to getQualifiedOpName). newtype QualifiedOpName QualifiedOpName :: (forall a. QualifiedName (OpName a)) -> QualifiedOpName [getQualifiedOpName] :: QualifiedOpName -> forall a. QualifiedName (OpName a) qualifiedOpName :: QualifiedName (OpName a) -> QualifiedOpName -- | A newtype for a operator name whose OpNameType has not yet been -- determined. This is a workaround for Happy's limited support for -- polymorphism; it is used inside the parser to allow us to write just -- one parser for operator names which can be used for all of the -- different OpNameTypes (via a call to getOpName). newtype OpName OpName :: (forall a. Name (OpName a)) -> OpName [getOpName] :: OpName -> forall a. Name (OpName a) opName :: Name (OpName a) -> OpName placeholder :: SourceToken unexpectedName :: SourceToken -> Name Ident unexpectedQual :: SourceToken -> QualifiedName Ident unexpectedLabel :: SourceToken -> Label unexpectedExpr :: Monoid a => [SourceToken] -> Expr a unexpectedBinder :: Monoid a => [SourceToken] -> Binder a unexpectedRecordUpdate :: Monoid a => [SourceToken] -> RecordUpdate a unexpectedRecordLabeled :: [SourceToken] -> RecordLabeled a rangeToks :: TokenRange -> [SourceToken] unexpectedToks :: (a -> TokenRange) -> ([SourceToken] -> b) -> ParserErrorType -> a -> Parser b separated :: [(SourceToken, a)] -> Separated a internalError :: String -> a toModuleName :: SourceToken -> [Text] -> Parser (Maybe ModuleName) upperToModuleName :: SourceToken -> Parser (Name ModuleName) toQualifiedName :: (Text -> a) -> SourceToken -> Parser (QualifiedName a) toName :: (Text -> a) -> SourceToken -> Parser (Name a) toLabel :: SourceToken -> Label toString :: SourceToken -> (SourceToken, PSString) toChar :: SourceToken -> (SourceToken, Char) toNumber :: SourceToken -> (SourceToken, Either Integer Double) toInt :: SourceToken -> (SourceToken, Integer) toBoolean :: SourceToken -> (SourceToken, Bool) toConstraint :: forall a. Monoid a => Type a -> Parser (Constraint a) isConstrained :: Type a -> Bool toBinderConstructor :: Monoid a => NonEmpty (Binder a) -> Parser (Binder a) toRecordFields :: Monoid a => Separated (Either (RecordLabeled (Expr a)) (RecordUpdate a)) -> Parser (Either (Separated (RecordLabeled (Expr a))) (Separated (RecordUpdate a))) checkFundeps :: ClassHead a -> Parser () data TmpModuleDecl a TmpImport :: ImportDecl a -> TmpModuleDecl a TmpChain :: Separated (Declaration a) -> TmpModuleDecl a toModuleDecls :: Monoid a => [TmpModuleDecl a] -> Parser ([ImportDecl a], [Declaration a]) checkNoWildcards :: Type a -> Parser () checkNoForalls :: Type a -> Parser () revert :: Parser a -> SourceToken -> Parser a reservedNames :: Set Text isValidModuleNamespace :: Text -> Bool -- | This is to keep the Parser.y file ASCII, otherwise -- happy will break in non-unicode locales. -- -- Related GHC issue: -- https://gitlab.haskell.org/ghc/ghc/issues/8167 isLeftFatArrow :: Text -> Bool instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CST.Utils.TmpModuleDecl a) module Language.PureScript.CST.Lexer -- | Stops at the first lexing error and replaces it with TokEof. -- Otherwise, the parser will fail when it attempts to draw a lookahead -- token. lenient :: [LexResult] -> [LexResult] lexModule :: Text -> [LexResult] -- | Lexes according to root layout rules. lex :: Text -> [LexResult] -- | Lexes according to top-level declaration context rules. lexTopLevel :: Text -> [LexResult] -- | Lexes according to some LexState. lexWithState :: LexState -> [LexResult] -- | Checks if some identifier is a valid unquoted key. isUnquotedKey :: Text -> Bool module Language.PureScript.CST.Parser parseType :: Parser (Type ()) parseExpr :: Parser (Expr ()) parseDecl :: Parser (Declaration ()) parseIdent :: Parser (Name Ident) parseOperator :: Parser OpName parseModule :: [LexResult] -> Either (NonEmpty ParserError) (PartialResult (Module ())) parseImportDeclP :: Parser (ImportDecl ()) parseDeclP :: Parser (Declaration ()) parseExprP :: Parser (Expr ()) parseTypeP :: Parser (Type ()) parseModuleNameP :: Parser (Name ModuleName) parseQualIdentP :: Parser (QualifiedName Ident) parse :: Text -> ([ParserWarning], Either (NonEmpty ParserError) (Module ())) data PartialResult a PartialResult :: a -> ([ParserWarning], Either (NonEmpty ParserError) a) -> PartialResult a [resPartial] :: PartialResult a -> a [resFull] :: PartialResult a -> ([ParserWarning], Either (NonEmpty ParserError) a) instance GHC.Base.Functor Language.PureScript.CST.Parser.PartialResult -- | Common functions for implementing generic traversals module Language.PureScript.Traversals sndM :: Functor f => (b -> f c) -> (a, b) -> f (a, c) sndM' :: Functor f => (a -> 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) eitherM :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) defS :: Monad m => st -> val -> m (st, val) -- | Data types for types module Language.PureScript.Types type SourceType = Type SourceAnn type SourceConstraint = Constraint SourceAnn -- | An identifier for the scope of a skolem variable newtype SkolemScope SkolemScope :: Int -> SkolemScope [runSkolemScope] :: SkolemScope -> Int -- | Describes how a TypeWildcard should be presented to the user during -- type checking: holes (?foo) are always emitted as errors, whereas -- unnamed wildcards (_) default to warnings, but are ignored entirely if -- they are contained by a binding with a complete (wildcard-free) type -- signature. data WildcardData HoleWildcard :: Text -> WildcardData UnnamedWildcard :: WildcardData IgnoredWildcard :: WildcardData data TypeVarVisibility TypeVarVisible :: TypeVarVisibility TypeVarInvisible :: TypeVarVisibility typeVarVisibilityPrefix :: TypeVarVisibility -> Text -- | The type of types data Type a -- | A unification variable of type Type TUnknown :: a -> Int -> Type a -- | A named type variable TypeVar :: a -> Text -> Type a -- | A type-level string TypeLevelString :: a -> PSString -> Type a -- | A type-level natural TypeLevelInt :: a -> Integer -> Type a -- | A type wildcard, as would appear in a partial type synonym TypeWildcard :: a -> WildcardData -> Type a -- | A type constructor TypeConstructor :: a -> Qualified (ProperName 'TypeName) -> Type a -- | A type operator. This will be desugared into a type constructor during -- the "operators" phase of desugaring. TypeOp :: a -> Qualified (OpName 'TypeOpName) -> Type a -- | A type application TypeApp :: a -> Type a -> Type a -> Type a -- | Explicit kind application KindApp :: a -> Type a -> Type a -> Type a -- | Forall quantifier ForAll :: a -> TypeVarVisibility -> Text -> Maybe (Type a) -> Type a -> Maybe SkolemScope -> Type a -- | A type with a set of type class constraints ConstrainedType :: a -> Constraint a -> Type a -> Type a -- | A skolem constant Skolem :: a -> Text -> Maybe (Type a) -> Int -> SkolemScope -> Type a -- | An empty row REmpty :: a -> Type a -- | A non-empty row RCons :: a -> Label -> Type a -> Type a -> Type a -- | A type with a kind annotation KindedType :: a -> Type a -> Type a -> Type a -- | Binary operator application. During the rebracketing phase of -- desugaring, this data constructor will be removed. BinaryNoParensType :: a -> Type a -> Type a -> Type a -> Type a -- | Explicit parentheses. During the rebracketing phase of desugaring, -- this data constructor will be removed. -- -- Note: although it seems this constructor is not used, it _is_ useful, -- since it prevents certain traversals from matching. ParensInType :: a -> Type a -> Type a srcTUnknown :: Int -> SourceType srcTypeVar :: Text -> SourceType srcTypeLevelString :: PSString -> SourceType srcTypeLevelInt :: Integer -> SourceType srcTypeWildcard :: SourceType srcTypeConstructor :: Qualified (ProperName 'TypeName) -> SourceType srcTypeApp :: SourceType -> SourceType -> SourceType srcKindApp :: SourceType -> SourceType -> SourceType srcForAll :: TypeVarVisibility -> Text -> Maybe SourceType -> SourceType -> Maybe SkolemScope -> SourceType srcConstrainedType :: SourceConstraint -> SourceType -> SourceType srcREmpty :: SourceType srcRCons :: Label -> SourceType -> SourceType -> SourceType srcKindedType :: SourceType -> SourceType -> SourceType pattern REmptyKinded :: forall a. a -> Maybe (Type a) -> Type a toREmptyKinded :: forall a. Type a -> Maybe (a, Maybe (Type a)) isREmpty :: forall a. Type a -> Bool -- | Additional data relevant to type class constraints data ConstraintData -- | Data to accompany a Partial constraint generated by the exhaustivity -- checker. It contains (rendered) binder information for those binders -- which were not matched, and a flag indicating whether the list was -- truncated or not. Note: we use Text here because using -- Binder would introduce a cyclic dependency in the module -- graph. PartialConstraintData :: [[Text]] -> Bool -> ConstraintData -- | A typeclass constraint data Constraint a Constraint :: a -> Qualified (ProperName 'ClassName) -> [Type a] -> [Type a] -> Maybe ConstraintData -> Constraint a -- | constraint annotation [constraintAnn] :: Constraint a -> a -- | constraint class name [constraintClass] :: Constraint a -> Qualified (ProperName 'ClassName) -- | kind arguments [constraintKindArgs] :: Constraint a -> [Type a] -- | type arguments [constraintArgs] :: Constraint a -> [Type a] -- | additional data relevant to this constraint [constraintData] :: Constraint a -> Maybe ConstraintData srcConstraint :: Qualified (ProperName 'ClassName) -> [SourceType] -> [SourceType] -> Maybe ConstraintData -> SourceConstraint mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) mapConstraintArgsAll :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a overConstraintArgsAll :: Applicative f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) constraintDataToJSON :: ConstraintData -> Value constraintToJSON :: (a -> Value) -> Constraint a -> Value typeVarVisToJSON :: TypeVarVisibility -> Value typeToJSON :: forall a. (a -> Value) -> Type a -> Value constraintDataFromJSON :: Value -> Parser ConstraintData constraintFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Constraint a) typeVarVisFromJSON :: Value -> Parser TypeVarVisibility typeFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Type a) data RowListItem a RowListItem :: a -> Label -> Type a -> RowListItem a [rowListAnn] :: RowListItem a -> a [rowListLabel] :: RowListItem a -> Label [rowListType] :: RowListItem a -> Type a srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn -- | Convert a row to a list of pairs of labels and types rowToList :: Type a -> ([RowListItem a], Type a) -- | Convert a row to a list of pairs of labels and types, sorted by the -- labels. rowToSortedList :: Type a -> ([RowListItem a], Type a) -- | Convert a list of labels and types to a row rowFromList :: ([RowListItem a], Type a) -> Type a -- | Align two rows of types, splitting them into three parts: -- -- -- -- Note: importantly, we preserve the order of the types with a given -- label. alignRowsWith :: (Label -> Type a -> Type a -> r) -> Type a -> Type a -> ([r], (([RowListItem a], Type a), ([RowListItem a], Type a))) -- | Check whether a type is a monotype isMonoType :: Type a -> Bool -- | Universally quantify a type mkForAll :: [(a, (Text, Maybe (Type a)))] -> Type a -> Type a -- | Replace a type variable, taking into account variable shadowing replaceTypeVars :: Text -> Type a -> Type a -> Type a -- | Replace named type variables with types replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a -- | Add visible type abstractions to top-level foralls. addVisibility :: [(Text, TypeVarVisibility)] -> Type a -> Type a -- | Collect all type variables appearing in a type usedTypeVariables :: Type a -> [Text] -- | Collect all free type variables appearing in a type freeTypeVariables :: Type a -> [Text] -- | Collect a complete set of kind-annotated quantifiers at the front of a -- type. completeBinderList :: Type a -> Maybe ([(a, (Text, Type a))], Type a) -- | Universally quantify over all type variables appearing free in a type quantify :: Type a -> Type a -- | Move all universal quantifiers to the front of a type moveQuantifiersToFront :: Type a -> Type a -- | Check if a type contains forall containsForAll :: Type a -> Bool unknowns :: Type a -> IntSet -- | Check if a type contains unknowns in a position that is relevant to -- constraint solving. (Kinds are not.) containsUnknowns :: Type a -> Bool eraseKindApps :: Type a -> Type a eraseForAllKindAnnotations :: Type a -> Type a unapplyTypes :: Type a -> (Type a, [Type a], [Type a]) unapplyConstraints :: Type a -> ([Constraint a], Type a) -- | Construct the type of an instance declaration from its parts. Used in -- error messages describing unnamed instances. srcInstanceType :: SourceSpan -> [(Text, SourceType)] -> Qualified (ProperName 'ClassName) -> [SourceType] -> SourceType everywhereOnTypes :: (Type a -> Type a) -> Type a -> Type a everywhereOnTypesM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) everywhereOnTypesTopDownM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r annForType :: Lens' (Type a) a getAnnForType :: Type a -> a setAnnForType :: a -> Type a -> Type a eqType :: Type a -> Type b -> Bool eqMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Bool compareType :: Type a -> Type b -> Ordering compareMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Ordering eqConstraint :: Constraint a -> Constraint b -> Bool compareConstraint :: Constraint a -> Constraint b -> Ordering instance GHC.Generics.Generic Language.PureScript.Types.SkolemScope instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.SkolemScope instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.SkolemScope instance GHC.Classes.Ord Language.PureScript.Types.SkolemScope instance GHC.Classes.Eq Language.PureScript.Types.SkolemScope instance GHC.Show.Show Language.PureScript.Types.SkolemScope instance GHC.Generics.Generic Language.PureScript.Types.WildcardData instance GHC.Classes.Ord Language.PureScript.Types.WildcardData instance GHC.Classes.Eq Language.PureScript.Types.WildcardData instance GHC.Show.Show Language.PureScript.Types.WildcardData instance GHC.Generics.Generic Language.PureScript.Types.TypeVarVisibility instance GHC.Classes.Ord Language.PureScript.Types.TypeVarVisibility instance GHC.Classes.Eq Language.PureScript.Types.TypeVarVisibility instance GHC.Show.Show Language.PureScript.Types.TypeVarVisibility instance GHC.Generics.Generic Language.PureScript.Types.ConstraintData instance GHC.Classes.Ord Language.PureScript.Types.ConstraintData instance GHC.Classes.Eq Language.PureScript.Types.ConstraintData instance GHC.Show.Show Language.PureScript.Types.ConstraintData instance Data.Traversable.Traversable Language.PureScript.Types.Type instance Data.Foldable.Foldable Language.PureScript.Types.Type instance GHC.Base.Functor Language.PureScript.Types.Type instance GHC.Generics.Generic (Language.PureScript.Types.Type a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Types.Type a) instance Data.Traversable.Traversable Language.PureScript.Types.Constraint instance Data.Foldable.Foldable Language.PureScript.Types.Constraint instance GHC.Base.Functor Language.PureScript.Types.Constraint instance GHC.Generics.Generic (Language.PureScript.Types.Constraint a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Types.Constraint a) instance Data.Traversable.Traversable Language.PureScript.Types.RowListItem instance Data.Foldable.Foldable Language.PureScript.Types.RowListItem instance GHC.Base.Functor Language.PureScript.Types.RowListItem instance GHC.Generics.Generic (Language.PureScript.Types.RowListItem a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Types.RowListItem a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Types.Type a) instance Codec.Serialise.Class.Serialise a => Codec.Serialise.Class.Serialise (Language.PureScript.Types.Type a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Types.Constraint a) instance Codec.Serialise.Class.Serialise a => Codec.Serialise.Class.Serialise (Language.PureScript.Types.Constraint a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Types.Type a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Types.Constraint a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Type Language.PureScript.AST.SourcePos.SourceAnn) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Type ()) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Type a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Constraint Language.PureScript.AST.SourcePos.SourceAnn) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Constraint ()) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Constraint a) instance GHC.Classes.Eq (Language.PureScript.Types.Type a) instance GHC.Classes.Ord (Language.PureScript.Types.Type a) instance GHC.Classes.Eq (Language.PureScript.Types.Constraint a) instance GHC.Classes.Ord (Language.PureScript.Types.Constraint a) instance Control.DeepSeq.NFData Language.PureScript.Types.ConstraintData instance Codec.Serialise.Class.Serialise Language.PureScript.Types.ConstraintData instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.ConstraintData instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.ConstraintData instance Control.DeepSeq.NFData Language.PureScript.Types.TypeVarVisibility instance Codec.Serialise.Class.Serialise Language.PureScript.Types.TypeVarVisibility instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.TypeVarVisibility instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.TypeVarVisibility instance Control.DeepSeq.NFData Language.PureScript.Types.WildcardData instance Codec.Serialise.Class.Serialise Language.PureScript.Types.WildcardData instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.WildcardData instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.WildcardData instance Control.DeepSeq.NFData Language.PureScript.Types.SkolemScope instance Codec.Serialise.Class.Serialise Language.PureScript.Types.SkolemScope module Language.PureScript.TypeClassDictionaries data TypeClassDictionaryInScope v TypeClassDictionaryInScope :: Maybe ChainId -> Integer -> v -> [(Qualified (ProperName 'ClassName), Integer)] -> Qualified (ProperName 'ClassName) -> [(Text, SourceType)] -> [SourceType] -> [SourceType] -> Maybe [SourceConstraint] -> Maybe SourceType -> TypeClassDictionaryInScope v -- | The instance chain [tcdChain] :: TypeClassDictionaryInScope v -> Maybe ChainId -- | Index of the instance chain [tcdIndex] :: TypeClassDictionaryInScope v -> Integer -- | The value with which the dictionary can be accessed at runtime [tcdValue] :: TypeClassDictionaryInScope v -> v -- | How to obtain this instance via superclass relationships [tcdPath] :: TypeClassDictionaryInScope v -> [(Qualified (ProperName 'ClassName), Integer)] -- | The name of the type class to which this type class instance applies [tcdClassName] :: TypeClassDictionaryInScope v -> Qualified (ProperName 'ClassName) -- | Quantification of type variables in the instance head and dependencies [tcdForAll] :: TypeClassDictionaryInScope v -> [(Text, SourceType)] -- | The kinds to which this type class instance applies [tcdInstanceKinds] :: TypeClassDictionaryInScope v -> [SourceType] -- | The types to which this type class instance applies [tcdInstanceTypes] :: TypeClassDictionaryInScope v -> [SourceType] -- | Type class dependencies which must be satisfied to construct this -- dictionary [tcdDependencies] :: TypeClassDictionaryInScope v -> Maybe [SourceConstraint] -- | If this instance was unnamed, the type to use when describing it in -- error messages [tcdDescription] :: TypeClassDictionaryInScope v -> Maybe SourceType type NamedDict = TypeClassDictionaryInScope (Qualified Ident) -- | Generate a name for a superclass reference which can be used in -- generated code. superclassName :: Qualified (ProperName 'ClassName) -> Integer -> Text instance GHC.Generics.Generic (Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope v) instance Data.Traversable.Traversable Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope instance Data.Foldable.Foldable Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope instance GHC.Base.Functor Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope instance GHC.Show.Show v => GHC.Show.Show (Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope v) instance Control.DeepSeq.NFData v => Control.DeepSeq.NFData (Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope v) -- | Graph-based solver for comparing type-level numbers with respect to -- reflexivity, symmetry, and transitivity properties. module Language.PureScript.TypeChecker.Entailment.IntCompare data Relation a Equal :: a -> a -> Relation a LessThan :: a -> a -> Relation a type Context a = [Relation a] type PSOrdering = Qualified (ProperName 'TypeName) solveRelation :: forall a. Ord a => Context a -> a -> a -> Maybe PSOrdering mkRelation :: Type a -> Type a -> Type a -> Maybe (Relation (Type a)) mkFacts :: [[Type a]] -> [Relation (Type a)] instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.TypeChecker.Entailment.IntCompare.Relation a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.TypeChecker.Entailment.IntCompare.Relation a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.TypeChecker.Entailment.IntCompare.Relation a) instance GHC.Base.Functor Language.PureScript.TypeChecker.Entailment.IntCompare.Relation module Language.PureScript.Environment -- | The Environment defines all values and types which are -- currently in scope: data Environment Environment :: Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -> Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) -> Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) -> Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -> Map (Qualified (ProperName 'ClassName)) TypeClassData -> Environment -- | Values currently in scope [names] :: Environment -> Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -- | Type names currently in scope [types] :: Environment -> Map (Qualified (ProperName 'TypeName)) (SourceType, 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, SourceType, [Ident]) -- | Type synonyms currently in scope [typeSynonyms] :: Environment -> Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) -- | Available type class dictionaries. When looking up Nothing in -- the outer map, this returns the map of type class dictionaries in -- local scope (ie dictionaries brought in by a constrained type). [typeClassDictionaries] :: Environment -> Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -- | Type classes [typeClasses] :: Environment -> Map (Qualified (ProperName 'ClassName)) TypeClassData -- | Information about a type class data TypeClassData TypeClassData :: [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Set Int -> Set (Set Int) -> Bool -> TypeClassData -- | A list of type argument names, and their kinds, where kind annotations -- were provided. [typeClassArguments] :: TypeClassData -> [(Text, Maybe SourceType)] -- | A list of type class members and their types. Type arguments listed -- above are considered bound in these types. [typeClassMembers] :: TypeClassData -> [(Ident, SourceType)] -- | A list of superclasses of this type class. Type arguments listed above -- are considered bound in the types appearing in these constraints. [typeClassSuperclasses] :: TypeClassData -> [SourceConstraint] -- | A list of functional dependencies for the type arguments of this -- class. [typeClassDependencies] :: TypeClassData -> [FunctionalDependency] -- | A set of indexes of type argument that are fully determined by other -- arguments via functional dependencies. This can be computed from both -- typeClassArguments and typeClassDependencies. [typeClassDeterminedArguments] :: TypeClassData -> Set Int -- | A sets of arguments that can be used to infer all other arguments. [typeClassCoveringSets] :: TypeClassData -> Set (Set Int) -- | Whether or not dictionaries for this type class are necessarily empty. [typeClassIsEmpty] :: TypeClassData -> Bool -- | A functional dependency indicates a relationship between two sets of -- type arguments in a class declaration. data FunctionalDependency FunctionalDependency :: [Int] -> [Int] -> FunctionalDependency -- | the type arguments which determine the determined type arguments [fdDeterminers] :: FunctionalDependency -> [Int] -- | the determined type arguments [fdDetermined] :: FunctionalDependency -> [Int] -- | The initial environment with no values and only the default javascript -- types defined initEnvironment :: Environment -- | A constructor for TypeClassData that computes which type class -- arguments are fully determined and argument covering sets. Fully -- determined means that this argument cannot be used when selecting a -- type class instance. A covering set is a minimal collection of -- arguments that can be used to find an instance and therefore determine -- all other type arguments. -- -- An example of the difference between determined and fully determined -- would be with the class: ```class C a b c | a -> b, b -> a, b -- -> c``` In this case, a must differ when b -- differs, and vice versa - each is determined by the other. Both -- a and b can be used in selecting a type class -- instance. However, c cannot - it is fully determined by -- a and b. -- -- Define a graph of type class arguments with edges being fundep -- determiners to determined. Each argument also has a self looping edge. -- An argument is fully determined if doesn't appear at the start of a -- path of strongly connected components. An argument is not fully -- determined otherwise. -- -- The way we compute this is by saying: an argument X is fully -- determined if there are arguments that determine X that X does not -- determine. This is the same thing: everything X determines includes -- everything in its SCC, and everything determining X is either before -- it in an SCC path, or in the same SCC. makeTypeClassData :: [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Bool -> TypeClassData type Frontier = Map IntSet (First (IntMap (NonEmpty IntSet))) computeCoveringSets :: Int -> [FunctionalDependency] -> (Set Int, Set (Set Int)) -- | 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 foreign import declaration Public :: NameKind -- | A name for member introduced by foreign import External :: NameKind -- | The kinds of a type data TypeKind -- | Data type DataType :: DataDeclType -> [(Text, Maybe SourceType, Role)] -> [(ProperName 'ConstructorName, [SourceType])] -> TypeKind -- | Type synonym TypeSynonym :: TypeKind -- | Foreign data ExternData :: [Role] -> 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 -> Text -- | Kind of ground types kindType :: SourceType kindConstraint :: SourceType kindSymbol :: SourceType kindDoc :: SourceType kindOrdering :: SourceType kindRowList :: SourceType -> SourceType kindRow :: SourceType -> SourceType kindOfREmpty :: SourceType -- | Type constructor for functions tyFunction :: SourceType -- | Type constructor for strings tyString :: SourceType -- | Type constructor for strings tyChar :: SourceType -- | Type constructor for numbers tyNumber :: SourceType -- | Type constructor for integers tyInt :: SourceType -- | Type constructor for booleans tyBoolean :: SourceType -- | Type constructor for arrays tyArray :: SourceType -- | Type constructor for records tyRecord :: SourceType tyVar :: Text -> SourceType tyForall :: Text -> SourceType -> SourceType -> SourceType -- | Smart constructor for function types function :: SourceType -> SourceType -> SourceType (-:>) :: SourceType -> SourceType -> SourceType infixr 4 -:> primClass :: Qualified (ProperName 'ClassName) -> (SourceType -> SourceType) -> [(Qualified (ProperName 'TypeName), (SourceType, TypeKind))] -- | The primitive types in the external environment with their associated -- kinds. There are also pseudo Fail, Warn, and -- Partial types that correspond to the classes with the same -- names. primTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | This Map contains all of the prim types from all Prim -- modules. allPrimTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primBooleanTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primCoerceTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primOrderingTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primRowTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primRowListTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primSymbolTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primIntTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primTypeErrorTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | The primitive class map. This just contains the Partial -- class. Partial is used as a kind of magic constraint for -- partial functions. primClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData -- | This contains all of the type classes from all Prim modules. allPrimClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primCoerceClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primRowClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primRowListClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primSymbolClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primIntClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primTypeErrorClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData -- | Finds information about data constructors from the current -- environment. lookupConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) -- | Finds information about values from the current environment. lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility) dictTypeName' :: Text -> Text dictTypeName :: ProperName a -> ProperName a isDictTypeName :: ProperName a -> Bool -- | Given the kind of a type, generate a list Nominal roles. This -- is used for opaque foreign types as well as type classes. nominalRolesForKind :: Type a -> [Role] kindArity :: Type a -> Int unapplyKinds :: Type a -> ([Type a], Type a) instance GHC.Generics.Generic Language.PureScript.Environment.FunctionalDependency instance GHC.Show.Show Language.PureScript.Environment.FunctionalDependency instance GHC.Generics.Generic Language.PureScript.Environment.TypeClassData instance GHC.Show.Show Language.PureScript.Environment.TypeClassData instance GHC.Generics.Generic Language.PureScript.Environment.NameVisibility instance GHC.Classes.Eq Language.PureScript.Environment.NameVisibility instance GHC.Show.Show Language.PureScript.Environment.NameVisibility instance GHC.Generics.Generic Language.PureScript.Environment.NameKind instance GHC.Classes.Eq Language.PureScript.Environment.NameKind instance GHC.Show.Show Language.PureScript.Environment.NameKind instance GHC.Generics.Generic Language.PureScript.Environment.DataDeclType instance GHC.Classes.Ord Language.PureScript.Environment.DataDeclType instance GHC.Classes.Eq Language.PureScript.Environment.DataDeclType instance GHC.Show.Show Language.PureScript.Environment.DataDeclType instance GHC.Generics.Generic Language.PureScript.Environment.TypeKind instance GHC.Classes.Eq Language.PureScript.Environment.TypeKind instance GHC.Show.Show Language.PureScript.Environment.TypeKind instance GHC.Generics.Generic Language.PureScript.Environment.Environment instance GHC.Show.Show Language.PureScript.Environment.Environment instance Control.DeepSeq.NFData Language.PureScript.Environment.Environment instance Control.DeepSeq.NFData Language.PureScript.Environment.TypeKind instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.TypeKind instance Control.DeepSeq.NFData Language.PureScript.Environment.DataDeclType instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.DataDeclType instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Environment.DataDeclType instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Environment.DataDeclType instance Control.DeepSeq.NFData Language.PureScript.Environment.NameKind instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.NameKind instance Control.DeepSeq.NFData Language.PureScript.Environment.NameVisibility instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.NameVisibility instance Control.DeepSeq.NFData Language.PureScript.Environment.TypeClassData instance Control.DeepSeq.NFData Language.PureScript.Environment.FunctionalDependency instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.FunctionalDependency instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Environment.FunctionalDependency instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Environment.FunctionalDependency -- | This module performs limited common subexpression elimination module Language.PureScript.CoreFn.CSE -- | Float synthetic Apps (right now, the only Apps marked as synthetic are -- type class dictionaries being fed to functions with constraints, -- superclass accessors, and instances of IsSymbol) to a new or existing -- Let as close to the top level as possible. optimizeCommonSubexpressions :: ModuleName -> [Bind Ann] -> Supply [Bind Ann] instance GHC.Classes.Eq Language.PureScript.CoreFn.CSE.BindingType instance GHC.Base.Monoid Language.PureScript.CoreFn.CSE.CSESummary instance GHC.Base.Semigroup Language.PureScript.CoreFn.CSE.CSESummary instance GHC.Generics.Generic Language.PureScript.CoreFn.CSE.CSESummary instance GHC.Classes.Ord k => GHC.Base.Semigroup (Language.PureScript.CoreFn.CSE.PluralityMap k) instance GHC.Classes.Ord k => GHC.Base.Monoid (Language.PureScript.CoreFn.CSE.PluralityMap k) module Language.PureScript.CoreFn.Optimizer -- | CoreFn optimization pass. optimizeCoreFn :: Module Ann -> Supply (Module Ann) -- | Case binders module Language.PureScript.AST.Binders -- | Data type for binders data Binder -- | Wildcard binder NullBinder :: Binder -- | A binder which matches a literal LiteralBinder :: SourceSpan -> Literal Binder -> Binder -- | A binder which binds an identifier VarBinder :: SourceSpan -> Ident -> Binder -- | A binder which matches a data constructor ConstructorBinder :: SourceSpan -> Qualified (ProperName 'ConstructorName) -> [Binder] -> Binder -- | A operator alias binder. During the rebracketing phase of desugaring, -- this data constructor will be removed. OpBinder :: SourceSpan -> Qualified (OpName 'ValueOpName) -> 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 :: SourceSpan -> Ident -> Binder -> Binder -- | A binder with source position information PositionedBinder :: SourceSpan -> [Comment] -> Binder -> Binder -- | A binder with a type annotation TypedBinder :: SourceType -> Binder -> Binder -- | Collect all names introduced in binders in an expression binderNames :: Binder -> [Ident] binderNamesWithSpans :: Binder -> [(SourceSpan, Ident)] isIrrefutable :: Binder -> Bool instance GHC.Show.Show Language.PureScript.AST.Binders.Binder instance GHC.Classes.Eq Language.PureScript.AST.Binders.Binder instance GHC.Classes.Ord Language.PureScript.AST.Binders.Binder -- | Data types for modules and declarations module Language.PureScript.AST.Declarations -- | A map of locally-bound names in scope. type Context = [(Ident, SourceType)] -- | Holds the data necessary to do type directed search for typed holes data TypeSearch -- | An Environment captured for later consumption by type directed search TSBefore :: Environment -> TypeSearch -- | Results of applying type directed search to the previously captured -- Environment TSAfter :: [(Qualified Text, SourceType)] -> Maybe [(Label, SourceType)] -> TypeSearch -- | The identifiers that fully satisfy the subsumption check [tsAfterIdentifiers] :: TypeSearch -> [(Qualified Text, SourceType)] -- | Record fields that are available on the first argument to the typed -- hole [tsAfterRecordFields] :: TypeSearch -> Maybe [(Label, SourceType)] onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch onTypeSearchTypesM :: Applicative m => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch -- | Error message hints, providing more detailed information about -- failure. data ErrorMessageHint ErrorUnifyingTypes :: SourceType -> SourceType -> ErrorMessageHint ErrorInExpression :: Expr -> ErrorMessageHint ErrorInModule :: ModuleName -> ErrorMessageHint ErrorInInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> ErrorMessageHint ErrorInSubsumption :: SourceType -> SourceType -> ErrorMessageHint ErrorInRowLabel :: Label -> ErrorMessageHint ErrorCheckingAccessor :: Expr -> PSString -> ErrorMessageHint ErrorCheckingType :: Expr -> SourceType -> ErrorMessageHint ErrorCheckingKind :: SourceType -> SourceType -> ErrorMessageHint ErrorCheckingGuard :: ErrorMessageHint ErrorInferringType :: Expr -> ErrorMessageHint ErrorInferringKind :: SourceType -> ErrorMessageHint ErrorInApplication :: Expr -> SourceType -> Expr -> ErrorMessageHint ErrorInDataConstructor :: ProperName 'ConstructorName -> ErrorMessageHint ErrorInTypeConstructor :: ProperName 'TypeName -> ErrorMessageHint ErrorInBindingGroup :: NonEmpty Ident -> ErrorMessageHint ErrorInDataBindingGroup :: [ProperName 'TypeName] -> ErrorMessageHint ErrorInTypeSynonym :: ProperName 'TypeName -> ErrorMessageHint ErrorInValueDeclaration :: Ident -> ErrorMessageHint ErrorInTypeDeclaration :: Ident -> ErrorMessageHint ErrorInTypeClassDeclaration :: ProperName 'ClassName -> ErrorMessageHint ErrorInKindDeclaration :: ProperName 'TypeName -> ErrorMessageHint ErrorInRoleDeclaration :: ProperName 'TypeName -> ErrorMessageHint ErrorInForeignImport :: Ident -> ErrorMessageHint ErrorInForeignImportData :: ProperName 'TypeName -> ErrorMessageHint ErrorSolvingConstraint :: SourceConstraint -> ErrorMessageHint MissingConstructorImportForCoercible :: Qualified (ProperName 'ConstructorName) -> ErrorMessageHint PositionedError :: NonEmpty SourceSpan -> ErrorMessageHint RelatedPositions :: NonEmpty SourceSpan -> ErrorMessageHint -- | Categories of hints data HintCategory ExprHint :: HintCategory KindHint :: HintCategory CheckHint :: HintCategory PositionHint :: HintCategory SolverHint :: HintCategory DeclarationHint :: HintCategory OtherHint :: HintCategory -- | 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 -- | Return a module's source span. getModuleSourceSpan :: Module -> SourceSpan -- | Return a module's declarations. getModuleDeclarations :: Module -> [Declaration] -- | Add an import declaration for a module if it does not already -- explicitly import it. -- -- Will not import an unqualified module if that module has already been -- imported qualified. (See #2197) addDefaultImport :: Qualified ModuleName -> Module -> Module -- | Adds import declarations to a module for an implicit Prim import and -- Prim | qualified as Prim, as necessary. importPrim :: Module -> Module data NameSource UserNamed :: NameSource CompilerNamed :: NameSource -- | An item in a list of explicit imports or exports data DeclarationRef -- | A type class TypeClassRef :: SourceSpan -> ProperName 'ClassName -> DeclarationRef -- | A type operator TypeOpRef :: SourceSpan -> OpName 'TypeOpName -> DeclarationRef -- | A type constructor with data constructors TypeRef :: SourceSpan -> ProperName 'TypeName -> Maybe [ProperName 'ConstructorName] -> DeclarationRef -- | A value ValueRef :: SourceSpan -> Ident -> DeclarationRef -- | A value-level operator ValueOpRef :: SourceSpan -> OpName 'ValueOpName -> DeclarationRef -- | A type class instance, created during typeclass desugaring TypeInstanceRef :: SourceSpan -> Ident -> NameSource -> DeclarationRef -- | A module, in its entirety ModuleRef :: SourceSpan -> ModuleName -> DeclarationRef -- | A value re-exported from another module. These will be inserted during -- elaboration in name desugaring. ReExportRef :: SourceSpan -> ExportSource -> DeclarationRef -> DeclarationRef data ExportSource ExportSource :: Maybe ModuleName -> ModuleName -> ExportSource [exportSourceImportedFrom] :: ExportSource -> Maybe ModuleName [exportSourceDefinedIn] :: ExportSource -> ModuleName declRefSourceSpan :: DeclarationRef -> SourceSpan declRefName :: DeclarationRef -> Name getTypeRef :: DeclarationRef -> Maybe (ProperName 'TypeName, Maybe [ProperName 'ConstructorName]) getTypeOpRef :: DeclarationRef -> Maybe (OpName 'TypeOpName) getValueRef :: DeclarationRef -> Maybe Ident getValueOpRef :: DeclarationRef -> Maybe (OpName 'ValueOpName) getTypeClassRef :: DeclarationRef -> Maybe (ProperName 'ClassName) isModuleRef :: DeclarationRef -> Bool -- | 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 isExplicit :: ImportDeclarationType -> Bool -- | A role declaration assigns a list of roles to a type constructor's -- parameters, e.g.: -- --
--   type role T representational phantom
--   
-- -- In this example, T is the identifier and -- [representational, phantom] is the list of roles (T -- presumably having two parameters). data RoleDeclarationData RoleDeclarationData :: !SourceAnn -> !ProperName 'TypeName -> ![Role] -> RoleDeclarationData [rdeclSourceAnn] :: RoleDeclarationData -> !SourceAnn [rdeclIdent] :: RoleDeclarationData -> !ProperName 'TypeName [rdeclRoles] :: RoleDeclarationData -> ![Role] -- | A type declaration assigns a type to an identifier, eg: -- --
--   identity :: forall a. a -> a
--   
-- -- In this example identity is the identifier and forall a. -- a -> a the type. data TypeDeclarationData TypeDeclarationData :: !SourceAnn -> !Ident -> !SourceType -> TypeDeclarationData [tydeclSourceAnn] :: TypeDeclarationData -> !SourceAnn [tydeclIdent] :: TypeDeclarationData -> !Ident [tydeclType] :: TypeDeclarationData -> !SourceType getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType) -- | A value declaration assigns a name and potential binders, to an -- expression (or multiple guarded expressions). -- --
--   double x = x + x
--   
-- -- In this example double is the identifier, x is a -- binder and x + x is the expression. data ValueDeclarationData a ValueDeclarationData :: !SourceAnn -> !Ident -> !NameKind -> ![Binder] -> !a -> ValueDeclarationData a [valdeclSourceAnn] :: ValueDeclarationData a -> !SourceAnn -- | The declared value's name [valdeclIdent] :: ValueDeclarationData a -> !Ident -- | Whether or not this value is exported/visible [valdeclName] :: ValueDeclarationData a -> !NameKind [valdeclBinders] :: ValueDeclarationData a -> ![Binder] [valdeclExpression] :: ValueDeclarationData a -> !a getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr]) pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration data DataConstructorDeclaration DataConstructorDeclaration :: !SourceAnn -> !ProperName 'ConstructorName -> ![(Ident, SourceType)] -> DataConstructorDeclaration [dataCtorAnn] :: DataConstructorDeclaration -> !SourceAnn [dataCtorName] :: DataConstructorDeclaration -> !ProperName 'ConstructorName [dataCtorFields] :: DataConstructorDeclaration -> ![(Ident, SourceType)] mapDataCtorFields :: ([(Ident, SourceType)] -> [(Ident, SourceType)]) -> DataConstructorDeclaration -> DataConstructorDeclaration traverseDataCtorFields :: Monad m => ([(Ident, SourceType)] -> m [(Ident, SourceType)]) -> DataConstructorDeclaration -> m DataConstructorDeclaration -- | The data type of declarations data Declaration -- | A data type declaration (data or newtype, name, arguments, data -- constructors) DataDeclaration :: SourceAnn -> DataDeclType -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> [DataConstructorDeclaration] -> Declaration -- | A minimal mutually recursive set of data type declarations DataBindingGroupDeclaration :: NonEmpty Declaration -> Declaration -- | A type synonym declaration (name, arguments, type) TypeSynonymDeclaration :: SourceAnn -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> SourceType -> Declaration -- | A kind signature declaration KindDeclaration :: SourceAnn -> KindSignatureFor -> ProperName 'TypeName -> SourceType -> Declaration -- | A role declaration (name, roles) RoleDeclaration :: {-# UNPACK #-} !RoleDeclarationData -> Declaration -- | A type declaration for a value (name, ty) TypeDeclaration :: {-# UNPACK #-} !TypeDeclarationData -> Declaration -- | A value declaration (name, top-level binders, optional guard, value) ValueDeclaration :: {-# UNPACK #-} !ValueDeclarationData [GuardedExpr] -> Declaration -- | A declaration paired with pattern matching in let-in expression -- (binder, optional guard, value) BoundValueDeclaration :: SourceAnn -> Binder -> Expr -> Declaration -- | A minimal mutually recursive set of value declarations BindingGroupDeclaration :: NonEmpty ((SourceAnn, Ident), NameKind, Expr) -> Declaration -- | A foreign import declaration (name, type) ExternDeclaration :: SourceAnn -> Ident -> SourceType -> Declaration -- | A data type foreign import (name, kind) ExternDataDeclaration :: SourceAnn -> ProperName 'TypeName -> SourceType -> Declaration -- | A fixity declaration FixityDeclaration :: SourceAnn -> Either ValueFixity TypeFixity -> Declaration -- | A module import (module name, qualifiedunqualifiedhiding, -- optional "qualified as" name) ImportDeclaration :: SourceAnn -> ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Declaration -- | A type class declaration (name, argument, implies, member -- declarations) TypeClassDeclaration :: SourceAnn -> ProperName 'ClassName -> [(Text, Maybe SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> [Declaration] -> Declaration -- | A type instance declaration (instance chain, chain index, name, -- dependencies, class name, instance types, member declarations) -- -- The first SourceAnn serves as the annotation for the entire -- declaration, while the second SourceAnn serves as the -- annotation for the type class and its arguments. TypeInstanceDeclaration :: SourceAnn -> SourceAnn -> ChainId -> Integer -> Either Text Ident -> [SourceConstraint] -> Qualified (ProperName 'ClassName) -> [SourceType] -> TypeInstanceBody -> Declaration data ValueFixity ValueFixity :: Fixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -> OpName 'ValueOpName -> ValueFixity data TypeFixity TypeFixity :: Fixity -> Qualified (ProperName 'TypeName) -> OpName 'TypeOpName -> TypeFixity pattern ValueFixityDeclaration :: SourceAnn -> Fixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -> OpName 'ValueOpName -> Declaration pattern TypeFixityDeclaration :: SourceAnn -> Fixity -> Qualified (ProperName 'TypeName) -> OpName 'TypeOpName -> Declaration data InstanceDerivationStrategy KnownClassStrategy :: InstanceDerivationStrategy NewtypeStrategy :: InstanceDerivationStrategy -- | The members of a type class instance declaration data TypeInstanceBody -- | This is a derived instance DerivedInstance :: TypeInstanceBody -- | This is an instance derived from a newtype NewtypeInstance :: 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 -- | What sort of declaration the kind signature applies to. data KindSignatureFor DataSig :: KindSignatureFor NewtypeSig :: KindSignatureFor TypeSynonymSig :: KindSignatureFor ClassSig :: KindSignatureFor declSourceAnn :: Declaration -> SourceAnn declSourceSpan :: Declaration -> SourceSpan declName :: Declaration -> Maybe Name -- | Test if a declaration is a value declaration isValueDecl :: Declaration -> Bool -- | Test if a declaration is a data type declaration isDataDecl :: Declaration -> Bool -- | Test if a declaration is a type synonym declaration isTypeSynonymDecl :: Declaration -> Bool -- | Test if a declaration is a module import isImportDecl :: Declaration -> Bool -- | Test if a declaration is a role declaration isRoleDecl :: 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 getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity) -- | Test if a declaration is a foreign import isExternDecl :: Declaration -> Bool -- | Test if a declaration is a type class instance declaration isTypeClassInstanceDecl :: Declaration -> Bool -- | Test if a declaration is a type class declaration isTypeClassDecl :: Declaration -> Bool -- | Test if a declaration is a kind signature declaration. isKindDecl :: 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 data Guard ConditionGuard :: Expr -> Guard PatternGuard :: Binder -> Expr -> Guard -- | The right hand side of a binder in value declarations and case -- expressions. data GuardedExpr GuardedExpr :: [Guard] -> Expr -> GuardedExpr pattern MkUnguarded :: Expr -> GuardedExpr -- | Data type for expressions and terms data Expr -- | A literal value Literal :: SourceSpan -> Literal Expr -> Expr -- | A prefix -, will be desugared UnaryMinus :: SourceSpan -> 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 -- | An record property accessor expression (e.g. `obj.x` or `_.x`). -- Anonymous arguments will be removed during desugaring and expanded -- into a lambda that reads a property from a record. Accessor :: PSString -> Expr -> Expr -- | Partial record update ObjectUpdate :: Expr -> [(PSString, Expr)] -> Expr -- | Object updates with nested support: `x { foo { bar = e } }` Replaced -- during desugaring into a Let and nested ObjectUpdates ObjectUpdateNested :: Expr -> PathTree Expr -> Expr -- | Function introduction Abs :: Binder -> Expr -> Expr -- | Function application App :: Expr -> Expr -> Expr -- | A type application (e.g. `f @Int`) VisibleTypeApp :: Expr -> SourceType -> Expr -- | Hint that an expression is unused. This is used to ignore type class -- dictionaries that are necessarily empty. The inner expression lets us -- solve subgoals before eliminating the whole expression. The code gen -- will render this as undefined, regardless of what the inner -- expression is. Unused :: Expr -> Expr -- | Variable Var :: SourceSpan -> Qualified Ident -> Expr -- | An operator. This will be desugared into a function during the -- "operators" phase of desugaring. Op :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Expr -- | Conditional (if-then-else expression) IfThenElse :: Expr -> Expr -> Expr -> Expr -- | A data constructor Constructor :: SourceSpan -> 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 -> SourceType -> Expr -- | A let binding Let :: WhereProvenance -> [Declaration] -> Expr -> Expr -- | A do-notation block Do :: Maybe ModuleName -> [DoNotationElement] -> Expr -- | An ado-notation block Ado :: Maybe ModuleName -> [DoNotationElement] -> 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 :: SourceConstraint -> Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -> [ErrorMessageHint] -> Expr -- | A placeholder for a superclass dictionary to be turned into a -- TypeClassDictionary during typechecking DeferredDictionary :: Qualified (ProperName 'ClassName) -> [SourceType] -> Expr -- | A placeholder for a type class instance to be derived during -- typechecking DerivedInstancePlaceholder :: Qualified (ProperName 'ClassName) -> InstanceDerivationStrategy -> Expr -- | A placeholder for an anonymous function argument AnonymousArgument :: Expr -- | A typed hole that will be turned into a hint/error during typechecking Hole :: Text -> Expr -- | A value with source position information PositionedValue :: SourceSpan -> [Comment] -> Expr -> Expr -- | Metadata that tells where a let binding originated data WhereProvenance -- | The let binding was originally a where clause FromWhere :: WhereProvenance -- | The let binding was always a let binding FromLet :: WhereProvenance -- | An alternative in a case statement data CaseAlternative CaseAlternative :: [Binder] -> [GuardedExpr] -> 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 -> [GuardedExpr] -- | 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 newtype PathTree t PathTree :: AssocList PSString (PathNode t) -> PathTree t data PathNode t Leaf :: t -> PathNode t Branch :: PathTree t -> PathNode t newtype AssocList k t AssocList :: [(k, t)] -> AssocList k t [runAssocList] :: AssocList k t -> [(k, t)] isTrueExpr :: Expr -> Bool isAnonymousArgument :: Expr -> Bool instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Declarations.ImportDeclarationType instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Declarations.ImportDeclarationType instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Declarations.DeclarationRef instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Declarations.DeclarationRef instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Declarations.ExportSource instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Declarations.ExportSource instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Declarations.NameSource instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Declarations.NameSource instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeSearch instance GHC.Classes.Eq Language.PureScript.AST.Declarations.HintCategory instance GHC.Show.Show Language.PureScript.AST.Declarations.HintCategory instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Declarations.NameSource instance Control.DeepSeq.NFData Language.PureScript.AST.Declarations.NameSource instance GHC.Generics.Generic Language.PureScript.AST.Declarations.NameSource instance GHC.Show.Show Language.PureScript.AST.Declarations.NameSource instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Declarations.ExportSource instance Control.DeepSeq.NFData Language.PureScript.AST.Declarations.ExportSource instance GHC.Generics.Generic Language.PureScript.AST.Declarations.ExportSource instance GHC.Show.Show Language.PureScript.AST.Declarations.ExportSource instance GHC.Classes.Ord Language.PureScript.AST.Declarations.ExportSource instance GHC.Classes.Eq Language.PureScript.AST.Declarations.ExportSource instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Declarations.DeclarationRef instance Control.DeepSeq.NFData Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Generics.Generic Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Show.Show Language.PureScript.AST.Declarations.DeclarationRef instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Declarations.ImportDeclarationType instance GHC.Generics.Generic 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.Classes.Eq Language.PureScript.AST.Declarations.RoleDeclarationData instance GHC.Show.Show Language.PureScript.AST.Declarations.RoleDeclarationData instance GHC.Classes.Eq Language.PureScript.AST.Declarations.TypeDeclarationData instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeDeclarationData instance Data.Traversable.Traversable Language.PureScript.AST.Declarations.ValueDeclarationData instance Data.Foldable.Foldable Language.PureScript.AST.Declarations.ValueDeclarationData instance GHC.Base.Functor Language.PureScript.AST.Declarations.ValueDeclarationData instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.AST.Declarations.ValueDeclarationData a) instance GHC.Classes.Eq Language.PureScript.AST.Declarations.DataConstructorDeclaration instance GHC.Show.Show Language.PureScript.AST.Declarations.DataConstructorDeclaration instance GHC.Show.Show Language.PureScript.AST.Declarations.ValueFixity instance GHC.Classes.Ord Language.PureScript.AST.Declarations.ValueFixity instance GHC.Classes.Eq Language.PureScript.AST.Declarations.ValueFixity instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeFixity instance GHC.Classes.Ord Language.PureScript.AST.Declarations.TypeFixity instance GHC.Classes.Eq Language.PureScript.AST.Declarations.TypeFixity instance GHC.Show.Show Language.PureScript.AST.Declarations.InstanceDerivationStrategy instance GHC.Generics.Generic Language.PureScript.AST.Declarations.KindSignatureFor instance GHC.Show.Show Language.PureScript.AST.Declarations.KindSignatureFor instance GHC.Classes.Ord Language.PureScript.AST.Declarations.KindSignatureFor instance GHC.Classes.Eq Language.PureScript.AST.Declarations.KindSignatureFor instance GHC.Show.Show Language.PureScript.AST.Declarations.WhereProvenance instance Data.Traversable.Traversable (Language.PureScript.AST.Declarations.AssocList k) instance GHC.Base.Functor (Language.PureScript.AST.Declarations.AssocList k) instance Data.Foldable.Foldable (Language.PureScript.AST.Declarations.AssocList k) instance (GHC.Classes.Ord k, GHC.Classes.Ord t) => GHC.Classes.Ord (Language.PureScript.AST.Declarations.AssocList k t) instance (GHC.Classes.Eq k, GHC.Classes.Eq t) => GHC.Classes.Eq (Language.PureScript.AST.Declarations.AssocList k t) instance (GHC.Show.Show k, GHC.Show.Show t) => GHC.Show.Show (Language.PureScript.AST.Declarations.AssocList k t) instance Data.Traversable.Traversable Language.PureScript.AST.Declarations.PathNode instance Data.Foldable.Foldable Language.PureScript.AST.Declarations.PathNode instance GHC.Base.Functor Language.PureScript.AST.Declarations.PathNode instance GHC.Classes.Ord t => GHC.Classes.Ord (Language.PureScript.AST.Declarations.PathNode t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Language.PureScript.AST.Declarations.PathNode t) instance GHC.Show.Show t => GHC.Show.Show (Language.PureScript.AST.Declarations.PathNode t) instance Data.Traversable.Traversable Language.PureScript.AST.Declarations.PathTree instance Data.Foldable.Foldable Language.PureScript.AST.Declarations.PathTree instance GHC.Base.Functor Language.PureScript.AST.Declarations.PathTree instance GHC.Classes.Ord t => GHC.Classes.Ord (Language.PureScript.AST.Declarations.PathTree t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Language.PureScript.AST.Declarations.PathTree t) instance GHC.Show.Show t => GHC.Show.Show (Language.PureScript.AST.Declarations.PathTree t) instance GHC.Show.Show Language.PureScript.AST.Declarations.ErrorMessageHint instance GHC.Show.Show Language.PureScript.AST.Declarations.CaseAlternative instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeInstanceBody instance GHC.Show.Show Language.PureScript.AST.Declarations.Guard instance GHC.Show.Show Language.PureScript.AST.Declarations.GuardedExpr instance GHC.Show.Show Language.PureScript.AST.Declarations.Declaration instance GHC.Show.Show Language.PureScript.AST.Declarations.DoNotationElement instance GHC.Show.Show Language.PureScript.AST.Declarations.Expr instance GHC.Show.Show Language.PureScript.AST.Declarations.Module instance Control.DeepSeq.NFData Language.PureScript.AST.Declarations.KindSignatureFor instance GHC.Classes.Eq Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Classes.Ord Language.PureScript.AST.Declarations.DeclarationRef -- | AST traversal helpers module Language.PureScript.AST.Traversals guardedExprM :: Applicative m => (Guard -> m Guard) -> (Expr -> m Expr) -> GuardedExpr -> m GuardedExpr mapGuardedExpr :: (Guard -> Guard) -> (Expr -> Expr) -> GuardedExpr -> GuardedExpr litM :: Monad m => (a -> m a) -> Literal a -> m (Literal a) everywhereOnValues :: (Declaration -> Declaration) -> (Expr -> Expr) -> (Binder -> Binder) -> (Declaration -> Declaration, Expr -> Expr, Binder -> Binder) everywhereOnValuesTopDownM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everywhereOnValuesM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everythingOnValues :: forall r. (r -> r -> r) -> (Declaration -> r) -> (Expr -> r) -> (Binder -> r) -> (CaseAlternative -> r) -> (DoNotationElement -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) everythingWithContextOnValues :: forall s r. s -> r -> (r -> r -> r) -> (s -> Declaration -> (s, r)) -> (s -> Expr -> (s, r)) -> (s -> Binder -> (s, r)) -> (s -> CaseAlternative -> (s, r)) -> (s -> DoNotationElement -> (s, r)) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) everywhereWithContextOnValues :: forall s. s -> (s -> Declaration -> (s, Declaration)) -> (s -> Expr -> (s, Expr)) -> (s -> Binder -> (s, Binder)) -> (s -> CaseAlternative -> (s, CaseAlternative)) -> (s -> DoNotationElement -> (s, DoNotationElement)) -> (s -> Guard -> (s, Guard)) -> (Declaration -> Declaration, Expr -> Expr, Binder -> Binder, CaseAlternative -> CaseAlternative, DoNotationElement -> DoNotationElement, Guard -> Guard) everywhereWithContextOnValuesM :: forall m s. Monad m => s -> (s -> Declaration -> m (s, Declaration)) -> (s -> Expr -> m (s, Expr)) -> (s -> Binder -> m (s, Binder)) -> (s -> CaseAlternative -> m (s, CaseAlternative)) -> (s -> DoNotationElement -> m (s, DoNotationElement)) -> (s -> Guard -> m (s, Guard)) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder, CaseAlternative -> m CaseAlternative, DoNotationElement -> m DoNotationElement, Guard -> m Guard) data ScopedIdent LocalIdent :: Ident -> ScopedIdent ToplevelIdent :: Ident -> ScopedIdent inScope :: Ident -> Set ScopedIdent -> Bool everythingWithScope :: forall r. Monoid r => (Set ScopedIdent -> Declaration -> r) -> (Set ScopedIdent -> Expr -> r) -> (Set ScopedIdent -> Binder -> r) -> (Set ScopedIdent -> CaseAlternative -> r) -> (Set ScopedIdent -> DoNotationElement -> r) -> (Set ScopedIdent -> Declaration -> r, Set ScopedIdent -> Expr -> r, Set ScopedIdent -> Binder -> r, Set ScopedIdent -> CaseAlternative -> r, Set ScopedIdent -> DoNotationElement -> r) accumTypes :: Monoid r => (SourceType -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) -- | Map a function over type annotations appearing inside a value overTypes :: (SourceType -> SourceType) -> Expr -> Expr instance GHC.Classes.Ord Language.PureScript.AST.Traversals.ScopedIdent instance GHC.Classes.Eq Language.PureScript.AST.Traversals.ScopedIdent instance GHC.Show.Show Language.PureScript.AST.Traversals.ScopedIdent 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. -- -- The returned declarations are in the same order as they appear in the -- export list, unless there is no export list, in which case they appear -- in the same order as they do in the source file. -- -- Kind signatures declarations are also exported if their associated -- declaration is exported. 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 -- | The initial PureScript AST module Language.PureScript.AST -- | This module implements the desugaring pass which replaces patterns in -- let-in expressions with appropriate case expressions. module Language.PureScript.Sugar.LetPattern -- | Replace every BoundValueDeclaration in Let -- expressions with Case expressions. desugarLetPatternModule :: Module -> Module -- | Common pretty-printing utility functions module Language.PureScript.Pretty.Common parensT :: Text -> Text parensPos :: Emit gen => gen -> gen -- | Generalize intercalate slightly for monoids intercalate :: Monoid m => m -> [m] -> m class (Monoid gen) => Emit gen emit :: Emit gen => Text -> gen addMapping :: Emit gen => SourceSpan -> gen data SMap SMap :: Text -> SourcePos -> SourcePos -> SMap -- | String with length and source-map entries newtype StrPos StrPos :: (SourcePos, Text, [SMap]) -> StrPos newtype PlainString PlainString :: Text -> PlainString runPlainString :: PlainString -> Text addMapping' :: Emit gen => Maybe SourceSpan -> gen bumpPos :: SourcePos -> SMap -> SMap addPos :: SourcePos -> SourcePos -> SourcePos data PrinterState PrinterState :: Int -> PrinterState [indent] :: PrinterState -> Int -- | Number of characters per indentation level blockIndent :: Int -- | Pretty print with a new indentation level withIndent :: StateT PrinterState Maybe gen -> StateT PrinterState Maybe gen -- | Get the current indentation level currentIndent :: Emit gen => StateT PrinterState Maybe gen objectKeyRequiresQuoting :: Text -> Bool -- | Place a box before another, vertically when the first box takes up -- multiple lines. before :: Box -> Box -> Box beforeWithSpace :: Box -> Box -> Box -- | Place a Box on the bottom right of another endWith :: Box -> Box -> Box instance GHC.Base.Monoid Language.PureScript.Pretty.Common.PlainString instance GHC.Base.Semigroup Language.PureScript.Pretty.Common.PlainString instance Language.PureScript.Pretty.Common.Emit Language.PureScript.Pretty.Common.PlainString instance GHC.Base.Semigroup Language.PureScript.Pretty.Common.StrPos instance GHC.Base.Monoid Language.PureScript.Pretty.Common.StrPos instance Language.PureScript.Pretty.Common.Emit Language.PureScript.Pretty.Common.StrPos -- | Pretty printer for Types module Language.PureScript.Pretty.Types data PrettyPrintType PPTUnknown :: Int -> PrettyPrintType PPTypeVar :: Text -> Maybe Text -> PrettyPrintType PPTypeLevelString :: PSString -> PrettyPrintType PPTypeLevelInt :: Integer -> PrettyPrintType PPTypeWildcard :: Maybe Text -> PrettyPrintType PPTypeConstructor :: Qualified (ProperName 'TypeName) -> PrettyPrintType PPTypeOp :: Qualified (OpName 'TypeOpName) -> PrettyPrintType PPSkolem :: Text -> Int -> PrettyPrintType PPTypeApp :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPKindArg :: PrettyPrintType -> PrettyPrintType PPConstrainedType :: PrettyPrintConstraint -> PrettyPrintType -> PrettyPrintType PPKindedType :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPBinaryNoParensType :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPParensInType :: PrettyPrintType -> PrettyPrintType PPForAll :: [(TypeVarVisibility, Text, Maybe PrettyPrintType)] -> PrettyPrintType -> PrettyPrintType PPFunction :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPRecord :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> PrettyPrintType PPRow :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> PrettyPrintType PPTruncated :: PrettyPrintType type PrettyPrintConstraint = (Qualified (ProperName 'ClassName), [PrettyPrintType], [PrettyPrintType]) convertPrettyPrintType :: Int -> Type a -> PrettyPrintType typeAsBox :: Int -> Type a -> Box typeDiffAsBox :: Int -> Type a -> Box -- | Generate a pretty-printed string representing a Type prettyPrintType :: Int -> Type a -> String -- | Generate a pretty-printed string representing a Type using -- unicode symbols where applicable prettyPrintTypeWithUnicode :: Int -> Type a -> String -- | Generate a pretty-printed string representing a suggested Type prettyPrintSuggestedType :: Type a -> String typeAtomAsBox :: Int -> Type a -> Box -- | Generate a pretty-printed string representing a Type, as it should -- appear inside parentheses prettyPrintTypeAtom :: Int -> Type a -> String prettyPrintLabel :: Label -> Text prettyPrintObjectKey :: PSString -> Text -- | 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 -> Text prettyPrintBinderAtom :: Binder -> Text -- | A collection of pretty printers for core data types: -- -- module Language.PureScript.Pretty -- | Pretty print a PSString, using PureScript escape sequences. prettyPrintString :: PSString -> Text type PrettyPrintConstraint = (Qualified (ProperName 'ClassName), [PrettyPrintType], [PrettyPrintType]) data PrettyPrintType PPTUnknown :: Int -> PrettyPrintType PPTypeVar :: Text -> Maybe Text -> PrettyPrintType PPTypeLevelString :: PSString -> PrettyPrintType PPTypeLevelInt :: Integer -> PrettyPrintType PPTypeWildcard :: Maybe Text -> PrettyPrintType PPTypeConstructor :: Qualified (ProperName 'TypeName) -> PrettyPrintType PPTypeOp :: Qualified (OpName 'TypeOpName) -> PrettyPrintType PPSkolem :: Text -> Int -> PrettyPrintType PPTypeApp :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPKindArg :: PrettyPrintType -> PrettyPrintType PPConstrainedType :: PrettyPrintConstraint -> PrettyPrintType -> PrettyPrintType PPKindedType :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPBinaryNoParensType :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPParensInType :: PrettyPrintType -> PrettyPrintType PPForAll :: [(TypeVarVisibility, Text, Maybe PrettyPrintType)] -> PrettyPrintType -> PrettyPrintType PPFunction :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPRecord :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> PrettyPrintType PPRow :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> PrettyPrintType PPTruncated :: PrettyPrintType convertPrettyPrintType :: Int -> Type a -> PrettyPrintType typeAtomAsBox :: Int -> Type a -> Box -- | Generate a pretty-printed string representing a Type, as it should -- appear inside parentheses prettyPrintTypeAtom :: Int -> Type a -> String typeAsBox :: Int -> Type a -> Box typeDiffAsBox :: Int -> Type a -> Box -- | Generate a pretty-printed string representing a Type prettyPrintType :: Int -> Type a -> String -- | Generate a pretty-printed string representing a Type using -- unicode symbols where applicable prettyPrintTypeWithUnicode :: Int -> Type a -> String -- | Generate a pretty-printed string representing a suggested Type prettyPrintSuggestedType :: Type a -> String prettyPrintLabel :: Label -> Text prettyPrintObjectKey :: PSString -> Text -- | Pretty-print an expression prettyPrintValue :: Int -> Expr -> Box prettyPrintBinderAtom :: Binder -> Text -- | Generate a pretty-printed string representing a Binder prettyPrintBinder :: Binder -> Text module Language.PureScript.Linter.Wildcards -- | Replaces `TypeWildcard _ UnnamedWildcard` with `TypeWildcard _ -- IgnoredWildcard` in places where we don't want to emit a warning about -- wildcards. -- -- The guiding principle here is that a wildcard can be ignored if there -- is a complete (wildcard-free) type signature on a binding somewhere -- between the type in which the wildcard occurs and the top level of the -- module. In particular, this means that top-level signatures containing -- wildcards are always warnings, and a top-level signature always -- prevents wildcards on inner bindings from emitting warnings. ignoreWildcardsUnderCompleteTypeSignatures :: Declaration -> Declaration module Language.PureScript.Errors -- | prettyPrintSingleError Options data PPEOptions PPEOptions :: Maybe (ColorIntensity, Color) -> Bool -> Level -> Bool -> FilePath -> [(FilePath, Text)] -> PPEOptions -- | Color code with this color... or not [ppeCodeColor] :: PPEOptions -> Maybe (ColorIntensity, Color) -- | Should write a full error message? [ppeFull] :: PPEOptions -> Bool -- | Should this report an error or a warning? [ppeLevel] :: PPEOptions -> Level -- | Should show a link to error message's doc page? [ppeShowDocs] :: PPEOptions -> Bool -- | FilePath to which the errors are relative [ppeRelativeDirectory] :: PPEOptions -> FilePath -- | Unparsed contents of source files [ppeFileContents] :: PPEOptions -> [(FilePath, Text)] -- | How critical the issue is data Level Error :: Level Warning :: Level -- | A map from rigid type variable name/unknown variable pairs to new -- variables. data TypeMap TypeMap :: Map Int (String, Int, Maybe SourceSpan) -> Map Int Int -> Int -> TypeMap -- | a map from skolems to their new names, including source and naming -- info [umSkolemMap] :: TypeMap -> Map Int (String, Int, Maybe SourceSpan) -- | a map from unification variables to their new names [umUnknownMap] :: TypeMap -> Map Int Int -- | unknowns and skolems share a source of names during renaming, to avoid -- overlaps in error messages. This is the next label for either case. [umNextIndex] :: TypeMap -> Int -- | A stack trace for an error newtype MultipleErrors MultipleErrors :: [ErrorMessage] -> MultipleErrors [runMultipleErrors] :: MultipleErrors -> [ErrorMessage] newtype ErrorSuggestion ErrorSuggestion :: Text -> ErrorSuggestion data ErrorMessage ErrorMessage :: [ErrorMessageHint] -> SimpleErrorMessage -> ErrorMessage -- | A type of error messages data SimpleErrorMessage InternalCompilerError :: Text -> Text -> SimpleErrorMessage ModuleNotFound :: ModuleName -> SimpleErrorMessage ErrorParsingFFIModule :: FilePath -> Maybe ErrorMessage -> SimpleErrorMessage ErrorParsingCSTModule :: ParserError -> SimpleErrorMessage WarningParsingCSTModule :: ParserWarning -> SimpleErrorMessage MissingFFIModule :: ModuleName -> SimpleErrorMessage UnnecessaryFFIModule :: ModuleName -> FilePath -> SimpleErrorMessage MissingFFIImplementations :: ModuleName -> [Ident] -> SimpleErrorMessage UnusedFFIImplementations :: ModuleName -> [Ident] -> SimpleErrorMessage InvalidFFIIdentifier :: ModuleName -> Text -> SimpleErrorMessage DeprecatedFFIPrime :: ModuleName -> Text -> SimpleErrorMessage DeprecatedFFICommonJSModule :: ModuleName -> FilePath -> SimpleErrorMessage UnsupportedFFICommonJSExports :: ModuleName -> [Text] -> SimpleErrorMessage UnsupportedFFICommonJSImports :: ModuleName -> [Text] -> SimpleErrorMessage -- | A description of what we were trying to do, and the error which -- occurred FileIOError :: Text -> IOError -> SimpleErrorMessage InfiniteType :: SourceType -> SimpleErrorMessage InfiniteKind :: SourceType -> SimpleErrorMessage MultipleValueOpFixities :: OpName 'ValueOpName -> SimpleErrorMessage MultipleTypeOpFixities :: OpName 'TypeOpName -> SimpleErrorMessage OrphanTypeDeclaration :: Ident -> SimpleErrorMessage OrphanKindDeclaration :: ProperName 'TypeName -> SimpleErrorMessage OrphanRoleDeclaration :: ProperName 'TypeName -> SimpleErrorMessage RedefinedIdent :: Ident -> SimpleErrorMessage OverlappingNamesInLet :: Ident -> SimpleErrorMessage UnknownName :: Qualified Name -> SimpleErrorMessage UnknownImport :: ModuleName -> Name -> SimpleErrorMessage UnknownImportDataConstructor :: ModuleName -> ProperName 'TypeName -> ProperName 'ConstructorName -> SimpleErrorMessage UnknownExport :: Name -> SimpleErrorMessage UnknownExportDataConstructor :: ProperName 'TypeName -> ProperName 'ConstructorName -> SimpleErrorMessage ScopeConflict :: Name -> [ModuleName] -> SimpleErrorMessage ScopeShadowing :: Name -> Maybe ModuleName -> [ModuleName] -> SimpleErrorMessage DeclConflict :: Name -> Name -> SimpleErrorMessage ExportConflict :: Qualified Name -> Qualified Name -> SimpleErrorMessage DuplicateModule :: ModuleName -> SimpleErrorMessage DuplicateTypeClass :: ProperName 'ClassName -> SourceSpan -> SimpleErrorMessage DuplicateInstance :: Ident -> SourceSpan -> SimpleErrorMessage DuplicateTypeArgument :: Text -> SimpleErrorMessage InvalidDoBind :: SimpleErrorMessage InvalidDoLet :: SimpleErrorMessage CycleInDeclaration :: Ident -> SimpleErrorMessage CycleInTypeSynonym :: NonEmpty (ProperName 'TypeName) -> SimpleErrorMessage CycleInTypeClassDeclaration :: NonEmpty (Qualified (ProperName 'ClassName)) -> SimpleErrorMessage CycleInKindDeclaration :: NonEmpty (Qualified (ProperName 'TypeName)) -> SimpleErrorMessage CycleInModules :: NonEmpty ModuleName -> SimpleErrorMessage NameIsUndefined :: Ident -> SimpleErrorMessage UndefinedTypeVariable :: ProperName 'TypeName -> SimpleErrorMessage PartiallyAppliedSynonym :: Qualified (ProperName 'TypeName) -> SimpleErrorMessage EscapedSkolem :: Text -> Maybe SourceSpan -> SourceType -> SimpleErrorMessage TypesDoNotUnify :: SourceType -> SourceType -> SimpleErrorMessage KindsDoNotUnify :: SourceType -> SourceType -> SimpleErrorMessage ConstrainedTypeUnified :: SourceType -> SourceType -> SimpleErrorMessage OverlappingInstances :: Qualified (ProperName 'ClassName) -> [SourceType] -> [Qualified (Either SourceType Ident)] -> SimpleErrorMessage NoInstanceFound :: SourceConstraint -> [Qualified (Either SourceType Ident)] -> Bool -> SimpleErrorMessage AmbiguousTypeVariables :: SourceType -> [(Text, Int)] -> SimpleErrorMessage UnknownClass :: Qualified (ProperName 'ClassName) -> SimpleErrorMessage PossiblyInfiniteInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage PossiblyInfiniteCoercibleInstance :: SimpleErrorMessage CannotDerive :: Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage InvalidDerivedInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> Int -> SimpleErrorMessage ExpectedTypeConstructor :: Qualified (ProperName 'ClassName) -> [SourceType] -> SourceType -> SimpleErrorMessage InvalidNewtypeInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage MissingNewtypeSuperclassInstance :: Qualified (ProperName 'ClassName) -> Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage UnverifiableSuperclassInstance :: Qualified (ProperName 'ClassName) -> Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage CannotFindDerivingType :: ProperName 'TypeName -> SimpleErrorMessage DuplicateLabel :: Label -> Maybe Expr -> SimpleErrorMessage DuplicateValueDeclaration :: Ident -> SimpleErrorMessage ArgListLengthsDiffer :: Ident -> SimpleErrorMessage OverlappingArgNames :: Maybe Ident -> SimpleErrorMessage MissingClassMember :: NonEmpty (Ident, SourceType) -> SimpleErrorMessage ExtraneousClassMember :: Ident -> Qualified (ProperName 'ClassName) -> SimpleErrorMessage ExpectedType :: SourceType -> SourceType -> SimpleErrorMessage -- | constructor name, expected argument count, actual argument count IncorrectConstructorArity :: Qualified (ProperName 'ConstructorName) -> Int -> Int -> SimpleErrorMessage ExprDoesNotHaveType :: Expr -> SourceType -> SimpleErrorMessage PropertyIsMissing :: Label -> SimpleErrorMessage AdditionalProperty :: Label -> SimpleErrorMessage OrphanInstance :: Ident -> Qualified (ProperName 'ClassName) -> Set ModuleName -> [SourceType] -> SimpleErrorMessage InvalidNewtype :: ProperName 'TypeName -> SimpleErrorMessage InvalidInstanceHead :: SourceType -> SimpleErrorMessage TransitiveExportError :: DeclarationRef -> [DeclarationRef] -> SimpleErrorMessage TransitiveDctorExportError :: DeclarationRef -> [ProperName 'ConstructorName] -> SimpleErrorMessage HiddenConstructors :: DeclarationRef -> Qualified (ProperName 'ClassName) -> SimpleErrorMessage ShadowedName :: Ident -> SimpleErrorMessage ShadowedTypeVar :: Text -> SimpleErrorMessage UnusedTypeVar :: Text -> SimpleErrorMessage UnusedName :: Ident -> SimpleErrorMessage UnusedDeclaration :: Ident -> SimpleErrorMessage WildcardInferredType :: SourceType -> Context -> SimpleErrorMessage HoleInferredType :: Text -> SourceType -> Context -> Maybe TypeSearch -> SimpleErrorMessage MissingTypeDeclaration :: Ident -> SourceType -> SimpleErrorMessage MissingKindDeclaration :: KindSignatureFor -> ProperName 'TypeName -> SourceType -> SimpleErrorMessage OverlappingPattern :: [[Binder]] -> Bool -> SimpleErrorMessage IncompleteExhaustivityCheck :: SimpleErrorMessage ImportHidingModule :: ModuleName -> SimpleErrorMessage UnusedImport :: ModuleName -> Maybe ModuleName -> SimpleErrorMessage UnusedExplicitImport :: ModuleName -> [Name] -> Maybe ModuleName -> [DeclarationRef] -> SimpleErrorMessage UnusedDctorImport :: ModuleName -> ProperName 'TypeName -> Maybe ModuleName -> [DeclarationRef] -> SimpleErrorMessage UnusedDctorExplicitImport :: ModuleName -> ProperName 'TypeName -> [ProperName 'ConstructorName] -> Maybe ModuleName -> [DeclarationRef] -> SimpleErrorMessage DuplicateSelectiveImport :: ModuleName -> SimpleErrorMessage DuplicateImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> SimpleErrorMessage DuplicateImportRef :: Name -> SimpleErrorMessage DuplicateExportRef :: Name -> SimpleErrorMessage IntOutOfRange :: Integer -> Text -> Integer -> Integer -> SimpleErrorMessage ImplicitQualifiedImport :: ModuleName -> ModuleName -> [DeclarationRef] -> SimpleErrorMessage ImplicitQualifiedImportReExport :: ModuleName -> ModuleName -> [DeclarationRef] -> SimpleErrorMessage ImplicitImport :: ModuleName -> [DeclarationRef] -> SimpleErrorMessage HidingImport :: ModuleName -> [DeclarationRef] -> SimpleErrorMessage CaseBinderLengthDiffers :: Int -> [Binder] -> SimpleErrorMessage IncorrectAnonymousArgument :: SimpleErrorMessage InvalidOperatorInBinder :: Qualified (OpName 'ValueOpName) -> Qualified Ident -> SimpleErrorMessage CannotGeneralizeRecursiveFunction :: Ident -> SourceType -> SimpleErrorMessage CannotDeriveNewtypeForData :: ProperName 'TypeName -> SimpleErrorMessage ExpectedWildcard :: ProperName 'TypeName -> SimpleErrorMessage CannotUseBindWithDo :: Ident -> SimpleErrorMessage -- | instance name, type class, expected argument count, actual argument -- count ClassInstanceArityMismatch :: Ident -> Qualified (ProperName 'ClassName) -> Int -> Int -> SimpleErrorMessage -- | a user-defined warning raised by using the Warn type class UserDefinedWarning :: SourceType -> SimpleErrorMessage -- | a declaration couldn't be used because it contained free variables UnusableDeclaration :: Ident -> [[Text]] -> SimpleErrorMessage CannotDefinePrimModules :: ModuleName -> SimpleErrorMessage MixedAssociativityError :: NonEmpty (Qualified (OpName 'AnyOpName), Associativity) -> SimpleErrorMessage NonAssociativeError :: NonEmpty (Qualified (OpName 'AnyOpName)) -> SimpleErrorMessage QuantificationCheckFailureInKind :: Text -> SimpleErrorMessage QuantificationCheckFailureInType :: [Int] -> SourceType -> SimpleErrorMessage VisibleQuantificationCheckFailureInType :: Text -> SimpleErrorMessage UnsupportedTypeInKind :: SourceType -> SimpleErrorMessage -- | Declared role was more permissive than inferred. RoleMismatch :: Text -> Role -> Role -> SimpleErrorMessage InvalidCoercibleInstanceDeclaration :: [SourceType] -> SimpleErrorMessage UnsupportedRoleDeclaration :: SimpleErrorMessage RoleDeclarationArityMismatch :: ProperName 'TypeName -> Int -> Int -> SimpleErrorMessage DuplicateRoleDeclaration :: ProperName 'TypeName -> SimpleErrorMessage CannotDeriveInvalidConstructorArg :: Qualified (ProperName 'ClassName) -> [Qualified (ProperName 'ClassName)] -> Bool -> SimpleErrorMessage CannotSkipTypeApplication :: SourceType -> SimpleErrorMessage CannotApplyExpressionOfTypeOnType :: SourceType -> SourceType -> SimpleErrorMessage -- | Get the source span for an error errorSpan :: ErrorMessage -> Maybe (NonEmpty 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 -> Text -- | 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 simple error message and source -- annotation errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors -- | Create an error set from a single simple error message and source -- annotations errorMessage'' :: NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors -- | Create an error from multiple (possibly empty) source spans, reversed -- sorted. errorMessage''' :: [SourceSpan] -> 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 -- | Add hints to an error message addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors defaultUnknownMap :: TypeMap -- | Extract nested error messages from wrapper errors unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage replaceUnknowns :: SourceType -> State TypeMap SourceType onTypesInErrorMessage :: (SourceType -> SourceType) -> ErrorMessage -> ErrorMessage onTypesInErrorMessageM :: Applicative m => (SourceType -> m SourceType) -> ErrorMessage -> m ErrorMessage errorDocUri :: ErrorMessage -> Text errorSuggestion :: SimpleErrorMessage -> Maybe ErrorSuggestion suggestionSpan :: ErrorMessage -> Maybe SourceSpan showSuggestion :: SimpleErrorMessage -> Text ansiColor :: (ColorIntensity, Color) -> String ansiColorReset :: String colorCode :: Maybe (ColorIntensity, Color) -> Text -> Text colorCodeBox :: Maybe (ColorIntensity, Color) -> Box -> Box commasAndConjunction :: Text -> [Text] -> Text -- | Default color intensity and color for code defaultCodeColor :: (ColorIntensity, Color) -- | Default options for PPEOptions defaultPPEOptions :: PPEOptions -- | Pretty print a single error, simplifying if necessary prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box prettyPrintExport :: DeclarationRef -> Text prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Text prettyPrintRef :: DeclarationRef -> Maybe Text prettyPrintKindSignatureFor :: KindSignatureFor -> Text prettyPrintSuggestedTypeSimplified :: Type a -> String -- | Pretty print multiple errors prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String -- | Pretty print multiple warnings prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String -- | Pretty print warnings as a Box prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box] -- | Pretty print errors as a Box prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box] prettyPrintMultipleErrorsWith :: PPEOptions -> String -> String -> MultipleErrors -> [Box] -- | Indent to the right, and pad on top and bottom. indent :: Box -> Box line :: Text -> Box lineS :: String -> Box renderBox :: Box -> String toTypelevelString :: Type a -> Maybe Box -- | Rethrow an error with a more detailed error message in the case of -- failure rethrow :: MonadError e m => (e -> e) -> m 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 withoutPosition :: ErrorMessage -> ErrorMessage positionedError :: SourceSpan -> ErrorMessageHint -- | 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 :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b] internalCompilerError :: (MonadError MultipleErrors m, HasCallStack) => Text -> m a instance GHC.Show.Show Language.PureScript.Errors.SimpleErrorMessage instance GHC.Show.Show Language.PureScript.Errors.ErrorMessage instance GHC.Base.Monoid Language.PureScript.Errors.MultipleErrors instance GHC.Base.Semigroup Language.PureScript.Errors.MultipleErrors instance GHC.Show.Show Language.PureScript.Errors.MultipleErrors instance GHC.Show.Show Language.PureScript.Errors.TypeMap instance GHC.Show.Show Language.PureScript.Errors.Level -- | Role inference module Language.PureScript.TypeChecker.Roles -- | Lookup the roles for a type in the environment. If the type does not -- have roles (e.g. is a type synonym or a type variable), then this -- function returns an empty list. lookupRoles :: Environment -> Qualified (ProperName 'TypeName) -> [Role] -- | Compares the inferred roles to the explicitly declared roles and -- ensures that the explicitly declared roles are not more permissive -- than the inferred ones. checkRoles :: forall m. MonadError MultipleErrors m => [(Text, Maybe SourceType, Role)] -> [Role] -> m () checkRoleDeclarationArity :: forall m. MonadError MultipleErrors m => ProperName 'TypeName -> [Role] -> Int -> m () -- | Infers roles for the given data type declaration. inferRoles :: Environment -> ModuleName -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> [DataConstructorDeclaration] -> [Role] inferDataBindingGroupRoles :: Environment -> ModuleName -> [RoleDeclarationData] -> [DataDeclaration] -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> [Role] instance GHC.Base.Semigroup Language.PureScript.TypeChecker.Roles.RoleMap instance GHC.Base.Monoid Language.PureScript.TypeChecker.Roles.RoleMap -- | Monads for type checking and type inference and associated data types module Language.PureScript.TypeChecker.Monad newtype UnkLevel UnkLevel :: NonEmpty Unknown -> UnkLevel -- | A substitution of unification variables for types. data Substitution Substitution :: Map Int SourceType -> Map Int (UnkLevel, SourceType) -> Map Int Text -> Substitution -- | Type substitution [substType] :: Substitution -> Map Int SourceType -- | Unsolved unification variables with their level (scope ordering) and -- kind [substUnsolved] :: Substitution -> Map Int (UnkLevel, SourceType) -- | The original names of unknowns [substNames] :: Substitution -> Map Int Text insertUnkName :: MonadState CheckState m => Unknown -> Text -> m () lookupUnkName :: MonadState CheckState m => Unknown -> m (Maybe Text) -- | An empty substitution emptySubstitution :: Substitution -- | State required for type checking data CheckState CheckState :: Environment -> Int -> Int -> Int -> Maybe ModuleName -> [(SourceAnn, ModuleName, ImportDeclarationType, Maybe ModuleName, Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource))] -> Substitution -> [ErrorMessageHint] -> Set (ModuleName, Qualified (ProperName 'ConstructorName)) -> CheckState -- | The current Environment [checkEnv] :: CheckState -> Environment -- | The next type unification variable [checkNextType] :: 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 module imports and their exported types. Newtype -- constructors have to be in scope for some Coercible constraints to be -- solvable, so we need to know which constructors are imported and -- whether they are actually defined in or re-exported from the imported -- modules. [checkCurrentModuleImports] :: CheckState -> [(SourceAnn, ModuleName, ImportDeclarationType, Maybe ModuleName, Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource))] -- | The current substitution [checkSubstitution] :: CheckState -> Substitution -- | The current error message hint stack. This goes into state, rather -- than using rethrow, since this way, we can provide good error -- messages during instance resolution. [checkHints] :: CheckState -> [ErrorMessageHint] -- | Newtype constructors imports required to solve Coercible constraints. -- We have to keep track of them so that we don't emit unused import -- warnings. [checkConstructorImportsForCoercible] :: CheckState -> Set (ModuleName, Qualified (ProperName 'ConstructorName)) -- | 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 (Qualified Ident) (SourceType, NameKind, NameVisibility) -> m a -> m a -- | Temporarily bind a collection of names to types bindTypes :: MonadState CheckState m => Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -> m a -> m a -- | Temporarily bind a collection of names to types withScopedTypeVars :: (MonadState CheckState m, MonadWriter MultipleErrors m) => ModuleName -> [(Text, SourceType)] -> m a -> m a withErrorMessageHint :: (MonadState CheckState m, MonadError MultipleErrors m) => ErrorMessageHint -> m a -> m a -- | These hints are added at the front, so the most nested hint occurs at -- the front, but the simplifier assumes the reverse order. getHints :: MonadState CheckState m => m [ErrorMessageHint] rethrowWithPositionTC :: (MonadState CheckState m, MonadError MultipleErrors m) => SourceSpan -> m a -> m a warnAndRethrowWithPositionTC :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a -- | Temporarily make a collection of type class dictionaries available withTypeClassDictionaries :: MonadState CheckState m => [NamedDict] -> m a -> m a -- | Get the currently available map of type class dictionaries getTypeClassDictionaries :: MonadState CheckState m => m (Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) -- | Lookup type class dictionaries in a module. lookupTypeClassDictionaries :: MonadState CheckState m => QualifiedBy -> m (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -- | Lookup type class dictionaries in a module. lookupTypeClassDictionariesForClass :: MonadState CheckState m => QualifiedBy -> Qualified (ProperName 'ClassName) -> m (Map (Qualified Ident) (NonEmpty NamedDict)) -- | Temporarily bind a collection of names to local variables bindLocalVariables :: MonadState CheckState m => [(SourceSpan, Ident, SourceType, NameVisibility)] -> m a -> m a -- | Temporarily bind a collection of names to local type variables bindLocalTypeVariables :: MonadState CheckState m => ModuleName -> [(ProperName 'TypeName, SourceType)] -> 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) => Qualified Ident -> m SourceType -- | Lookup the visibility of a value by name in the Environment getVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m NameVisibility -- | Assert that a name is visible checkVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => 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 SourceType -- | Get the current Environment getEnv :: MonadState CheckState m => m Environment -- | Get locally-bound names in context, to create an error message. getLocalContext :: MonadState CheckState m => m Context -- | 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, failing with an error, or -- succeeding with a return value and the final Environment. runCheck :: Functor m => CheckState -> StateT CheckState m a -> m (a, Environment) -- | Make an assertion, failing with an error message guardWith :: MonadError e m => e -> Bool -> m () capturingSubstitution :: MonadState CheckState m => (a -> Substitution -> b) -> m a -> m b withFreshSubstitution :: MonadState CheckState m => m a -> m a withoutWarnings :: MonadWriter w m => m a -> m (a, w) unsafeCheckCurrentModule :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => m ModuleName debugEnv :: Environment -> [String] debugType :: Type a -> String debugConstraint :: Constraint a -> String debugTypes :: Environment -> [String] debugNames :: Environment -> [String] debugDataConstructors :: Environment -> [String] debugTypeSynonyms :: Environment -> [String] debugTypeClassDictionaries :: Environment -> [String] debugTypeClasses :: Environment -> [String] debugValue :: Expr -> String debugSubstitution :: Substitution -> [String] instance GHC.Show.Show Language.PureScript.TypeChecker.Monad.UnkLevel instance GHC.Classes.Eq Language.PureScript.TypeChecker.Monad.UnkLevel instance GHC.Classes.Ord Language.PureScript.TypeChecker.Monad.UnkLevel -- | Functions for replacing fully applied type synonyms module Language.PureScript.TypeChecker.Synonyms -- | Type synonym information (arguments with kinds, aliased type), indexed -- by name type SynonymMap = Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) type KindMap = Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | Replace fully applied type synonyms replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => SourceType -> m SourceType -- | Replace fully applied type synonyms by explicitly providing a -- SynonymMap. replaceAllTypeSynonymsM :: MonadError MultipleErrors m => SynonymMap -> KindMap -> SourceType -> m SourceType -- | 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 occurrence of a ForAll introduceSkolemScope :: MonadState CheckState m => Type a -> m (Type a) -- | Generate a new skolem scope newSkolemScope :: MonadState CheckState m => m SkolemScope -- | Skolemize a type variable by replacing its instances with fresh skolem -- constants skolemize :: a -> Text -> Maybe (Type a) -> Int -> SkolemScope -> Type a -> Type a -- | This function skolemizes type variables appearing in any type -- signatures or DeferredDictionary placeholders. These type -- variables are the only places where scoped type variables can appear -- in expressions. skolemizeTypesInValue :: SourceAnn -> Text -> Maybe SourceType -> Int -> SkolemScope -> Expr -> Expr -- | Ensure skolem variables do not escape their scope -- -- Every skolem variable is created when a ForAll type is -- skolemized. This determines the scope of that skolem variable, which -- is copied from the SkolemScope field of the ForAll -- constructor. -- -- This function traverses the tree top-down, and collects any -- SkolemScopes introduced by ForAlls. If a Skolem -- is encountered whose SkolemScope is not in the current list, -- then we have found an escaped skolem variable. skolemEscapeCheck :: MonadError MultipleErrors m => Expr -> m () -- | 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, HasCallStack) => SourceType -> m (SourceType, SourceType) kindOfWithUnknowns :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m (([(Unknown, SourceType)], SourceType), SourceType) -- | Infer the kind of a single type, returning the kinds of any scoped -- type variables kindOfWithScopedVars :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m (([(Text, SourceType)], SourceType), SourceType) kindOfData :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> DataDeclarationArgs -> m DataDeclarationResult kindOfTypeSynonym :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> TypeDeclarationArgs -> m TypeDeclarationResult kindOfClass :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> ClassDeclarationArgs -> m ClassDeclarationResult kindsOfAll :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> [TypeDeclarationArgs] -> [DataDeclarationArgs] -> [ClassDeclarationArgs] -> m ([TypeDeclarationResult], [DataDeclarationResult], [ClassDeclarationResult]) unifyKinds :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () -- | Does not attach positions to the error node, instead relies on the | -- local position context. This is useful when invoking kind unification -- | outside of kind checker internals. unifyKinds' :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () subsumesKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () instantiateKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => (SourceType, SourceType) -> SourceType -> m SourceType checkKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m SourceType inferKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m (SourceType, SourceType) elaborateKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m SourceType checkConstraint :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => SourceConstraint -> m SourceConstraint checkInstanceDeclaration :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> InstanceDeclarationArgs -> m InstanceDeclarationResult checkKindDeclaration :: forall m. (MonadSupply m, MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> SourceType -> m SourceType -- | Check the kind of a type, failing if it is not of kind *. checkTypeKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () unknownsWithKinds :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, HasCallStack) => [Unknown] -> m [(Unknown, SourceType)] freshKind :: MonadState CheckState m => SourceSpan -> m SourceType freshKindWithKind :: MonadState CheckState m => SourceSpan -> SourceType -> m SourceType -- | Functions and instances relating to unification module Language.PureScript.TypeChecker.Unify -- | Generate a fresh type variable with an unknown kind. Avoid this if at -- all possible. freshType :: MonadState CheckState m => m SourceType -- | Generate a fresh type variable with a known kind. freshTypeWithKind :: MonadState CheckState m => SourceType -> m SourceType -- | Update the substitution to solve a type constraint solveType :: (MonadError MultipleErrors m, MonadState CheckState m) => Int -> SourceType -> m () -- | Apply a substitution to a type substituteType :: Substitution -> SourceType -> SourceType -- | Compute a list of all unknowns appearing in a type unknownsInType :: Type a -> [(a, Int)] -- | Unify two types, updating the current substitution unifyTypes :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> SourceType -> m () -- | Unify two rows, updating the current substitution -- -- Common labels are identified and unified. Remaining labels and types -- are unified with a trailing row unification variable, if appropriate. unifyRows :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> SourceType -> m () -- | Align two rows of types, splitting them into three parts: -- -- -- -- Note: importantly, we preserve the order of the types with a given -- label. alignRowsWith :: (Label -> Type a -> Type a -> r) -> Type a -> Type a -> ([r], (([RowListItem a], Type a), ([RowListItem a], Type a))) -- | Replace type wildcards with unknowns replaceTypeWildcards :: (MonadWriter MultipleErrors m, MonadState CheckState m) => SourceType -> m SourceType -- | Replace outermost unsolved unification variables with named type -- variables varIfUnknown :: forall m. MonadState CheckState m => [(Unknown, SourceType)] -> SourceType -> m SourceType -- | 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) => SourceType -> SourceType -> m (Expr -> Expr) -- | Interaction solver for Coercible constraints module Language.PureScript.TypeChecker.Entailment.Coercible -- | State of the given constraints solver. data GivenSolverState GivenSolverState :: [(SourceType, SourceType, SourceType)] -> [(SourceType, SourceType)] -> GivenSolverState -- | A set of irreducible given constraints which do not interact together. [$sel:inertGivens:GivenSolverState] :: GivenSolverState -> [(SourceType, SourceType, SourceType)] -- | Given constraints yet to be solved. [$sel:unsolvedGivens:GivenSolverState] :: GivenSolverState -> [(SourceType, SourceType)] -- | Initialize the given constraints solver state with the givens to -- solve. initialGivenSolverState :: [(SourceType, SourceType)] -> GivenSolverState -- | The given constraints solver follows these steps: -- --
    --
  1. Solving can diverge for recursive newtypes, so we check the solver -- depth and abort if we crossed an arbitrary limit.
  2. --
-- -- For instance the declarations: -- --
--   newtype N a = N (a -> N a)
--   
--   example :: forall a b. N a -> N b
--   example = coerce
--   
-- -- yield the wanted Coercible (N a) (N b) which we can unwrap on -- both sides to yield Coercible (a -> N a) (b -> N b), -- which we can then decompose back to Coercible a b and -- Coercible (N a) (N b). -- --
    --
  1. We pick a constraint from the unsolved queue. If the queue is -- empty we are done, otherwise we unify the constraint arguments kinds -- and continue.
  2. --
  3. Then we try to canonicalize the constraint.
  4. --
solveGivens :: MonadError MultipleErrors m => MonadState CheckState m => Environment -> StateT GivenSolverState m () -- | State of the wanted constraints solver. data WantedSolverState WantedSolverState :: [(SourceType, SourceType, SourceType)] -> [(SourceType, SourceType, SourceType)] -> [(SourceType, SourceType)] -> WantedSolverState -- | A set of irreducible given constraints which do not interact together, -- but which could interact with the wanteds. [$sel:inertGivens:WantedSolverState] :: WantedSolverState -> [(SourceType, SourceType, SourceType)] -- | A set of irreducible wanted constraints which do not interact -- together, nor with any given. [$sel:inertWanteds:WantedSolverState] :: WantedSolverState -> [(SourceType, SourceType, SourceType)] -- | Wanted constraints yet to be solved. [$sel:unsolvedWanteds:WantedSolverState] :: WantedSolverState -> [(SourceType, SourceType)] -- | Initialize the wanted constraints solver state with an inert set of -- givens and the two parameters of the wanted to solve. initialWantedSolverState :: [(SourceType, SourceType, SourceType)] -> SourceType -> SourceType -> WantedSolverState -- | The wanted constraints solver follows similar steps than the given -- solver, except for: -- --
    --
  1. When canonicalization fails we can swallow the error, but only if -- the wanted interacts with the givens.
  2. --
-- -- For instance the declarations: -- --
--   data D a = D a
--   type role D nominal
--   
--   example :: forall a b. Coercible (D a) (D b) => D a -> D b
--   example = coerce
--   
-- -- yield an insoluble wanted Coercible (D a) (D b) which is -- discharged by the given. But we want example :: forall a b. D a -- -> D b to fail. -- --
    --
  1. Irreducible wanted constraints don't interact with the inert -- wanteds set, because doing so would yield confusing error -- messages.
  2. --
-- -- For instance the declarations: -- --
--   data D a = D a
--   
--   example :: forall a. D a a -> D Boolean Char
--   example = coerce
--   
-- -- yield the wanted Coercible (D a a) (D Boolean Char), which is -- decomposed to the irreducibles Coercible a Boolean and -- Coercible a Char. Would we interact the latter with the -- former, we would report an insoluble Coercible Boolean Char. solveWanteds :: MonadError MultipleErrors m => MonadWriter [ErrorMessageHint] m => MonadState CheckState m => Environment -> StateT WantedSolverState m () insoluble :: SourceType -> SourceType -> SourceType -> MultipleErrors -- | Type class entailment module Language.PureScript.TypeChecker.Entailment -- | The InstanceContext tracks those constraints which can be -- satisfied. type InstanceContext = Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -- | Options for the constraint solver data SolverOptions SolverOptions :: Bool -> Bool -> SolverOptions -- | Should the solver be allowed to generalize over unsolved constraints? [solverShouldGeneralize] :: SolverOptions -> Bool -- | Should the solver be allowed to defer errors by skipping constraints? [solverDeferErrors] :: SolverOptions -> Bool -- | Replace type class dictionary placeholders with inferred type class -- dictionaries replaceTypeClassDictionaries :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => Bool -> Expr -> m (Expr, [(Ident, InstanceContext, SourceConstraint)]) -- | Add a dictionary for the constraint to the scope, and dictionaries for -- all implied superclass instances. newDictionaries :: MonadState CheckState m => [(Qualified (ProperName 'ClassName), Integer)] -> Qualified Ident -> SourceConstraint -> m [NamedDict] -- | Check that the current set of type class dictionaries entail the -- specified type class goal, and, if so, return a type class dictionary -- reference. entails :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => SolverOptions -> SourceConstraint -> InstanceContext -> [ErrorMessageHint] -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr findDicts :: InstanceContext -> Qualified (ProperName 'ClassName) -> QualifiedBy -> [TypeClassDict] instance GHC.Classes.Eq Language.PureScript.TypeChecker.Entailment.Reflectable instance GHC.Show.Show Language.PureScript.TypeChecker.Entailment.Reflectable instance GHC.Classes.Eq Language.PureScript.TypeChecker.Entailment.Evidence instance GHC.Show.Show Language.PureScript.TypeChecker.Entailment.Evidence instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.TypeChecker.Entailment.EntailsResult a) instance GHC.Base.Functor Language.PureScript.TypeChecker.Entailment.Matched instance GHC.Show.Show t => GHC.Show.Show (Language.PureScript.TypeChecker.Entailment.Matched t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Language.PureScript.TypeChecker.Entailment.Matched t) instance GHC.Base.Semigroup t => GHC.Base.Semigroup (Language.PureScript.TypeChecker.Entailment.Matched t) instance GHC.Base.Monoid t => GHC.Base.Monoid (Language.PureScript.TypeChecker.Entailment.Matched t) module Language.PureScript.TypeChecker.TypeSearch typeSearch :: Maybe [(Ident, InstanceContext, SourceConstraint)] -> Environment -> CheckState -> SourceType -> ([(Qualified Text, SourceType)], Maybe [(Label, SourceType)]) -- | 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 :: forall m. MonadError MultipleErrors m => Module -> m Module module Language.PureScript.Sugar.Operators.Common type Chain a = [Either a a] type FromOp nameType a = a -> Maybe (SourceSpan, Qualified (OpName nameType)) type Reapply nameType a = SourceSpan -> Qualified (OpName nameType) -> a -> a -> a toAssoc :: Associativity -> Assoc token :: Stream s Identity t => (t -> Maybe a) -> Parsec s u a parseValue :: Parsec (Chain a) () a parseOp :: FromOp nameType a -> Parsec (Chain a) () (SourceSpan, Qualified (OpName nameType)) matchOp :: FromOp nameType a -> Qualified (OpName nameType) -> Parsec (Chain a) () SourceSpan opTable :: [[(Qualified (OpName nameType), Associativity)]] -> FromOp nameType a -> Reapply nameType a -> [[Operator (Chain a) () Identity a]] matchOperators :: forall m a nameType. Show a => MonadError MultipleErrors m => (a -> Bool) -> (a -> Maybe (a, a, a)) -> FromOp nameType a -> Reapply nameType a -> ([[Operator (Chain a) () Identity a]] -> OperatorTable (Chain a) () Identity a) -> [[(Qualified (OpName nameType), Associativity)]] -> a -> m a module Language.PureScript.Sugar.Operators.Types matchTypeOperators :: MonadError MultipleErrors m => SourceSpan -> [[(Qualified (OpName 'TypeOpName), Associativity)]] -> SourceType -> m SourceType module Language.PureScript.Sugar.Operators.Expr matchExprOperators :: MonadError MultipleErrors m => [[(Qualified (OpName 'ValueOpName), Associativity)]] -> Expr -> m Expr module Language.PureScript.Sugar.Operators.Binders matchBinderOperators :: MonadError MultipleErrors m => [[(Qualified (OpName 'ValueOpName), Associativity)]] -> Binder -> m Binder module Language.PureScript.Sugar.ObjectWildcards desugarObjectConstructors :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module desugarDecl :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration 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 -> SourceSpan -> ImportProvenance -> ImportRecord a [importName] :: ImportRecord a -> Qualified a [importSourceModule] :: ImportRecord a -> ModuleName [importSourceSpan] :: ImportRecord a -> SourceSpan [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 Prim :: ImportProvenance -- | The imported declarations for a module, including the module's own -- members. data Imports Imports :: ImportMap (ProperName 'TypeName) -> ImportMap (OpName 'TypeOpName) -> ImportMap (ProperName 'ConstructorName) -> ImportMap (ProperName 'ClassName) -> ImportMap Ident -> ImportMap (OpName 'ValueOpName) -> Set ModuleName -> Set ModuleName -> ImportMap (ProperName 'TypeName) -> Imports -- | Local names for types within a module mapped to their qualified names [importedTypes] :: Imports -> ImportMap (ProperName 'TypeName) -- | Local names for type operators within a module mapped to their -- qualified names [importedTypeOps] :: Imports -> ImportMap (OpName 'TypeOpName) -- | Local names for data constructors within a module mapped to their -- qualified names [importedDataConstructors] :: Imports -> ImportMap (ProperName 'ConstructorName) -- | Local names for classes within a module mapped to their qualified -- names [importedTypeClasses] :: Imports -> ImportMap (ProperName 'ClassName) -- | Local names for values within a module mapped to their qualified names [importedValues] :: Imports -> ImportMap Ident -- | Local names for value operators within a module mapped to their -- qualified names [importedValueOps] :: Imports -> ImportMap (OpName 'ValueOpName) -- | The name of modules that have been imported into the current scope -- that can be re-exported. If a module is imported with as -- qualification, the as name appears here, otherwise the -- original name. [importedModules] :: Imports -> Set ModuleName -- | The "as" names of modules that have been imported qualified. [importedQualModules] :: Imports -> Set ModuleName -- | Local names for kinds within a module mapped to their qualified names [importedKinds] :: Imports -> ImportMap (ProperName 'TypeName) nullImports :: Imports -- | The exported declarations from a module. data Exports Exports :: Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) -> Map (OpName 'TypeOpName) ExportSource -> Map (ProperName 'ClassName) ExportSource -> Map Ident ExportSource -> Map (OpName 'ValueOpName) ExportSource -> Exports -- | The exported types along with the module they originally came from. [exportedTypes] :: Exports -> Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) -- | The exported type operators along with the module they originally came -- from. [exportedTypeOps] :: Exports -> Map (OpName 'TypeOpName) ExportSource -- | The exported classes along with the module they originally came from. [exportedTypeClasses] :: Exports -> Map (ProperName 'ClassName) ExportSource -- | The exported values along with the module they originally came from. [exportedValues] :: Exports -> Map Ident ExportSource -- | The exported value operators along with the module they originally -- came from. [exportedValueOps] :: Exports -> Map (OpName 'ValueOpName) ExportSource -- | 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 modules. primEnv :: Env -- | The exported types from the Prim module primExports :: Exports -- | Extracts the Exports from an Env value. envModuleExports :: (a, b, Exports) -> Exports -- | When updating the Exports the behaviour is slightly different -- depending on whether we are exporting values defined within the module -- or elaborating re-exported values. This type is used to indicate which -- behaviour should be used. data ExportMode Internal :: ExportMode ReExport :: ExportMode -- | Safely adds a type and its data constructors to some exports, -- returning an error if a conflict occurs. exportType :: MonadError MultipleErrors m => SourceSpan -> ExportMode -> Exports -> ProperName 'TypeName -> [ProperName 'ConstructorName] -> ExportSource -> m Exports -- | Safely adds a type operator to some exports, returning an error if a -- conflict occurs. exportTypeOp :: MonadError MultipleErrors m => SourceSpan -> Exports -> OpName 'TypeOpName -> ExportSource -> m Exports -- | Safely adds a class to some exports, returning an error if a conflict -- occurs. exportTypeClass :: MonadError MultipleErrors m => SourceSpan -> ExportMode -> Exports -> ProperName 'ClassName -> ExportSource -> m Exports -- | Safely adds a value to some exports, returning an error if a conflict -- occurs. exportValue :: MonadError MultipleErrors m => SourceSpan -> Exports -> Ident -> ExportSource -> m Exports -- | Safely adds a value operator to some exports, returning an error if a -- conflict occurs. exportValueOp :: MonadError MultipleErrors m => SourceSpan -> Exports -> OpName 'ValueOpName -> ExportSource -> m Exports -- | When reading a value from the imports, check that there are no -- conflicts in scope. checkImportConflicts :: forall m a. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> ModuleName -> (a -> Name) -> [ImportRecord a] -> m (ModuleName, ModuleName) 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 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.Show.Show Language.PureScript.Sugar.Names.Env.Imports instance GHC.Show.Show Language.PureScript.Sugar.Names.Env.Exports instance GHC.Show.Show Language.PureScript.Sugar.Names.Env.ExportMode instance GHC.Classes.Eq Language.PureScript.Sugar.Names.Env.ExportMode module Language.PureScript.Sugar.Names.Imports type ImportDef = (SourceSpan, ImportDeclarationType, Maybe ModuleName) -- | Constructs a set of imports for a module. resolveImports :: forall m. MonadError MultipleErrors m => Env -> Module -> m (Module, Imports) -- | Constructs a set of imports for a single module import. resolveModuleImport :: forall m. MonadError MultipleErrors m => Env -> Imports -> (ModuleName, [(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 :: [Declaration] -> Map ModuleName [ImportDef] module Language.PureScript.Sugar.Names.Common -- | Warns about duplicate values in a list of declaration refs. warnDuplicateRefs :: MonadWriter MultipleErrors m => SourceSpan -> (Name -> SimpleErrorMessage) -> [DeclarationRef] -> m () module Language.PureScript.Sugar.Names.Exports -- | Finds all exportable members of a module, disregarding any explicit -- exports. findExportable :: forall m. 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 :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Env -> SourceSpan -> ModuleName -> Imports -> Exports -> [DeclarationRef] -> m Exports -- | This module implements the desugaring pass which replaces do-notation -- statements with appropriate calls to bind. module Language.PureScript.Sugar.DoNotation -- | Replace all DoNotationBind and DoNotationValue -- constructors with applications of the bind function in scope, and all -- DoNotationLet constructors with let expressions. desugarDoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m 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 :: forall m. (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 desugarCaseGuards :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] -- | 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 :: forall m. 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] instance GHC.Show.Show Language.PureScript.Sugar.BindingGroups.VertexType instance GHC.Classes.Ord Language.PureScript.Sugar.BindingGroups.VertexType instance GHC.Classes.Eq Language.PureScript.Sugar.BindingGroups.VertexType -- | This module implements the desugaring pass which replaces ado-notation -- statements with appropriate calls to pure and apply. module Language.PureScript.Sugar.AdoNotation -- | Replace all AdoNotationBind and AdoNotationValue -- constructors with applications of the pure and apply functions in -- scope, and all AdoNotationLet constructors with let -- expressions. desugarAdoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module -- | Provides the ability to sort modules based on module dependencies module Language.PureScript.ModuleDependencies data DependencyDepth Direct :: DependencyDepth Transitive :: DependencyDepth -- | Sort a collection of modules based on module dependencies. -- -- Reports an error if the module graph contains a cycle. sortModules :: forall m a. MonadError MultipleErrors m => DependencyDepth -> (a -> ModuleSignature) -> [a] -> m ([a], ModuleGraph) -- | A list of modules with their transitive dependencies type ModuleGraph = [(ModuleName, [ModuleName])] -- | A module signature for sorting dependencies. data ModuleSignature ModuleSignature :: SourceSpan -> ModuleName -> [(ModuleName, SourceSpan)] -> ModuleSignature [sigSourceSpan] :: ModuleSignature -> SourceSpan [sigModuleName] :: ModuleSignature -> ModuleName [sigImports] :: ModuleSignature -> [(ModuleName, SourceSpan)] moduleSignature :: Module -> ModuleSignature module Language.PureScript.Linter.Imports -- | Find and warn on: -- -- lintImports :: forall m. MonadWriter MultipleErrors m => Module -> Env -> UsedImports -> m () -- | A sum of the possible name types, useful for error and lint messages. data Name IdentName :: Ident -> Name ValOpName :: OpName 'ValueOpName -> Name TyName :: ProperName 'TypeName -> Name TyOpName :: OpName 'TypeOpName -> Name DctorName :: ProperName 'ConstructorName -> Name TyClassName :: ProperName 'ClassName -> Name ModName :: ModuleName -> Name -- | Map of module name to list of imported names from that module which -- have been used. type UsedImports = Map ModuleName [Qualified Name] -- | 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 checkExhaustiveExpr :: forall m. MonadWriter MultipleErrors m => SourceSpan -> Environment -> ModuleName -> Expr -> m Expr -- | This module implements a simple linting pass on the PureScript AST. module Language.PureScript.Linter -- | Lint the PureScript AST. | | Right now, this pass performs a shadowing -- check and a check for unused bindings. lint :: forall m. MonadWriter MultipleErrors m => Module -> m () -- | 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 :: Text -> RenderedCodeElement Keyword :: Text -> RenderedCodeElement Space :: RenderedCodeElement -- | Any symbol which you might or might not want to link to, in any -- namespace (value, type, or kind). Note that this is not related to the -- kind called Symbol for type-level strings. Symbol :: Namespace -> Text -> Link -> RenderedCodeElement Role :: Text -> 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 Text ContainingModule -- | Convert a Maybe ModuleName to a ContainingModule, -- using the obvious isomorphism. maybeToContainingModule :: Maybe ModuleName -> ContainingModule fromQualified :: Qualified a -> (ContainingModule, a) data Namespace ValueLevel :: Namespace TypeLevel :: Namespace data Link NoLink :: Link Link :: ContainingModule -> Link type FixityAlias = Qualified (Either (ProperName 'TypeName) (Either Ident (ProperName 'ConstructorName))) -- | A type representing a highly simplified version of PureScript code, -- intended for use in output formats like plain text or HTML. data 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 :: Text -> RenderedCode keyword :: Text -> RenderedCode keywordForall :: RenderedCode keywordData :: RenderedCode keywordType :: RenderedCode keywordClass :: RenderedCode keywordWhere :: RenderedCode keywordFixity :: Associativity -> RenderedCode keywordAs :: RenderedCode ident :: Qualified Ident -> RenderedCode dataCtor :: Qualified (ProperName 'ConstructorName) -> RenderedCode typeCtor :: Qualified (ProperName 'TypeName) -> RenderedCode typeOp :: Qualified (OpName 'TypeOpName) -> RenderedCode typeVar :: Text -> RenderedCode roleAnn :: Maybe Text -> RenderedCode alias :: FixityAlias -> RenderedCode aliasName :: FixityAlias -> Text -> RenderedCode 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 GHC.Classes.Ord Language.PureScript.Docs.RenderedCode.Types.Link instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.Link instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.Link instance GHC.Generics.Generic Language.PureScript.Docs.RenderedCode.Types.Namespace instance GHC.Classes.Ord Language.PureScript.Docs.RenderedCode.Types.Namespace instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.Namespace instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.Namespace 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.Base.Monoid Language.PureScript.Docs.RenderedCode.Types.RenderedCode instance GHC.Base.Semigroup 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 Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.RenderedCode.Types.RenderedCode instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.RenderedCode.Types.RenderedCodeElement instance Control.DeepSeq.NFData Language.PureScript.Docs.RenderedCode.Types.Namespace instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.RenderedCode.Types.Namespace instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Docs.RenderedCode.Types.Namespace instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.RenderedCode.Types.Link instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Docs.RenderedCode.Types.Link instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.RenderedCode.Types.ContainingModule instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Docs.RenderedCode.Types.ContainingModule -- | Functions for producing RenderedCode values from PureScript Type -- values. module Language.PureScript.Docs.RenderedCode.RenderType -- | Render code representing a Type renderType :: Type a -> RenderedCode -- | Render code representing a Type but augment the TypeVars with -- their Role if they have one renderTypeWithRole :: [Role] -> Type a -> RenderedCode renderType' :: PrettyPrintType -> RenderedCode -- | Render code representing a Type, as it should appear inside -- parentheses renderTypeAtom :: Type a -> RenderedCode renderTypeAtom' :: PrettyPrintType -> RenderedCode -- | Render code representing a Row renderRow :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> 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 -- | Data types for the imperative core AST module Language.PureScript.CoreImp.AST -- | Built-in unary operators data UnaryOperator Negate :: UnaryOperator Not :: UnaryOperator BitwiseNot :: UnaryOperator Positive :: UnaryOperator New :: UnaryOperator -- | Built-in binary operators data BinaryOperator Add :: BinaryOperator Subtract :: BinaryOperator Multiply :: BinaryOperator Divide :: BinaryOperator Modulus :: BinaryOperator EqualTo :: BinaryOperator NotEqualTo :: BinaryOperator LessThan :: BinaryOperator LessThanOrEqualTo :: BinaryOperator GreaterThan :: BinaryOperator GreaterThanOrEqualTo :: BinaryOperator And :: BinaryOperator Or :: BinaryOperator BitwiseAnd :: BinaryOperator BitwiseOr :: BinaryOperator BitwiseXor :: BinaryOperator ShiftLeft :: BinaryOperator ShiftRight :: BinaryOperator ZeroFillShiftRight :: BinaryOperator -- | Data type for CoreImp comments, which can come from either the -- PureScript source or internal transformations. data CIComments SourceComments :: [Comment] -> CIComments PureAnnotation :: CIComments -- | Indicates whether the initializer of a variable is known not to have -- side effects, and thus can be inlined if needed or removed if -- unneeded. data InitializerEffects NoEffects :: InitializerEffects UnknownEffects :: InitializerEffects -- | Data type for simplified JavaScript expressions data AST -- | A numeric literal NumericLiteral :: Maybe SourceSpan -> Either Integer Double -> AST -- | A string literal StringLiteral :: Maybe SourceSpan -> PSString -> AST -- | A boolean literal BooleanLiteral :: Maybe SourceSpan -> Bool -> AST -- | A unary operator application Unary :: Maybe SourceSpan -> UnaryOperator -> AST -> AST -- | A binary operator application Binary :: Maybe SourceSpan -> BinaryOperator -> AST -> AST -> AST -- | An array literal ArrayLiteral :: Maybe SourceSpan -> [AST] -> AST -- | An array indexer expression Indexer :: Maybe SourceSpan -> AST -> AST -> AST -- | An object literal ObjectLiteral :: Maybe SourceSpan -> [(PSString, AST)] -> AST -- | A function introduction (optional name, arguments, body) Function :: Maybe SourceSpan -> Maybe Text -> [Text] -> AST -> AST -- | Function application App :: Maybe SourceSpan -> AST -> [AST] -> AST -- | Variable Var :: Maybe SourceSpan -> Text -> AST -- | Value from another module ModuleAccessor :: Maybe SourceSpan -> ModuleName -> PSString -> AST -- | A block of expressions in braces Block :: Maybe SourceSpan -> [AST] -> AST -- | A variable introduction and optional initialization VariableIntroduction :: Maybe SourceSpan -> Text -> Maybe (InitializerEffects, AST) -> AST -- | A variable assignment Assignment :: Maybe SourceSpan -> AST -> AST -> AST -- | While loop While :: Maybe SourceSpan -> AST -> AST -> AST -- | For loop For :: Maybe SourceSpan -> Text -> AST -> AST -> AST -> AST -- | ForIn loop ForIn :: Maybe SourceSpan -> Text -> AST -> AST -> AST -- | If-then-else statement IfElse :: Maybe SourceSpan -> AST -> AST -> Maybe AST -> AST -- | Return statement Return :: Maybe SourceSpan -> AST -> AST -- | Return statement with no return value ReturnNoResult :: Maybe SourceSpan -> AST -- | Throw statement Throw :: Maybe SourceSpan -> AST -> AST -- | instanceof check InstanceOf :: Maybe SourceSpan -> AST -> AST -> AST -- | Commented JavaScript Comment :: CIComments -> AST -> AST withSourceSpan :: SourceSpan -> AST -> AST getSourceSpan :: AST -> Maybe SourceSpan everywhere :: (AST -> AST) -> AST -> AST everywhereTopDown :: (AST -> AST) -> AST -> AST everywhereTopDownM :: Monad m => (AST -> m AST) -> AST -> m AST everything :: (r -> r -> r) -> (AST -> r) -> AST -> r instance GHC.Classes.Eq Language.PureScript.CoreImp.AST.UnaryOperator instance GHC.Show.Show Language.PureScript.CoreImp.AST.UnaryOperator instance GHC.Classes.Eq Language.PureScript.CoreImp.AST.BinaryOperator instance GHC.Show.Show Language.PureScript.CoreImp.AST.BinaryOperator instance GHC.Classes.Eq Language.PureScript.CoreImp.AST.CIComments instance GHC.Show.Show Language.PureScript.CoreImp.AST.CIComments instance GHC.Classes.Eq Language.PureScript.CoreImp.AST.InitializerEffects instance GHC.Show.Show Language.PureScript.CoreImp.AST.InitializerEffects instance GHC.Classes.Eq Language.PureScript.CoreImp.AST.AST instance GHC.Show.Show Language.PureScript.CoreImp.AST.AST -- | This module implements tail call elimination. module Language.PureScript.CoreImp.Optimizer.TCO -- | Eliminate tail calls tco :: AST -> AST -- | Common functions used by the various optimizer phases module Language.PureScript.CoreImp.Optimizer.Common applyAll :: [a -> a] -> a -> a replaceIdent :: Text -> AST -> AST -> AST replaceIdents :: [(Text, AST)] -> AST -> AST isReassigned :: Text -> AST -> Bool isRebound :: AST -> AST -> Bool targetVariable :: AST -> Text isUpdated :: Text -> AST -> Bool removeFromBlock :: ([AST] -> [AST]) -> AST -> AST pattern Ref :: (ModuleName, PSString) -> AST refPatternHelper :: AST -> Maybe (ModuleName, PSString) -- | Removes unused variables module Language.PureScript.CoreImp.Optimizer.Unused removeCodeAfterReturnStatements :: AST -> AST removeUndefinedApp :: AST -> AST removeUnusedEffectFreeVars :: [Text] -> [[AST]] -> [[AST]] -- | 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.CoreImp.Optimizer.MagicDo magicDoEffect :: (AST -> AST) -> AST -> AST -- | Inline type class dictionaries for >>= and return for the Eff -- monad -- -- E.g. -- -- Prelude[">>="](dict)(m1)(function(x) { return ...; }) -- -- becomes -- -- function __do { var x = m1(); ... } magicDoEff :: (AST -> AST) -> AST -> AST magicDoST :: (AST -> AST) -> AST -> AST -- | Inline functions in the ST module inlineST :: AST -> AST -- | This module performs basic inlining of known functions module Language.PureScript.CoreImp.Optimizer.Inliner inlineVariables :: AST -> AST inlineCommonValues :: (AST -> AST) -> AST -> AST inlineCommonOperators :: (AST -> AST) -> AST -> AST inlineFnComposition :: forall m. MonadSupply m => (AST -> AST) -> AST -> m AST inlineFnIdentity :: (AST -> AST) -> AST -> AST inlineUnsafeCoerce :: AST -> AST inlineUnsafePartial :: AST -> AST etaConvert :: AST -> AST unThunk :: AST -> AST evaluateIifes :: AST -> AST -- | Optimizer steps for simplifying JavaScript blocks module Language.PureScript.CoreImp.Optimizer.Blocks -- | Collapse blocks which appear nested directly below another block collapseNestedBlocks :: AST -> AST collapseNestedIfs :: AST -> AST -- | This module optimizes code in the simplified-JavaScript intermediate -- representation. -- -- The following optimizations are supported: -- -- module Language.PureScript.CoreImp.Optimizer -- | Apply a series of optimizer passes to simplified JavaScript code optimize :: forall m. MonadSupply m => [Text] -> [[AST]] -> m [[AST]] module Language.PureScript.CoreImp.Module data Module Module :: [Comment] -> [Import] -> [AST] -> [Export] -> Module [modHeader] :: Module -> [Comment] [modImports] :: Module -> [Import] [modBody] :: Module -> [AST] [modExports] :: Module -> [Export] data Import Import :: Text -> PSString -> Import data Export Export :: NonEmpty Text -> Maybe PSString -> Export -- | The imperative core language module Language.PureScript.CoreImp 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. Returns the map of -- renamed identifiers in the top-level scope, so that they can be -- renamed in the externs files as well. renameInModule :: Module Ann -> (Map Ident Ident, Module Ann) -- | Dump the core functional representation in JSON format for consumption -- by third-party code generators module Language.PureScript.CoreFn.ToJSON moduleToJSON :: Version -> Module Ann -> Value module Language.PureScript.CoreFn.Laziness -- | Transform a recursive binding group, reordering the bindings within -- when a correct initialization order can be statically determined, and -- rewriting bindings and references to be lazy otherwise. applyLazinessTransform :: ModuleName -> [((Ann, Ident), Expr Ann)] -> ([((Ann, Ident), Expr Ann)], Any) instance GHC.Base.Functor Language.PureScript.CoreFn.Laziness.RecursiveGroupItem instance GHC.Classes.Ord a => GHC.Base.Semigroup (Language.PureScript.CoreFn.Laziness.MaxRoseNode m a) -- | Read the core functional representation from JSON format module Language.PureScript.CoreFn.FromJSON moduleFromJSON :: Value -> Parser (Version, Module Ann) parseVersion' :: String -> Maybe Version -- | This module generates code in the core imperative representation from -- elaborated PureScript code. module Language.PureScript.CodeGen.JS -- | Generate code in the simplified JavaScript intermediate representation -- for all declarations in a module. moduleToJs :: forall m. (MonadReader Options m, MonadSupply m, MonadError MultipleErrors m) => Module Ann -> Maybe PSString -> m Module -- | A collection of modules related to code generation: -- -- module Language.PureScript.CodeGen -- | Pretty printer for the JavaScript AST module Language.PureScript.CodeGen.JS.Printer prettyPrintJS :: Module -> Text -- | Generate a pretty-printed string representing a collection of -- JavaScript expressions at the same indentation level prettyPrintJSWithSourceMaps :: Module -> (Text, [SMap]) -- | This module contains functions for converting the CST into the core -- AST. It is mostly boilerplate, and does the job of resolving ranges -- for all the nodes and attaching comments. module Language.PureScript.CST.Convert convertType :: String -> Type a -> SourceType convertExpr :: forall a. String -> Expr a -> Expr convertBinder :: String -> Binder a -> Binder convertDeclaration :: String -> Declaration a -> [Declaration] convertImportDecl :: String -> ImportDecl a -> (SourceAnn, ModuleName, ImportDeclarationType, Maybe ModuleName) convertModule :: String -> Module a -> Module sourcePos :: SourcePos -> SourcePos sourceSpan :: String -> SourceRange -> SourceSpan comment :: Comment a -> Maybe Comment comments :: [Comment a] -> [Comment] module Language.PureScript.CST parseFromFile :: FilePath -> Text -> ([ParserWarning], Either (NonEmpty ParserError) Module) parseFromFiles :: forall m k. MonadError MultipleErrors m => (k -> FilePath) -> [(k, Text)] -> m [(k, ([ParserWarning], Module))] parseModuleFromFile :: FilePath -> Text -> Either (NonEmpty ParserError) (PartialResult Module) parseModulesFromFiles :: forall m k. MonadError MultipleErrors m => (k -> FilePath) -> [(k, Text)] -> m [(k, PartialResult Module)] unwrapParserError :: forall m a. MonadError MultipleErrors m => FilePath -> Either (NonEmpty ParserError) a -> m a toMultipleErrors :: FilePath -> NonEmpty ParserError -> MultipleErrors toMultipleWarnings :: FilePath -> [ParserWarning] -> MultipleErrors toPositionedError :: FilePath -> ParserError -> ErrorMessage toPositionedWarning :: FilePath -> ParserWarning -> ErrorMessage pureResult :: a -> PartialResult a type Parser = ParserM ParserError ParserState -- | A bare bones, CPS'ed `StateT s (Except e) a`. newtype ParserM e s a Parser :: (forall r. s -> (s -> e -> r) -> (s -> a -> r) -> r) -> ParserM e s a data ParserState ParserState :: [LexResult] -> [ParserError] -> [ParserWarning] -> ParserState [parserBuff] :: ParserState -> [LexResult] [parserErrors] :: ParserState -> [ParserError] [parserWarnings] :: ParserState -> [ParserWarning] type LexResult = Either (LexState, ParserError) SourceToken runParser :: ParserState -> Parser a -> (ParserState, Either (NonEmpty ParserError) a) runTokenParser :: Parser a -> [LexResult] -> Either (NonEmpty ParserError) ([ParserWarning], a) module Language.PureScript.AST.Utils lam :: Ident -> Expr -> Expr lamCase :: Ident -> [CaseAlternative] -> Expr lamCase2 :: Ident -> Ident -> [CaseAlternative] -> Expr mkRef :: Qualified Ident -> Expr mkVarMn :: Maybe ModuleName -> Ident -> Expr mkVar :: Ident -> Expr mkBinder :: Ident -> Binder mkLit :: Literal Expr -> Expr mkCtor :: ModuleName -> ProperName 'ConstructorName -> Expr mkCtorBinder :: ModuleName -> ProperName 'ConstructorName -> [Binder] -> Binder unguarded :: Expr -> [GuardedExpr] data UnwrappedTypeConstructor UnwrappedTypeConstructor :: ModuleName -> ProperName 'TypeName -> [SourceType] -> [SourceType] -> UnwrappedTypeConstructor [utcModuleName] :: UnwrappedTypeConstructor -> ModuleName [utcTyCon] :: UnwrappedTypeConstructor -> ProperName 'TypeName [utcKindArgs] :: UnwrappedTypeConstructor -> [SourceType] [utcArgs] :: UnwrappedTypeConstructor -> [SourceType] utcQTyCon :: UnwrappedTypeConstructor -> Qualified (ProperName 'TypeName) unwrapTypeConstructor :: SourceType -> Maybe UnwrappedTypeConstructor -- | 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 :: Text -> ModuleName -> [DeclarationRef] -> [ExternsImport] -> [ExternsFixity] -> [ExternsTypeFixity] -> [ExternsDeclaration] -> SourceSpan -> ExternsFile -- | The externs version [efVersion] :: ExternsFile -> Text -- | 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 operators and their fixities [efTypeFixities] :: ExternsFile -> [ExternsTypeFixity] -- | List of type and value declaration [efDeclarations] :: ExternsFile -> [ExternsDeclaration] -- | Source span for error reporting [efSourceSpan] :: ExternsFile -> SourceSpan -- | 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 -> OpName 'ValueOpName -> Qualified (Either Ident (ProperName 'ConstructorName)) -> ExternsFixity -- | The associativity of the operator [efAssociativity] :: ExternsFixity -> Associativity -- | The precedence level of the operator [efPrecedence] :: ExternsFixity -> Precedence -- | The operator symbol [efOperator] :: ExternsFixity -> OpName 'ValueOpName -- | The value the operator is an alias for [efAlias] :: ExternsFixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -- | A type fixity declaration in an externs file data ExternsTypeFixity ExternsTypeFixity :: Associativity -> Precedence -> OpName 'TypeOpName -> Qualified (ProperName 'TypeName) -> ExternsTypeFixity -- | The associativity of the operator [efTypeAssociativity] :: ExternsTypeFixity -> Associativity -- | The precedence level of the operator [efTypePrecedence] :: ExternsTypeFixity -> Precedence -- | The operator symbol [efTypeOperator] :: ExternsTypeFixity -> OpName 'TypeOpName -- | The value the operator is an alias for [efTypeAlias] :: ExternsTypeFixity -> Qualified (ProperName 'TypeName) -- | A type or value declaration appearing in an externs file data ExternsDeclaration -- | A type declaration EDType :: ProperName 'TypeName -> SourceType -> TypeKind -> ExternsDeclaration [edTypeName] :: ExternsDeclaration -> ProperName 'TypeName [edTypeKind] :: ExternsDeclaration -> SourceType [edTypeDeclarationKind] :: ExternsDeclaration -> TypeKind -- | A type synonym EDTypeSynonym :: ProperName 'TypeName -> [(Text, Maybe SourceType)] -> SourceType -> ExternsDeclaration [edTypeSynonymName] :: ExternsDeclaration -> ProperName 'TypeName [edTypeSynonymArguments] :: ExternsDeclaration -> [(Text, Maybe SourceType)] [edTypeSynonymType] :: ExternsDeclaration -> SourceType -- | A data constructor EDDataConstructor :: ProperName 'ConstructorName -> DataDeclType -> ProperName 'TypeName -> SourceType -> [Ident] -> ExternsDeclaration [edDataCtorName] :: ExternsDeclaration -> ProperName 'ConstructorName [edDataCtorOrigin] :: ExternsDeclaration -> DataDeclType [edDataCtorTypeCtor] :: ExternsDeclaration -> ProperName 'TypeName [edDataCtorType] :: ExternsDeclaration -> SourceType [edDataCtorFields] :: ExternsDeclaration -> [Ident] -- | A value declaration EDValue :: Ident -> SourceType -> ExternsDeclaration [edValueName] :: ExternsDeclaration -> Ident [edValueType] :: ExternsDeclaration -> SourceType -- | A type class declaration EDClass :: ProperName 'ClassName -> [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Bool -> ExternsDeclaration [edClassName] :: ExternsDeclaration -> ProperName 'ClassName [edClassTypeArguments] :: ExternsDeclaration -> [(Text, Maybe SourceType)] [edClassMembers] :: ExternsDeclaration -> [(Ident, SourceType)] [edClassConstraints] :: ExternsDeclaration -> [SourceConstraint] [edFunctionalDependencies] :: ExternsDeclaration -> [FunctionalDependency] [edIsEmpty] :: ExternsDeclaration -> Bool -- | An instance declaration EDInstance :: Qualified (ProperName 'ClassName) -> Ident -> [(Text, SourceType)] -> [SourceType] -> [SourceType] -> Maybe [SourceConstraint] -> Maybe ChainId -> Integer -> NameSource -> SourceSpan -> ExternsDeclaration [edInstanceClassName] :: ExternsDeclaration -> Qualified (ProperName 'ClassName) [edInstanceName] :: ExternsDeclaration -> Ident [edInstanceForAll] :: ExternsDeclaration -> [(Text, SourceType)] [edInstanceKinds] :: ExternsDeclaration -> [SourceType] [edInstanceTypes] :: ExternsDeclaration -> [SourceType] [edInstanceConstraints] :: ExternsDeclaration -> Maybe [SourceConstraint] [edInstanceChain] :: ExternsDeclaration -> Maybe ChainId [edInstanceChainIndex] :: ExternsDeclaration -> Integer [edInstanceNameSource] :: ExternsDeclaration -> NameSource [edInstanceSourceSpan] :: ExternsDeclaration -> SourceSpan -- | Check whether the version in an externs file matches the currently -- running version. externsIsCurrentVersion :: ExternsFile -> Bool -- | Generate an externs file for all declarations in a module. -- -- The `Map Ident Ident` argument should contain any top-level -- GenIdents that were rewritten to Idents when the -- module was compiled; this rewrite only happens in the CoreFn, not the -- original module AST, so it needs to be applied to the exported names -- here also. (The appropriate map is returned by renameInModule.) moduleToExternsFile :: Module -> Environment -> Map Ident Ident -> ExternsFile -- | Convert an externs file back into a module applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment externsFileName :: FilePath instance GHC.Generics.Generic Language.PureScript.Externs.ExternsImport instance GHC.Show.Show Language.PureScript.Externs.ExternsImport instance GHC.Generics.Generic Language.PureScript.Externs.ExternsFixity instance GHC.Show.Show Language.PureScript.Externs.ExternsFixity instance GHC.Generics.Generic Language.PureScript.Externs.ExternsTypeFixity instance GHC.Show.Show Language.PureScript.Externs.ExternsTypeFixity instance GHC.Generics.Generic Language.PureScript.Externs.ExternsDeclaration instance GHC.Show.Show Language.PureScript.Externs.ExternsDeclaration instance GHC.Generics.Generic Language.PureScript.Externs.ExternsFile instance GHC.Show.Show Language.PureScript.Externs.ExternsFile instance Codec.Serialise.Class.Serialise Language.PureScript.Externs.ExternsFile instance Codec.Serialise.Class.Serialise Language.PureScript.Externs.ExternsDeclaration instance Codec.Serialise.Class.Serialise Language.PureScript.Externs.ExternsTypeFixity instance Codec.Serialise.Class.Serialise Language.PureScript.Externs.ExternsFixity instance Codec.Serialise.Class.Serialise Language.PureScript.Externs.ExternsImport -- | This module implements the desugaring pass which creates newtypes for -- type class dictionaries and value declarations 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 -> Text superClassDictionaryNames :: [Constraint a] -> [Text] module Language.PureScript.TypeChecker.Deriving deriveInstance :: forall m. MonadError MultipleErrors m => MonadState CheckState m => MonadSupply m => MonadWriter MultipleErrors m => SourceType -> Qualified (ProperName 'ClassName) -> InstanceDerivationStrategy -> m 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 -> [((SourceAnn, Ident), Expr)] -> m [((SourceAnn, Ident), (Expr, SourceType))] -- | Check the kind of a type, failing if it is not of kind *. checkTypeKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () 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 :: forall m. (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Map ModuleName Exports -> Module -> m Module -- | Check that a newtype has just one data constructor with just one -- field, or throw an error. If the newtype is valid, this function -- returns the single data constructor declaration and the single field, -- as a proof that the newtype was indeed a valid newtype. checkNewtype :: forall m. MonadError MultipleErrors m => ProperName 'TypeName -> [DataConstructorDeclaration] -> m (DataConstructorDeclaration, (Ident, SourceType)) -- | 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 :: forall m. (MonadError MultipleErrors m, MonadSupply m) => Module -> m Module -- | This module implements the desugaring pass which reapplies binary -- operators based on their fixity data and removes explicit parentheses. -- -- The value parser ignores fixity data when parsing binary operator -- applications, so it is necessary to reorder them here. module Language.PureScript.Sugar.Operators -- | Removes unary negation operators and replaces them with calls to -- negate. desugarSignedLiterals :: Module -> Module -- | Indicates whether the rebracketModule is being called with the -- full desugar pass run via `purs compile` or whether only the partial -- desugar pass is run via `purs docs`. This indication is needed to -- prevent a `purs docs` error when using `case _ of` syntax in a type -- class instance. data RebracketCaller CalledByCompile :: RebracketCaller CalledByDocs :: RebracketCaller -- | Remove explicit parentheses and reorder binary operator applications. -- -- This pass requires name desugaring and export elaboration to have run -- first. rebracket :: forall m. MonadError MultipleErrors m => MonadSupply m => [ExternsFile] -> Module -> m Module -- | A version of rebracket which allows you to choose which -- declarations should be affected. This is used in docs generation, -- where we want to desugar type operators in instance declarations to -- ensure that instances are paired up with their types correctly, but we -- don't want to desugar type operators in value declarations. rebracketFiltered :: forall m. MonadError MultipleErrors m => MonadSupply m => RebracketCaller -> (Declaration -> Bool) -> [ExternsFile] -> Module -> m Module -- | Checks all the fixity exports within a module to ensure that members -- aliased by the operators are also exported from the module. -- -- This pass requires name desugaring and export elaboration to have run -- first. checkFixityExports :: forall m. MonadError MultipleErrors m => Module -> m Module instance GHC.Show.Show Language.PureScript.Sugar.Operators.RebracketCaller instance GHC.Classes.Eq Language.PureScript.Sugar.Operators.RebracketCaller module Language.PureScript.Sugar.Names -- | Replaces all local names with qualified names. desugarImports :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState (Env, UsedImports) m) => Module -> m 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) -- | Create an environment from a collection of externs files externsEnv :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Env -> ExternsFile -> m Env -- | Environment which only contains the Prim modules. primEnv :: 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 -> SourceSpan -> ImportProvenance -> ImportRecord a [importName] :: ImportRecord a -> Qualified a [importSourceModule] :: ImportRecord a -> ModuleName [importSourceSpan] :: ImportRecord a -> SourceSpan [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 Prim :: ImportProvenance -- | The imported declarations for a module, including the module's own -- members. data Imports Imports :: ImportMap (ProperName 'TypeName) -> ImportMap (OpName 'TypeOpName) -> ImportMap (ProperName 'ConstructorName) -> ImportMap (ProperName 'ClassName) -> ImportMap Ident -> ImportMap (OpName 'ValueOpName) -> Set ModuleName -> Set ModuleName -> ImportMap (ProperName 'TypeName) -> Imports -- | Local names for types within a module mapped to their qualified names [importedTypes] :: Imports -> ImportMap (ProperName 'TypeName) -- | Local names for type operators within a module mapped to their -- qualified names [importedTypeOps] :: Imports -> ImportMap (OpName 'TypeOpName) -- | Local names for data constructors within a module mapped to their -- qualified names [importedDataConstructors] :: Imports -> ImportMap (ProperName 'ConstructorName) -- | Local names for classes within a module mapped to their qualified -- names [importedTypeClasses] :: Imports -> ImportMap (ProperName 'ClassName) -- | Local names for values within a module mapped to their qualified names [importedValues] :: Imports -> ImportMap Ident -- | Local names for value operators within a module mapped to their -- qualified names [importedValueOps] :: Imports -> ImportMap (OpName 'ValueOpName) -- | The name of modules that have been imported into the current scope -- that can be re-exported. If a module is imported with as -- qualification, the as name appears here, otherwise the -- original name. [importedModules] :: Imports -> Set ModuleName -- | The "as" names of modules that have been imported qualified. [importedQualModules] :: Imports -> Set ModuleName -- | Local names for kinds within a module mapped to their qualified names [importedKinds] :: Imports -> ImportMap (ProperName 'TypeName) -- | The exported declarations from a module. data Exports Exports :: Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) -> Map (OpName 'TypeOpName) ExportSource -> Map (ProperName 'ClassName) ExportSource -> Map Ident ExportSource -> Map (OpName 'ValueOpName) ExportSource -> Exports -- | The exported types along with the module they originally came from. [exportedTypes] :: Exports -> Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) -- | The exported type operators along with the module they originally came -- from. [exportedTypeOps] :: Exports -> Map (OpName 'TypeOpName) ExportSource -- | The exported classes along with the module they originally came from. [exportedTypeClasses] :: Exports -> Map (ProperName 'ClassName) ExportSource -- | The exported values along with the module they originally came from. [exportedValues] :: Exports -> Map Ident ExportSource -- | The exported value operators along with the module they originally -- came from. [exportedValueOps] :: Exports -> Map (OpName 'ValueOpName) ExportSource -- | Desugaring passes module Language.PureScript.Sugar -- | The desugaring pipeline proceeds as follows: -- -- desugar :: MonadSupply m => MonadError MultipleErrors m => MonadWriter MultipleErrors m => MonadState (Env, UsedImports) m => [ExternsFile] -> Module -> m Module module Language.PureScript.Docs.Types data LinkLocation -- | A link to a declaration in the current package. LocalModule :: ModuleName -> LinkLocation -- | A link to a declaration in a different package. The arguments -- represent the name of the other package, the version of the other -- package, and the name of the module in the other package that the -- declaration is in. DepsModule :: PackageName -> Version -> ModuleName -> LinkLocation -- | A link to a declaration that is built in to the compiler, e.g. the -- Prim module. In this case we only need to store the module that the -- builtin comes from. Note that all builtin modules begin with -- Prim, and that the compiler rejects attempts to define modules -- whose names start with Prim. BuiltinModule :: ModuleName -> LinkLocation data DocLink DocLink :: LinkLocation -> Text -> Namespace -> DocLink [linkLocation] :: DocLink -> LinkLocation [linkTitle] :: DocLink -> Text [linkNamespace] :: DocLink -> Namespace data LinksContext LinksContext :: (GithubUser, GithubRepo) -> Map ModuleName PackageName -> [(PackageName, Version)] -> PackageName -> Version -> Text -> LinksContext [ctxGithub] :: LinksContext -> (GithubUser, GithubRepo) [ctxModuleMap] :: LinksContext -> Map ModuleName PackageName [ctxResolvedDependencies] :: LinksContext -> [(PackageName, Version)] [ctxPackageName] :: LinksContext -> PackageName [ctxVersion] :: LinksContext -> Version [ctxVersionTag] :: LinksContext -> Text data InPackage a Local :: a -> InPackage a FromDep :: PackageName -> a -> InPackage a data PackageError -- | Minimum allowable version for generating data with the current parser, -- and actual version used. CompilerTooOld :: Version -> Version -> PackageError ErrorInPackageMeta :: ManifestError -> PackageError InvalidVersion :: PackageError InvalidDeclarationType :: Text -> PackageError InvalidChildDeclarationType :: Text -> PackageError InvalidFixity :: PackageError InvalidKind :: Text -> PackageError InvalidDataDeclType :: Text -> PackageError InvalidKindSignatureFor :: Text -> PackageError InvalidTime :: PackageError InvalidRole :: Text -> PackageError newtype GithubRepo GithubRepo :: Text -> GithubRepo [runGithubRepo] :: GithubRepo -> Text newtype GithubUser GithubUser :: Text -> GithubUser [runGithubUser] :: GithubUser -> Text 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 data ChildDeclaration ChildDeclaration :: Text -> Maybe Text -> Maybe SourceSpan -> ChildDeclarationInfo -> ChildDeclaration [cdeclTitle] :: ChildDeclaration -> Text [cdeclComments] :: ChildDeclaration -> Maybe Text [cdeclSourceSpan] :: ChildDeclaration -> Maybe SourceSpan [cdeclInfo] :: ChildDeclaration -> ChildDeclarationInfo -- | Wraps enough information to properly render the kind signature of a -- datanewtypetype/class declaration. data KindInfo KindInfo :: KindSignatureFor -> Type' -> KindInfo [kiKeyword] :: KindInfo -> KindSignatureFor [kiKind] :: KindInfo -> Type' -- | 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 -> [(Text, Maybe Type')] -> [Role] -> DeclarationInfo -- | A data type foreign import, with its kind. ExternDataDeclaration :: Type' -> [Role] -> DeclarationInfo -- | A type synonym, with its type arguments and its type. TypeSynonymDeclaration :: [(Text, Maybe Type')] -> Type' -> DeclarationInfo -- | A type class, with its type arguments, its superclasses and functional -- dependencies. Instances and members are represented as child -- declarations. TypeClassDeclaration :: [(Text, Maybe Type')] -> [Constraint'] -> [([Text], [Text])] -> DeclarationInfo -- | An operator alias declaration, with the member the alias is for and -- the operator's fixity. AliasDeclaration :: Fixity -> FixityAlias -> DeclarationInfo data Declaration Declaration :: Text -> Maybe Text -> Maybe SourceSpan -> [ChildDeclaration] -> DeclarationInfo -> Maybe KindInfo -> Declaration [declTitle] :: Declaration -> Text [declComments] :: Declaration -> Maybe Text [declSourceSpan] :: Declaration -> Maybe SourceSpan [declChildren] :: Declaration -> [ChildDeclaration] [declInfo] :: Declaration -> DeclarationInfo [declKind] :: Declaration -> Maybe KindInfo data Module Module :: ModuleName -> Maybe Text -> [Declaration] -> [(InPackage ModuleName, [Declaration])] -> Module [modName] :: Module -> ModuleName [modComments] :: Module -> Maybe Text [modDeclarations] :: Module -> [Declaration] [modReExports] :: Module -> [(InPackage ModuleName, [Declaration])] data ManifestError BowerManifest :: BowerError -> ManifestError PursManifest :: PursJsonError -> ManifestError type VerifiedPackage = Package GithubUser type UploadedPackage = Package NotYetKnown data NotYetKnown NotYetKnown :: NotYetKnown data Package a Package :: PackageMeta -> Version -> Text -> Maybe UTCTime -> [Module] -> Map ModuleName PackageName -> [(PackageName, Version)] -> (GithubUser, GithubRepo) -> a -> Version -> Package a [pkgMeta] :: Package a -> PackageMeta [pkgVersion] :: Package a -> Version [pkgVersionTag] :: Package a -> Text [pkgTagTime] :: Package a -> Maybe UTCTime [pkgModules] :: Package a -> [Module] [pkgModuleMap] :: Package a -> Map ModuleName PackageName [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 type Constraint' = Constraint () type Type' = Type () showManifestError :: ManifestError -> Text verifyPackage :: GithubUser -> UploadedPackage -> VerifiedPackage packageName :: Package a -> PackageName -- | The time format used for serializing package tag times in the JSON -- format. This is the ISO 8601 date format which includes a time and a -- timezone. jsonTimeFormat :: String -- | Convenience function for formatting a time in the format expected by -- this module. formatTime :: UTCTime -> String -- | Convenience function for parsing a time in the format expected by this -- module. parseTime :: String -> Maybe UTCTime convertFundepsToStrings :: [(Text, Maybe Type')] -> [FunctionalDependency] -> [([Text], [Text])] declInfoToString :: DeclarationInfo -> Text declInfoNamespace :: DeclarationInfo -> Namespace 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 childDeclInfoToString :: ChildDeclarationInfo -> Text childDeclInfoNamespace :: ChildDeclarationInfo -> Namespace isTypeClassMember :: ChildDeclaration -> Bool isDataConstructor :: ChildDeclaration -> Bool ignorePackage :: InPackage a -> a -- | Given a links context, the current module name, the namespace of a -- thing to link to, its title, and its containing module, attempt to -- create a DocLink. getLink :: LinksContext -> ModuleName -> Namespace -> Text -> ContainingModule -> Maybe DocLink getLinksContext :: Package a -> LinksContext asPackage :: Version -> (forall e. Parse e a) -> Parse PackageError (Package a) parseTimeEither :: String -> Either PackageError UTCTime asUploadedPackage :: Version -> Parse PackageError UploadedPackage asNotYetKnown :: Parse e NotYetKnown displayPackageError :: PackageError -> Text asGithubUser :: Parse e GithubUser asVersion :: Parse PackageError Version asModule :: Parse PackageError Module asDeclaration :: Parse PackageError Declaration asReExport :: Parse PackageError (InPackage ModuleName, [Declaration]) pOr :: Parse e a -> Parse e a -> Parse e a asInPackage :: Parse ManifestError a -> Parse ManifestError (InPackage a) asFixity :: Parse PackageError Fixity asFixityAlias :: Parse PackageError FixityAlias parseAssociativity :: String -> Maybe Associativity asAssociativity :: Parse PackageError Associativity asDeclarationInfo :: Parse PackageError DeclarationInfo asKindInfo :: Parse PackageError KindInfo asKindSignatureFor :: Parse PackageError KindSignatureFor asTypeArguments :: Parse PackageError [(Text, Maybe Type')] asRole :: Parse PackageError Role asType :: Parse e Type' asFunDeps :: Parse PackageError [([Text], [Text])] 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)) asModuleMap :: Parse PackageError (Map ModuleName PackageName) bookmarksAsModuleMap :: Parse ManifestError (Map ModuleName PackageName) asResolvedDependencies :: Parse PackageError [(PackageName, Version)] parsePackageName' :: Text -> Either PackageError PackageName mapLeft :: (a -> a') -> Either a b -> Either a' b asGithub :: Parse e (GithubUser, GithubRepo) asSourceSpan :: Parse e SourceSpan kindSignatureForKeyword :: KindSignatureFor -> Text -- | 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 -> Key) -> (b -> Text) -> [(a, b)] -> Value type FixityAlias = Qualified (Either (ProperName 'TypeName) (Either Ident (ProperName 'ConstructorName))) -- | A type representing a highly simplified version of PureScript code, -- intended for use in output formats like plain text or HTML. data RenderedCode -- | 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 :: Text -> RenderedCodeElement Keyword :: Text -> RenderedCodeElement Space :: RenderedCodeElement -- | Any symbol which you might or might not want to link to, in any -- namespace (value, type, or kind). Note that this is not related to the -- kind called Symbol for type-level strings. Symbol :: Namespace -> Text -> Link -> RenderedCodeElement Role :: Text -> RenderedCodeElement data Namespace ValueLevel :: Namespace TypeLevel :: Namespace -- | 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 Text ContainingModule instance GHC.Generics.Generic Language.PureScript.Docs.Types.NotYetKnown 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.Generics.Generic Language.PureScript.Docs.Types.ManifestError instance GHC.Classes.Ord Language.PureScript.Docs.Types.ManifestError instance GHC.Classes.Eq Language.PureScript.Docs.Types.ManifestError instance GHC.Show.Show Language.PureScript.Docs.Types.ManifestError instance GHC.Generics.Generic Language.PureScript.Docs.Types.DeclarationInfo 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.Generics.Generic Language.PureScript.Docs.Types.KindInfo instance GHC.Classes.Ord Language.PureScript.Docs.Types.KindInfo instance GHC.Classes.Eq Language.PureScript.Docs.Types.KindInfo instance GHC.Show.Show Language.PureScript.Docs.Types.KindInfo instance GHC.Generics.Generic Language.PureScript.Docs.Types.ChildDeclarationInfo 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.Generics.Generic Language.PureScript.Docs.Types.ChildDeclaration 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.Generics.Generic Language.PureScript.Docs.Types.Declaration 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.Generics.Generic Language.PureScript.Docs.Types.GithubUser 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.Generics.Generic Language.PureScript.Docs.Types.GithubRepo 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.Generics.Generic Language.PureScript.Docs.Types.PackageError 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.Generics.Generic (Language.PureScript.Docs.Types.InPackage 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.Generics.Generic Language.PureScript.Docs.Types.Module 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.Generics.Generic (Language.PureScript.Docs.Types.Package a) 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.Generics.Generic Language.PureScript.Docs.Types.LinksContext instance GHC.Classes.Ord Language.PureScript.Docs.Types.LinksContext instance GHC.Classes.Eq Language.PureScript.Docs.Types.LinksContext instance GHC.Show.Show Language.PureScript.Docs.Types.LinksContext instance GHC.Generics.Generic Language.PureScript.Docs.Types.LinkLocation instance GHC.Classes.Ord Language.PureScript.Docs.Types.LinkLocation instance GHC.Classes.Eq Language.PureScript.Docs.Types.LinkLocation instance GHC.Show.Show Language.PureScript.Docs.Types.LinkLocation instance GHC.Generics.Generic Language.PureScript.Docs.Types.DocLink instance GHC.Classes.Ord Language.PureScript.Docs.Types.DocLink instance GHC.Classes.Eq Language.PureScript.Docs.Types.DocLink instance GHC.Show.Show Language.PureScript.Docs.Types.DocLink instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.DocLink instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.LinkLocation instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.LinksContext instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Docs.Types.Package a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Docs.Types.Package a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Docs.Types.Package a) instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.Module instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.Module instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Docs.Types.InPackage a) instance GHC.Base.Functor Language.PureScript.Docs.Types.InPackage instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Docs.Types.InPackage a) instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.PackageError instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.GithubRepo instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.GithubRepo instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.GithubUser instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Docs.Types.GithubUser instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.GithubUser instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.Declaration instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.Declaration instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.ChildDeclaration instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.ChildDeclaration instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.ChildDeclarationInfo instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.ChildDeclarationInfo instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.KindInfo instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.KindInfo instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.DeclarationInfo instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.DeclarationInfo instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.ManifestError instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.NotYetKnown instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Docs.Types.NotYetKnown instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.NotYetKnown module Language.PureScript.Docs.Tags tags :: Module -> [(String, Int)] dumpCtags :: [(String, Module)] -> [String] dumpEtags :: [(String, Module)] -> [String] -- | 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 renderKindSig :: Text -> KindInfo -> RenderedCode renderDeclaration :: Declaration -> RenderedCode renderChildDeclaration :: ChildDeclaration -> RenderedCode renderConstraint :: Constraint' -> RenderedCode renderConstraints :: [Constraint'] -> Maybe RenderedCode notQualified :: Text -> Qualified (ProperName a) ident' :: Text -> RenderedCode dataCtor' :: Text -> RenderedCode typeApp :: Text -> [(Text, Maybe Type')] -> Type' toTypeVar :: (Text, Maybe Type') -> Type' -- | This module provides documentation for the builtin Prim modules. module Language.PureScript.Docs.Prim primDocsModule :: Module primRowDocsModule :: Module primTypeErrorDocsModule :: Module primModules :: [Module] 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 convertComments :: [Comment] -> Maybe Text module Language.PureScript.Docs.Convert.ReExports -- | Given: -- -- -- -- This function adds all the missing re-exports. updateReExports :: [ExternsFile] -> (ModuleName -> InPackage ModuleName) -> Map ModuleName Module -> Map ModuleName Module instance GHC.Show.Show Language.PureScript.Docs.Convert.ReExports.TypeClassEnv instance GHC.Base.Semigroup Language.PureScript.Docs.Convert.ReExports.TypeClassEnv instance GHC.Base.Monoid Language.PureScript.Docs.Convert.ReExports.TypeClassEnv -- | Functions for converting PureScript ASTs into values of the data types -- from Language.PureScript.Docs. module Language.PureScript.Docs.Convert -- | Convert a single module to a Docs.Module, making use of a pre-existing -- type-checking environment in order to fill in any missing types. Note -- that re-exports will not be included. convertModule :: MonadError MultipleErrors m => [ExternsFile] -> Env -> Environment -> Module -> m Module module System.IO.UTF8 -- | Unfortunately ByteString's readFile does not convert line endings on -- Windows, so we have to do it ourselves fixCRLF :: ByteString -> ByteString readUTF8FilesT :: [FilePath] -> IO [(FilePath, Text)] readUTF8FileT :: FilePath -> IO Text writeUTF8FileT :: FilePath -> Text -> IO () readUTF8File :: FilePath -> IO String module Language.PureScript.Make.Monad -- | 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) -- | Run an IO action in the Make monad. The String -- argument should describe what we were trying to do; it is used for -- rendering errors in the case that an IOException is thrown. makeIO :: (MonadIO m, MonadError MultipleErrors m) => Text -> IO a -> m a -- | Get a file's modification time in the Make monad, capturing any -- errors using the MonadError instance. getTimestamp :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m UTCTime -- | Get a file's modification time in the Make monad, returning -- Nothing if the file does not exist. getTimestampMaybe :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe UTCTime) -- | Read a text file strictly in the Make monad, capturing any -- errors using the MonadError instance. readTextFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m Text -- | Read a JSON file in the Make monad, returning Nothing if -- the file does not exist or could not be parsed. Errors are captured -- using the MonadError instance. readJSONFile :: (MonadIO m, MonadError MultipleErrors m) => FromJSON a => FilePath -> m (Maybe a) readJSONFileIO :: FromJSON a => FilePath -> IO (Maybe a) -- | Read a Cbor encoded file in the Make monad, returning -- Nothing if the file does not exist or could not be parsed. -- Errors are captured using the MonadError instance. readCborFile :: (MonadIO m, MonadError MultipleErrors m) => Serialise a => FilePath -> m (Maybe a) readCborFileIO :: Serialise a => FilePath -> IO (Maybe a) -- | Read an externs file, returning Nothing if the file does not -- exist, could not be parsed, or was generated by a different version of -- the compiler. readExternsFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe ExternsFile) hashFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m ContentHash -- | Write a text file in the Make monad, capturing any errors using -- the MonadError instance. writeTextFile :: FilePath -> ByteString -> Make () -- | Write a JSON file in the Make monad, capturing any errors using -- the MonadError instance. writeJSONFile :: (MonadIO m, MonadError MultipleErrors m) => ToJSON a => FilePath -> a -> m () writeCborFile :: (MonadIO m, MonadError MultipleErrors m) => Serialise a => FilePath -> a -> m () writeCborFileIO :: Serialise a => FilePath -> a -> IO () -- | Copy a file in the Make monad, capturing any errors using the -- MonadError instance. copyFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> FilePath -> m () instance Control.Monad.Reader.Class.MonadReader Language.PureScript.Options.Options Language.PureScript.Make.Monad.Make instance Control.Monad.Writer.Class.MonadWriter Language.PureScript.Errors.MultipleErrors Language.PureScript.Make.Monad.Make instance Control.Monad.Error.Class.MonadError Language.PureScript.Errors.MultipleErrors Language.PureScript.Make.Monad.Make instance Control.Monad.IO.Class.MonadIO Language.PureScript.Make.Monad.Make instance GHC.Base.Monad Language.PureScript.Make.Monad.Make instance GHC.Base.Applicative Language.PureScript.Make.Monad.Make instance GHC.Base.Functor Language.PureScript.Make.Monad.Make instance Control.Monad.Base.MonadBase GHC.Types.IO Language.PureScript.Make.Monad.Make instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO Language.PureScript.Make.Monad.Make module Language.PureScript.Make.Actions -- | 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 (Map FilePath (UTCTime, m ContentHash)))) -> (ModuleName -> m (Maybe UTCTime)) -> (ModuleName -> m (FilePath, Maybe ExternsFile)) -> (Module Ann -> Module -> ExternsFile -> SupplyT m ()) -> (Module Ann -> m ()) -> (ProgressMessage -> m ()) -> m CacheDb -> (CacheDb -> m ()) -> m () -> m () -> MakeActions m -- | Get the timestamps and content hashes for the input files for a -- module. The content hash is returned as a monadic action so that the -- file does not have to be read if it's not necessary. [getInputTimestampsAndHashes] :: MakeActions m -> ModuleName -> m (Either RebuildPolicy (Map FilePath (UTCTime, m ContentHash))) -- | Get the time this module was last compiled, provided that all of the -- requested codegen targets were also produced then. The -- defaultMakeActions implementation uses the modification time of the -- externs file, because the externs file is written first and we always -- write one. If there is no externs file, or if any of the requested -- codegen targets were not produced the last time this module was -- compiled, this function must return Nothing; this indicates that the -- module will have to be recompiled. [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, Maybe ExternsFile) -- | Run the code generator for the module and write any required output -- files. [codegen] :: MakeActions m -> Module Ann -> Module -> ExternsFile -> SupplyT m () -- | Check ffi and print it in the output directory. [ffiCodegen] :: MakeActions m -> Module Ann -> m () -- | Respond to a progress update. [progress] :: MakeActions m -> ProgressMessage -> m () -- | Read the cache database (which contains timestamps and hashes for -- input files) from some external source, e.g. a file on disk. [readCacheDb] :: MakeActions m -> m CacheDb -- | Write the given cache database to some external source (e.g. a file on -- disk). [writeCacheDb] :: MakeActions m -> CacheDb -> m () -- | Write to the output directory the package.json file allowing Node.js -- to load .js files as ES modules. [writePackageJson] :: MakeActions m -> m () -- | If generating docs, output the documentation for the Prim modules [outputPrimDocs] :: MakeActions m -> m () -- | 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 -- | Compilation started for the specified module CompilingModule :: ModuleName -> Maybe (Int, Int) -> ProgressMessage -- | Render a progress message renderProgressMessage :: Text -> ProgressMessage -> Text -- | 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 -- | Check that the declarations in a given PureScript module match with -- those in its corresponding foreign module. checkForeignDecls :: Module ann -> FilePath -> Make (Either MultipleErrors (ForeignModuleType, Set Ident)) -- | Given the output directory, determines the location for the CacheDb -- file cacheDbFile :: FilePath -> FilePath readCacheDb' :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m CacheDb writeCacheDb' :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> CacheDb -> m () -- | FFI check and codegen action. If path maker is supplied copies foreign -- module to the output. ffiCodegen' :: Map ModuleName FilePath -> Set CodegenTarget -> Maybe (ModuleName -> String -> FilePath) -> Module Ann -> Make () instance GHC.Classes.Ord Language.PureScript.Make.Actions.RebuildPolicy instance GHC.Classes.Eq Language.PureScript.Make.Actions.RebuildPolicy instance GHC.Show.Show Language.PureScript.Make.Actions.RebuildPolicy instance GHC.Classes.Ord Language.PureScript.Make.Actions.ProgressMessage instance GHC.Classes.Eq Language.PureScript.Make.Actions.ProgressMessage instance GHC.Show.Show Language.PureScript.Make.Actions.ProgressMessage instance GHC.Show.Show Language.PureScript.Make.Actions.ForeignModuleType module Language.PureScript.Make.BuildPlan -- | The BuildPlan tracks information about our build progress, and holds -- all prebuilt modules for incremental builds. data BuildPlan data BuildJobResult -- | Succeeded, with warnings and externs BuildJobSucceeded :: !MultipleErrors -> !ExternsFile -> BuildJobResult -- | Failed, with errors BuildJobFailed :: !MultipleErrors -> BuildJobResult -- | The build job was not run, because an upstream build job failed BuildJobSkipped :: BuildJobResult buildJobSuccess :: BuildJobResult -> Maybe (MultipleErrors, ExternsFile) -- | Constructs a BuildPlan for the given module graph. -- -- The given MakeActions are used to collect various timestamps in order -- to determine whether a module needs rebuilding. construct :: forall m. MonadBaseControl IO m => MakeActions m -> CacheDb -> ([PartialResult Module], [(ModuleName, [ModuleName])]) -> m (BuildPlan, CacheDb) -- | Gets the the build result for a given module name independent of -- whether it was rebuilt or prebuilt. Prebuilt modules always return no -- warnings. getResult :: MonadBaseControl IO m => BuildPlan -> ModuleName -> m (Maybe (MultipleErrors, ExternsFile)) -- | Collects results for all prebuilt as well as rebuilt modules. This -- will block until all build jobs are finished. Prebuilt modules always -- return no warnings. collectResults :: MonadBaseControl IO m => BuildPlan -> m (Map ModuleName BuildJobResult) -- | Called when we finished compiling a module and want to report back the -- compilation result, as well as any potential errors that were thrown. markComplete :: MonadBaseControl IO m => BuildPlan -> ModuleName -> BuildJobResult -> m () -- | Whether or not the module with the given ModuleName needs to be -- rebuilt needsRebuild :: BuildPlan -> ModuleName -> Bool module Language.PureScript.Make -- | Rebuild a single module. -- -- This function is used for fast-rebuild workflows (PSCi and psc-ide are -- examples). rebuildModule :: forall m. (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [ExternsFile] -> Module -> m ExternsFile rebuildModule' :: forall m. (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> Env -> [ExternsFile] -> Module -> m ExternsFile -- | Compiles in "make" mode, compiling each module separately to a -- .js file and an externs.cbor file. -- -- If timestamps or hashes have not changed, existing externs files can -- be used to provide upstream modules' types without having to typecheck -- those modules again. make :: forall m. (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [PartialResult Module] -> m [ExternsFile] -- | Infer the module name for a module by looking for the same filename -- with a .js extension. inferForeignModules :: forall m. MonadIO m => Map ModuleName (Either RebuildPolicy FilePath) -> m (Map ModuleName FilePath) module Language.PureScript.Graph -- | Given a set of filepaths, try to build the dependency graph and return -- that as its JSON representation (or a bunch of errors, if any) graph :: [FilePath] -> IO (Either MultipleErrors Value, MultipleErrors) -- | The main compiler module module Language.PureScript -- | A space efficient, packed, unboxed Unicode text type. data Text -- | Request a CallStack. -- -- NOTE: The implicit parameter ?callStack :: CallStack is an -- implementation detail and should not be considered part of the -- CallStack API, we may decide to change the implementation in -- the future. type HasCallStack = ?callStack :: CallStack type Supply = SupplyT Identity 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 runSupply :: Integer -> Supply a -> (a, Integer) data Comment LineComment :: Text -> Comment BlockComment :: Text -> Comment data SourceSpan SourceSpan :: String -> SourcePos -> SourcePos -> SourceSpan -- | Source name [spanName] :: SourceSpan -> String -- | Start of the span [spanStart] :: SourceSpan -> SourcePos -- | End of the span [spanEnd] :: SourceSpan -> SourcePos -- | Source position information data SourcePos SourcePos :: Int -> Int -> SourcePos -- | Line number [sourcePosLine] :: SourcePos -> Int -- | Column number [sourcePosColumn] :: SourcePos -> Int -- | Source annotation - position information and comments. type SourceAnn = (SourceSpan, [Comment]) pattern NullSourceAnn :: SourceAnn pattern NullSourceSpan :: SourceSpan displaySourcePos :: SourcePos -> Text displaySourcePosShort :: SourcePos -> Text displayStartEndPos :: SourceSpan -> Text displayStartEndPosShort :: SourceSpan -> Text displaySourceSpan :: FilePath -> SourceSpan -> Text internalModuleSourceSpan :: String -> SourceSpan nullSourceSpan :: SourceSpan nullSourceAnn :: SourceAnn nonEmptySpan :: SourceAnn -> Maybe SourceSpan widenSourceSpan :: SourceSpan -> SourceSpan -> SourceSpan widenSourceAnn :: SourceAnn -> SourceAnn -> SourceAnn -- | Exit with an error message and a crash report link. internalError :: HasCallStack => String -> a -- | Fixity data for infix operators data Fixity Fixity :: Associativity -> Precedence -> Fixity -- | Associativity for infix operators data Associativity Infixl :: Associativity Infixr :: Associativity Infix :: Associativity -- | A precedence level for an infix operator type Precedence = Integer showAssoc :: Associativity -> String readAssoc :: String -> Associativity -- | A qualified name, i.e. a name with an optional module name data Qualified a Qualified :: QualifiedBy -> a -> Qualified a data QualifiedBy BySourcePos :: SourcePos -> QualifiedBy ByModuleName :: ModuleName -> QualifiedBy -- | Module names newtype ModuleName ModuleName :: Text -> ModuleName -- | The closed set of proper name types. data ProperNameType TypeName :: ProperNameType ConstructorName :: ProperNameType ClassName :: ProperNameType Namespace :: ProperNameType -- | Proper names, i.e. capitalized names for e.g. module names, type//data -- constructors. newtype ProperName (a :: ProperNameType) ProperName :: Text -> ProperName (a :: ProperNameType) [runProperName] :: ProperName (a :: ProperNameType) -> Text -- | The closed set of operator alias types. data OpNameType ValueOpName :: OpNameType TypeOpName :: OpNameType AnyOpName :: OpNameType -- | Operator alias names. newtype OpName (a :: OpNameType) OpName :: Text -> OpName (a :: OpNameType) [runOpName] :: OpName (a :: OpNameType) -> Text -- | Names for value identifiers data Ident -- | An alphanumeric identifier Ident :: Text -> Ident -- | A generated name for an identifier GenIdent :: Maybe Text -> Integer -> Ident -- | A generated name used only for type-checking UnusedIdent :: Ident -- | A generated name used only for internal transformations InternalIdent :: !InternalIdentData -> Ident -- | This type is meant to be extended with any new uses for idents that -- come along. Adding constructors to this type is cheaper than adding -- them to Ident because functions that match on Ident can -- ignore all InternalIdents with a single pattern, and thus don't -- have to change if a new InternalIdentData constructor is -- created. data InternalIdentData RuntimeLazyFactory :: InternalIdentData Lazy :: !Text -> InternalIdentData -- | A sum of the possible name types, useful for error and lint messages. data Name IdentName :: Ident -> Name ValOpName :: OpName 'ValueOpName -> Name TyName :: ProperName 'TypeName -> Name TyOpName :: OpName 'TypeOpName -> Name DctorName :: ProperName 'ConstructorName -> Name TyClassName :: ProperName 'ClassName -> Name ModName :: ModuleName -> Name pattern ByNullSourcePos :: QualifiedBy getIdentName :: Name -> Maybe Ident getValOpName :: Name -> Maybe (OpName 'ValueOpName) getTypeName :: Name -> Maybe (ProperName 'TypeName) getTypeOpName :: Name -> Maybe (OpName 'TypeOpName) getDctorName :: Name -> Maybe (ProperName 'ConstructorName) getClassName :: Name -> Maybe (ProperName 'ClassName) unusedIdent :: Text runIdent :: Ident -> Text showIdent :: Ident -> Text freshIdent :: MonadSupply m => Text -> m Ident freshIdent' :: MonadSupply m => m Ident isPlainIdent :: Ident -> Bool showOp :: OpName a -> Text eraseOpName :: OpName a -> OpName 'AnyOpName coerceOpName :: OpName a -> OpName b -- | 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 runModuleName :: ModuleName -> Text moduleNameFromString :: Text -> ModuleName isBuiltinModuleName :: ModuleName -> Bool isBySourcePos :: QualifiedBy -> Bool byMaybeModuleName :: Maybe ModuleName -> QualifiedBy toMaybeModuleName :: QualifiedBy -> Maybe ModuleName showQualified :: (a -> Text) -> Qualified a -> Text getQual :: Qualified a -> Maybe ModuleName -- | 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 -- | Remove the qualification from a value when it is qualified with a -- particular module name. disqualifyFor :: Maybe ModuleName -> Qualified a -> Maybe 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 data CodegenTarget JS :: CodegenTarget JSSourceMap :: CodegenTarget CoreFn :: CodegenTarget Docs :: CodegenTarget -- | The data type of compiler options data Options Options :: Bool -> Bool -> Set CodegenTarget -> Options -- | Verbose error message [optionsVerboseErrors] :: Options -> Bool -- | Remove the comments from the generated js [optionsNoComments] :: Options -> Bool -- | Codegen targets (JS, CoreFn, etc.) [optionsCodegenTargets] :: Options -> Set CodegenTarget defaultOptions :: Options codegenTargets :: Map String CodegenTarget -- | Pretty print a PSString, using PureScript escape sequences. prettyPrintString :: PSString -> Text -- | 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 :: PSString -> 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 :: [(PSString, a)] -> Literal a -- | The role of a type constructor's parameter. data Role -- | This parameter's identity affects the representation of the type it is -- parameterising. Nominal :: Role -- | This parameter's representation affects the representation of the type -- it is parameterising. Representational :: Role -- | This parameter has no effect on the representation of the type it is -- parameterising. Phantom :: Role displayRole :: Role -> Text data RowListItem a RowListItem :: a -> Label -> Type a -> RowListItem a [rowListAnn] :: RowListItem a -> a [rowListLabel] :: RowListItem a -> Label [rowListType] :: RowListItem a -> Type a -- | A typeclass constraint data Constraint a Constraint :: a -> Qualified (ProperName 'ClassName) -> [Type a] -> [Type a] -> Maybe ConstraintData -> Constraint a -- | constraint annotation [constraintAnn] :: Constraint a -> a -- | constraint class name [constraintClass] :: Constraint a -> Qualified (ProperName 'ClassName) -- | kind arguments [constraintKindArgs] :: Constraint a -> [Type a] -- | type arguments [constraintArgs] :: Constraint a -> [Type a] -- | additional data relevant to this constraint [constraintData] :: Constraint a -> Maybe ConstraintData -- | Additional data relevant to type class constraints data ConstraintData -- | Data to accompany a Partial constraint generated by the exhaustivity -- checker. It contains (rendered) binder information for those binders -- which were not matched, and a flag indicating whether the list was -- truncated or not. Note: we use Text here because using -- Binder would introduce a cyclic dependency in the module -- graph. PartialConstraintData :: [[Text]] -> Bool -> ConstraintData -- | The type of types data Type a -- | A unification variable of type Type TUnknown :: a -> Int -> Type a -- | A named type variable TypeVar :: a -> Text -> Type a -- | A type-level string TypeLevelString :: a -> PSString -> Type a -- | A type-level natural TypeLevelInt :: a -> Integer -> Type a -- | A type wildcard, as would appear in a partial type synonym TypeWildcard :: a -> WildcardData -> Type a -- | A type constructor TypeConstructor :: a -> Qualified (ProperName 'TypeName) -> Type a -- | A type operator. This will be desugared into a type constructor during -- the "operators" phase of desugaring. TypeOp :: a -> Qualified (OpName 'TypeOpName) -> Type a -- | A type application TypeApp :: a -> Type a -> Type a -> Type a -- | Explicit kind application KindApp :: a -> Type a -> Type a -> Type a -- | Forall quantifier ForAll :: a -> TypeVarVisibility -> Text -> Maybe (Type a) -> Type a -> Maybe SkolemScope -> Type a -- | A type with a set of type class constraints ConstrainedType :: a -> Constraint a -> Type a -> Type a -- | A skolem constant Skolem :: a -> Text -> Maybe (Type a) -> Int -> SkolemScope -> Type a -- | An empty row REmpty :: a -> Type a -- | A non-empty row RCons :: a -> Label -> Type a -> Type a -> Type a -- | A type with a kind annotation KindedType :: a -> Type a -> Type a -> Type a -- | Binary operator application. During the rebracketing phase of -- desugaring, this data constructor will be removed. BinaryNoParensType :: a -> Type a -> Type a -> Type a -> Type a -- | Explicit parentheses. During the rebracketing phase of desugaring, -- this data constructor will be removed. -- -- Note: although it seems this constructor is not used, it _is_ useful, -- since it prevents certain traversals from matching. ParensInType :: a -> Type a -> Type a data TypeVarVisibility TypeVarVisible :: TypeVarVisibility TypeVarInvisible :: TypeVarVisibility -- | Describes how a TypeWildcard should be presented to the user during -- type checking: holes (?foo) are always emitted as errors, whereas -- unnamed wildcards (_) default to warnings, but are ignored entirely if -- they are contained by a binding with a complete (wildcard-free) type -- signature. data WildcardData HoleWildcard :: Text -> WildcardData UnnamedWildcard :: WildcardData IgnoredWildcard :: WildcardData -- | An identifier for the scope of a skolem variable newtype SkolemScope SkolemScope :: Int -> SkolemScope [runSkolemScope] :: SkolemScope -> Int type SourceConstraint = Constraint SourceAnn type SourceType = Type SourceAnn pattern REmptyKinded :: forall a. a -> Maybe (Type a) -> Type a typeVarVisibilityPrefix :: TypeVarVisibility -> Text srcTUnknown :: Int -> SourceType srcTypeVar :: Text -> SourceType srcTypeLevelString :: PSString -> SourceType srcTypeLevelInt :: Integer -> SourceType srcTypeWildcard :: SourceType srcTypeConstructor :: Qualified (ProperName 'TypeName) -> SourceType srcTypeApp :: SourceType -> SourceType -> SourceType srcKindApp :: SourceType -> SourceType -> SourceType srcForAll :: TypeVarVisibility -> Text -> Maybe SourceType -> SourceType -> Maybe SkolemScope -> SourceType srcConstrainedType :: SourceConstraint -> SourceType -> SourceType srcREmpty :: SourceType srcRCons :: Label -> SourceType -> SourceType -> SourceType srcKindedType :: SourceType -> SourceType -> SourceType toREmptyKinded :: forall a. Type a -> Maybe (a, Maybe (Type a)) isREmpty :: forall a. Type a -> Bool srcConstraint :: Qualified (ProperName 'ClassName) -> [SourceType] -> [SourceType] -> Maybe ConstraintData -> SourceConstraint mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) mapConstraintArgsAll :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a overConstraintArgsAll :: Applicative f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) constraintDataToJSON :: ConstraintData -> Value constraintToJSON :: (a -> Value) -> Constraint a -> Value typeVarVisToJSON :: TypeVarVisibility -> Value typeToJSON :: forall a. (a -> Value) -> Type a -> Value constraintDataFromJSON :: Value -> Parser ConstraintData constraintFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Constraint a) typeVarVisFromJSON :: Value -> Parser TypeVarVisibility typeFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Type a) srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn -- | Convert a row to a list of pairs of labels and types rowToList :: Type a -> ([RowListItem a], Type a) -- | Convert a row to a list of pairs of labels and types, sorted by the -- labels. rowToSortedList :: Type a -> ([RowListItem a], Type a) -- | Convert a list of labels and types to a row rowFromList :: ([RowListItem a], Type a) -> Type a -- | Align two rows of types, splitting them into three parts: -- -- -- -- Note: importantly, we preserve the order of the types with a given -- label. alignRowsWith :: (Label -> Type a -> Type a -> r) -> Type a -> Type a -> ([r], (([RowListItem a], Type a), ([RowListItem a], Type a))) -- | Check whether a type is a monotype isMonoType :: Type a -> Bool -- | Universally quantify a type mkForAll :: [(a, (Text, Maybe (Type a)))] -> Type a -> Type a -- | Replace a type variable, taking into account variable shadowing replaceTypeVars :: Text -> Type a -> Type a -> Type a -- | Replace named type variables with types replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a -- | Add visible type abstractions to top-level foralls. addVisibility :: [(Text, TypeVarVisibility)] -> Type a -> Type a -- | Collect all type variables appearing in a type usedTypeVariables :: Type a -> [Text] -- | Collect all free type variables appearing in a type freeTypeVariables :: Type a -> [Text] -- | Collect a complete set of kind-annotated quantifiers at the front of a -- type. completeBinderList :: Type a -> Maybe ([(a, (Text, Type a))], Type a) -- | Universally quantify over all type variables appearing free in a type quantify :: Type a -> Type a -- | Move all universal quantifiers to the front of a type moveQuantifiersToFront :: Type a -> Type a -- | Check if a type contains forall containsForAll :: Type a -> Bool unknowns :: Type a -> IntSet -- | Check if a type contains unknowns in a position that is relevant to -- constraint solving. (Kinds are not.) containsUnknowns :: Type a -> Bool eraseKindApps :: Type a -> Type a eraseForAllKindAnnotations :: Type a -> Type a unapplyTypes :: Type a -> (Type a, [Type a], [Type a]) unapplyConstraints :: Type a -> ([Constraint a], Type a) -- | Construct the type of an instance declaration from its parts. Used in -- error messages describing unnamed instances. srcInstanceType :: SourceSpan -> [(Text, SourceType)] -> Qualified (ProperName 'ClassName) -> [SourceType] -> SourceType everywhereOnTypes :: (Type a -> Type a) -> Type a -> Type a everywhereOnTypesM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) everywhereOnTypesTopDownM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r annForType :: Lens' (Type a) a getAnnForType :: Type a -> a setAnnForType :: a -> Type a -> Type a eqType :: Type a -> Type b -> Bool eqMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Bool compareType :: Type a -> Type b -> Ordering compareMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Ordering eqConstraint :: Constraint a -> Constraint b -> Bool compareConstraint :: Constraint a -> Constraint b -> Ordering -- | The type ('data' or 'newtype') of a data type declaration data DataDeclType -- | A standard data constructor Data :: DataDeclType -- | A newtype constructor Newtype :: DataDeclType -- | The kinds of a type data TypeKind -- | Data type DataType :: DataDeclType -> [(Text, Maybe SourceType, Role)] -> [(ProperName 'ConstructorName, [SourceType])] -> TypeKind -- | Type synonym TypeSynonym :: TypeKind -- | Foreign data ExternData :: [Role] -> TypeKind -- | A local type variable LocalTypeVariable :: TypeKind -- | A scoped type variable ScopedTypeVar :: TypeKind -- | 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 foreign import declaration Public :: NameKind -- | A name for member introduced by foreign import External :: NameKind -- | 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 type Frontier = Map IntSet (First (IntMap (NonEmpty IntSet))) -- | A functional dependency indicates a relationship between two sets of -- type arguments in a class declaration. data FunctionalDependency FunctionalDependency :: [Int] -> [Int] -> FunctionalDependency -- | the type arguments which determine the determined type arguments [fdDeterminers] :: FunctionalDependency -> [Int] -- | the determined type arguments [fdDetermined] :: FunctionalDependency -> [Int] -- | Information about a type class data TypeClassData TypeClassData :: [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Set Int -> Set (Set Int) -> Bool -> TypeClassData -- | A list of type argument names, and their kinds, where kind annotations -- were provided. [typeClassArguments] :: TypeClassData -> [(Text, Maybe SourceType)] -- | A list of type class members and their types. Type arguments listed -- above are considered bound in these types. [typeClassMembers] :: TypeClassData -> [(Ident, SourceType)] -- | A list of superclasses of this type class. Type arguments listed above -- are considered bound in the types appearing in these constraints. [typeClassSuperclasses] :: TypeClassData -> [SourceConstraint] -- | A list of functional dependencies for the type arguments of this -- class. [typeClassDependencies] :: TypeClassData -> [FunctionalDependency] -- | A set of indexes of type argument that are fully determined by other -- arguments via functional dependencies. This can be computed from both -- typeClassArguments and typeClassDependencies. [typeClassDeterminedArguments] :: TypeClassData -> Set Int -- | A sets of arguments that can be used to infer all other arguments. [typeClassCoveringSets] :: TypeClassData -> Set (Set Int) -- | Whether or not dictionaries for this type class are necessarily empty. [typeClassIsEmpty] :: TypeClassData -> Bool -- | The Environment defines all values and types which are -- currently in scope: data Environment Environment :: Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -> Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) -> Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) -> Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -> Map (Qualified (ProperName 'ClassName)) TypeClassData -> Environment -- | Values currently in scope [names] :: Environment -> Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -- | Type names currently in scope [types] :: Environment -> Map (Qualified (ProperName 'TypeName)) (SourceType, 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, SourceType, [Ident]) -- | Type synonyms currently in scope [typeSynonyms] :: Environment -> Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) -- | Available type class dictionaries. When looking up Nothing in -- the outer map, this returns the map of type class dictionaries in -- local scope (ie dictionaries brought in by a constrained type). [typeClassDictionaries] :: Environment -> Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -- | Type classes [typeClasses] :: Environment -> Map (Qualified (ProperName 'ClassName)) TypeClassData -- | The initial environment with no values and only the default javascript -- types defined initEnvironment :: Environment -- | A constructor for TypeClassData that computes which type class -- arguments are fully determined and argument covering sets. Fully -- determined means that this argument cannot be used when selecting a -- type class instance. A covering set is a minimal collection of -- arguments that can be used to find an instance and therefore determine -- all other type arguments. -- -- An example of the difference between determined and fully determined -- would be with the class: ```class C a b c | a -> b, b -> a, b -- -> c``` In this case, a must differ when b -- differs, and vice versa - each is determined by the other. Both -- a and b can be used in selecting a type class -- instance. However, c cannot - it is fully determined by -- a and b. -- -- Define a graph of type class arguments with edges being fundep -- determiners to determined. Each argument also has a self looping edge. -- An argument is fully determined if doesn't appear at the start of a -- path of strongly connected components. An argument is not fully -- determined otherwise. -- -- The way we compute this is by saying: an argument X is fully -- determined if there are arguments that determine X that X does not -- determine. This is the same thing: everything X determines includes -- everything in its SCC, and everything determining X is either before -- it in an SCC path, or in the same SCC. makeTypeClassData :: [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Bool -> TypeClassData computeCoveringSets :: Int -> [FunctionalDependency] -> (Set Int, Set (Set Int)) showDataDeclType :: DataDeclType -> Text -- | Kind of ground types kindType :: SourceType kindConstraint :: SourceType kindSymbol :: SourceType kindDoc :: SourceType kindOrdering :: SourceType kindRowList :: SourceType -> SourceType kindRow :: SourceType -> SourceType kindOfREmpty :: SourceType -- | Type constructor for functions tyFunction :: SourceType -- | Type constructor for strings tyString :: SourceType -- | Type constructor for strings tyChar :: SourceType -- | Type constructor for numbers tyNumber :: SourceType -- | Type constructor for integers tyInt :: SourceType -- | Type constructor for booleans tyBoolean :: SourceType -- | Type constructor for arrays tyArray :: SourceType -- | Type constructor for records tyRecord :: SourceType tyVar :: Text -> SourceType tyForall :: Text -> SourceType -> SourceType -> SourceType -- | Smart constructor for function types function :: SourceType -> SourceType -> SourceType (-:>) :: SourceType -> SourceType -> SourceType infixr 4 -:> primClass :: Qualified (ProperName 'ClassName) -> (SourceType -> SourceType) -> [(Qualified (ProperName 'TypeName), (SourceType, TypeKind))] -- | The primitive types in the external environment with their associated -- kinds. There are also pseudo Fail, Warn, and -- Partial types that correspond to the classes with the same -- names. primTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | This Map contains all of the prim types from all Prim -- modules. allPrimTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primBooleanTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primCoerceTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primOrderingTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primRowTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primRowListTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primSymbolTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primIntTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primTypeErrorTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | The primitive class map. This just contains the Partial -- class. Partial is used as a kind of magic constraint for -- partial functions. primClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData -- | This contains all of the type classes from all Prim modules. allPrimClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primCoerceClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primRowClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primRowListClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primSymbolClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primIntClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primTypeErrorClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData -- | Finds information about data constructors from the current -- environment. lookupConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) -- | Finds information about values from the current environment. lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility) dictTypeName' :: Text -> Text dictTypeName :: ProperName a -> ProperName a isDictTypeName :: ProperName a -> Bool -- | Given the kind of a type, generate a list Nominal roles. This -- is used for opaque foreign types as well as type classes. nominalRolesForKind :: Type a -> [Role] kindArity :: Type a -> Int unapplyKinds :: Type a -> ([Type a], Type a) -- | Data type for binders data Binder -- | Wildcard binder NullBinder :: Binder -- | A binder which matches a literal LiteralBinder :: SourceSpan -> Literal Binder -> Binder -- | A binder which binds an identifier VarBinder :: SourceSpan -> Ident -> Binder -- | A binder which matches a data constructor ConstructorBinder :: SourceSpan -> Qualified (ProperName 'ConstructorName) -> [Binder] -> Binder -- | A operator alias binder. During the rebracketing phase of desugaring, -- this data constructor will be removed. OpBinder :: SourceSpan -> Qualified (OpName 'ValueOpName) -> 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 :: SourceSpan -> Ident -> Binder -> Binder -- | A binder with source position information PositionedBinder :: SourceSpan -> [Comment] -> Binder -> Binder -- | A binder with a type annotation TypedBinder :: SourceType -> Binder -> Binder -- | Collect all names introduced in binders in an expression binderNames :: Binder -> [Ident] binderNamesWithSpans :: Binder -> [(SourceSpan, Ident)] isIrrefutable :: Binder -> Bool newtype AssocList k t AssocList :: [(k, t)] -> AssocList k t [runAssocList] :: AssocList k t -> [(k, t)] data PathNode t Leaf :: t -> PathNode t Branch :: PathTree t -> PathNode t newtype PathTree t PathTree :: AssocList PSString (PathNode t) -> PathTree t -- | 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 -- | An alternative in a case statement data CaseAlternative CaseAlternative :: [Binder] -> [GuardedExpr] -> 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 -> [GuardedExpr] -- | Metadata that tells where a let binding originated data WhereProvenance -- | The let binding was originally a where clause FromWhere :: WhereProvenance -- | The let binding was always a let binding FromLet :: WhereProvenance -- | Data type for expressions and terms data Expr -- | A literal value Literal :: SourceSpan -> Literal Expr -> Expr -- | A prefix -, will be desugared UnaryMinus :: SourceSpan -> 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 -- | An record property accessor expression (e.g. `obj.x` or `_.x`). -- Anonymous arguments will be removed during desugaring and expanded -- into a lambda that reads a property from a record. Accessor :: PSString -> Expr -> Expr -- | Partial record update ObjectUpdate :: Expr -> [(PSString, Expr)] -> Expr -- | Object updates with nested support: `x { foo { bar = e } }` Replaced -- during desugaring into a Let and nested ObjectUpdates ObjectUpdateNested :: Expr -> PathTree Expr -> Expr -- | Function introduction Abs :: Binder -> Expr -> Expr -- | Function application App :: Expr -> Expr -> Expr -- | A type application (e.g. `f @Int`) VisibleTypeApp :: Expr -> SourceType -> Expr -- | Hint that an expression is unused. This is used to ignore type class -- dictionaries that are necessarily empty. The inner expression lets us -- solve subgoals before eliminating the whole expression. The code gen -- will render this as undefined, regardless of what the inner -- expression is. Unused :: Expr -> Expr -- | Variable Var :: SourceSpan -> Qualified Ident -> Expr -- | An operator. This will be desugared into a function during the -- "operators" phase of desugaring. Op :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Expr -- | Conditional (if-then-else expression) IfThenElse :: Expr -> Expr -> Expr -> Expr -- | A data constructor Constructor :: SourceSpan -> 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 -> SourceType -> Expr -- | A let binding Let :: WhereProvenance -> [Declaration] -> Expr -> Expr -- | A do-notation block Do :: Maybe ModuleName -> [DoNotationElement] -> Expr -- | An ado-notation block Ado :: Maybe ModuleName -> [DoNotationElement] -> 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 :: SourceConstraint -> Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -> [ErrorMessageHint] -> Expr -- | A placeholder for a superclass dictionary to be turned into a -- TypeClassDictionary during typechecking DeferredDictionary :: Qualified (ProperName 'ClassName) -> [SourceType] -> Expr -- | A placeholder for a type class instance to be derived during -- typechecking DerivedInstancePlaceholder :: Qualified (ProperName 'ClassName) -> InstanceDerivationStrategy -> Expr -- | A placeholder for an anonymous function argument AnonymousArgument :: Expr -- | A typed hole that will be turned into a hint/error during typechecking Hole :: Text -> Expr -- | A value with source position information PositionedValue :: SourceSpan -> [Comment] -> Expr -> Expr -- | The right hand side of a binder in value declarations and case -- expressions. data GuardedExpr GuardedExpr :: [Guard] -> Expr -> GuardedExpr -- | A guard is just a boolean-valued expression that appears alongside a -- set of binders data Guard ConditionGuard :: Expr -> Guard PatternGuard :: Binder -> Expr -> Guard -- | What sort of declaration the kind signature applies to. data KindSignatureFor DataSig :: KindSignatureFor NewtypeSig :: KindSignatureFor TypeSynonymSig :: KindSignatureFor ClassSig :: KindSignatureFor -- | The members of a type class instance declaration data TypeInstanceBody -- | This is a derived instance DerivedInstance :: TypeInstanceBody -- | This is an instance derived from a newtype NewtypeInstance :: TypeInstanceBody -- | This is a regular (explicit) instance ExplicitInstance :: [Declaration] -> TypeInstanceBody data InstanceDerivationStrategy KnownClassStrategy :: InstanceDerivationStrategy NewtypeStrategy :: InstanceDerivationStrategy data TypeFixity TypeFixity :: Fixity -> Qualified (ProperName 'TypeName) -> OpName 'TypeOpName -> TypeFixity data ValueFixity ValueFixity :: Fixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -> OpName 'ValueOpName -> ValueFixity -- | The data type of declarations data Declaration -- | A data type declaration (data or newtype, name, arguments, data -- constructors) DataDeclaration :: SourceAnn -> DataDeclType -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> [DataConstructorDeclaration] -> Declaration -- | A minimal mutually recursive set of data type declarations DataBindingGroupDeclaration :: NonEmpty Declaration -> Declaration -- | A type synonym declaration (name, arguments, type) TypeSynonymDeclaration :: SourceAnn -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> SourceType -> Declaration -- | A kind signature declaration KindDeclaration :: SourceAnn -> KindSignatureFor -> ProperName 'TypeName -> SourceType -> Declaration -- | A role declaration (name, roles) RoleDeclaration :: {-# UNPACK #-} !RoleDeclarationData -> Declaration -- | A type declaration for a value (name, ty) TypeDeclaration :: {-# UNPACK #-} !TypeDeclarationData -> Declaration -- | A value declaration (name, top-level binders, optional guard, value) ValueDeclaration :: {-# UNPACK #-} !ValueDeclarationData [GuardedExpr] -> Declaration -- | A declaration paired with pattern matching in let-in expression -- (binder, optional guard, value) BoundValueDeclaration :: SourceAnn -> Binder -> Expr -> Declaration -- | A minimal mutually recursive set of value declarations BindingGroupDeclaration :: NonEmpty ((SourceAnn, Ident), NameKind, Expr) -> Declaration -- | A foreign import declaration (name, type) ExternDeclaration :: SourceAnn -> Ident -> SourceType -> Declaration -- | A data type foreign import (name, kind) ExternDataDeclaration :: SourceAnn -> ProperName 'TypeName -> SourceType -> Declaration -- | A fixity declaration FixityDeclaration :: SourceAnn -> Either ValueFixity TypeFixity -> Declaration -- | A module import (module name, qualifiedunqualifiedhiding, -- optional "qualified as" name) ImportDeclaration :: SourceAnn -> ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Declaration -- | A type class declaration (name, argument, implies, member -- declarations) TypeClassDeclaration :: SourceAnn -> ProperName 'ClassName -> [(Text, Maybe SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> [Declaration] -> Declaration -- | A type instance declaration (instance chain, chain index, name, -- dependencies, class name, instance types, member declarations) -- -- The first SourceAnn serves as the annotation for the entire -- declaration, while the second SourceAnn serves as the -- annotation for the type class and its arguments. TypeInstanceDeclaration :: SourceAnn -> SourceAnn -> ChainId -> Integer -> Either Text Ident -> [SourceConstraint] -> Qualified (ProperName 'ClassName) -> [SourceType] -> TypeInstanceBody -> Declaration data DataConstructorDeclaration DataConstructorDeclaration :: !SourceAnn -> !ProperName 'ConstructorName -> ![(Ident, SourceType)] -> DataConstructorDeclaration [dataCtorAnn] :: DataConstructorDeclaration -> !SourceAnn [dataCtorName] :: DataConstructorDeclaration -> !ProperName 'ConstructorName [dataCtorFields] :: DataConstructorDeclaration -> ![(Ident, SourceType)] -- | A value declaration assigns a name and potential binders, to an -- expression (or multiple guarded expressions). -- --
--   double x = x + x
--   
-- -- In this example double is the identifier, x is a -- binder and x + x is the expression. data ValueDeclarationData a ValueDeclarationData :: !SourceAnn -> !Ident -> !NameKind -> ![Binder] -> !a -> ValueDeclarationData a [valdeclSourceAnn] :: ValueDeclarationData a -> !SourceAnn -- | The declared value's name [valdeclIdent] :: ValueDeclarationData a -> !Ident -- | Whether or not this value is exported/visible [valdeclName] :: ValueDeclarationData a -> !NameKind [valdeclBinders] :: ValueDeclarationData a -> ![Binder] [valdeclExpression] :: ValueDeclarationData a -> !a -- | A type declaration assigns a type to an identifier, eg: -- --
--   identity :: forall a. a -> a
--   
-- -- In this example identity is the identifier and forall a. -- a -> a the type. data TypeDeclarationData TypeDeclarationData :: !SourceAnn -> !Ident -> !SourceType -> TypeDeclarationData [tydeclSourceAnn] :: TypeDeclarationData -> !SourceAnn [tydeclIdent] :: TypeDeclarationData -> !Ident [tydeclType] :: TypeDeclarationData -> !SourceType -- | A role declaration assigns a list of roles to a type constructor's -- parameters, e.g.: -- --
--   type role T representational phantom
--   
-- -- In this example, T is the identifier and -- [representational, phantom] is the list of roles (T -- presumably having two parameters). data RoleDeclarationData RoleDeclarationData :: !SourceAnn -> !ProperName 'TypeName -> ![Role] -> RoleDeclarationData [rdeclSourceAnn] :: RoleDeclarationData -> !SourceAnn [rdeclIdent] :: RoleDeclarationData -> !ProperName 'TypeName [rdeclRoles] :: RoleDeclarationData -> ![Role] -- | 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 data ExportSource ExportSource :: Maybe ModuleName -> ModuleName -> ExportSource [exportSourceImportedFrom] :: ExportSource -> Maybe ModuleName [exportSourceDefinedIn] :: ExportSource -> ModuleName -- | An item in a list of explicit imports or exports data DeclarationRef -- | A type class TypeClassRef :: SourceSpan -> ProperName 'ClassName -> DeclarationRef -- | A type operator TypeOpRef :: SourceSpan -> OpName 'TypeOpName -> DeclarationRef -- | A type constructor with data constructors TypeRef :: SourceSpan -> ProperName 'TypeName -> Maybe [ProperName 'ConstructorName] -> DeclarationRef -- | A value ValueRef :: SourceSpan -> Ident -> DeclarationRef -- | A value-level operator ValueOpRef :: SourceSpan -> OpName 'ValueOpName -> DeclarationRef -- | A type class instance, created during typeclass desugaring TypeInstanceRef :: SourceSpan -> Ident -> NameSource -> DeclarationRef -- | A module, in its entirety ModuleRef :: SourceSpan -> ModuleName -> DeclarationRef -- | A value re-exported from another module. These will be inserted during -- elaboration in name desugaring. ReExportRef :: SourceSpan -> ExportSource -> DeclarationRef -> DeclarationRef data NameSource UserNamed :: NameSource CompilerNamed :: NameSource -- | 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 -- | Categories of hints data HintCategory ExprHint :: HintCategory KindHint :: HintCategory CheckHint :: HintCategory PositionHint :: HintCategory SolverHint :: HintCategory DeclarationHint :: HintCategory OtherHint :: HintCategory -- | Error message hints, providing more detailed information about -- failure. data ErrorMessageHint ErrorUnifyingTypes :: SourceType -> SourceType -> ErrorMessageHint ErrorInExpression :: Expr -> ErrorMessageHint ErrorInModule :: ModuleName -> ErrorMessageHint ErrorInInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> ErrorMessageHint ErrorInSubsumption :: SourceType -> SourceType -> ErrorMessageHint ErrorInRowLabel :: Label -> ErrorMessageHint ErrorCheckingAccessor :: Expr -> PSString -> ErrorMessageHint ErrorCheckingType :: Expr -> SourceType -> ErrorMessageHint ErrorCheckingKind :: SourceType -> SourceType -> ErrorMessageHint ErrorCheckingGuard :: ErrorMessageHint ErrorInferringType :: Expr -> ErrorMessageHint ErrorInferringKind :: SourceType -> ErrorMessageHint ErrorInApplication :: Expr -> SourceType -> Expr -> ErrorMessageHint ErrorInDataConstructor :: ProperName 'ConstructorName -> ErrorMessageHint ErrorInTypeConstructor :: ProperName 'TypeName -> ErrorMessageHint ErrorInBindingGroup :: NonEmpty Ident -> ErrorMessageHint ErrorInDataBindingGroup :: [ProperName 'TypeName] -> ErrorMessageHint ErrorInTypeSynonym :: ProperName 'TypeName -> ErrorMessageHint ErrorInValueDeclaration :: Ident -> ErrorMessageHint ErrorInTypeDeclaration :: Ident -> ErrorMessageHint ErrorInTypeClassDeclaration :: ProperName 'ClassName -> ErrorMessageHint ErrorInKindDeclaration :: ProperName 'TypeName -> ErrorMessageHint ErrorInRoleDeclaration :: ProperName 'TypeName -> ErrorMessageHint ErrorInForeignImport :: Ident -> ErrorMessageHint ErrorInForeignImportData :: ProperName 'TypeName -> ErrorMessageHint ErrorSolvingConstraint :: SourceConstraint -> ErrorMessageHint MissingConstructorImportForCoercible :: Qualified (ProperName 'ConstructorName) -> ErrorMessageHint PositionedError :: NonEmpty SourceSpan -> ErrorMessageHint RelatedPositions :: NonEmpty SourceSpan -> ErrorMessageHint -- | Holds the data necessary to do type directed search for typed holes data TypeSearch -- | An Environment captured for later consumption by type directed search TSBefore :: Environment -> TypeSearch -- | Results of applying type directed search to the previously captured -- Environment TSAfter :: [(Qualified Text, SourceType)] -> Maybe [(Label, SourceType)] -> TypeSearch -- | The identifiers that fully satisfy the subsumption check [tsAfterIdentifiers] :: TypeSearch -> [(Qualified Text, SourceType)] -- | Record fields that are available on the first argument to the typed -- hole [tsAfterRecordFields] :: TypeSearch -> Maybe [(Label, SourceType)] -- | A map of locally-bound names in scope. type Context = [(Ident, SourceType)] pattern MkUnguarded :: Expr -> GuardedExpr pattern TypeFixityDeclaration :: SourceAnn -> Fixity -> Qualified (ProperName 'TypeName) -> OpName 'TypeOpName -> Declaration pattern ValueFixityDeclaration :: SourceAnn -> Fixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -> OpName 'ValueOpName -> Declaration pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch onTypeSearchTypesM :: Applicative m => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch -- | Return a module's name. getModuleName :: Module -> ModuleName -- | Return a module's source span. getModuleSourceSpan :: Module -> SourceSpan -- | Return a module's declarations. getModuleDeclarations :: Module -> [Declaration] -- | Add an import declaration for a module if it does not already -- explicitly import it. -- -- Will not import an unqualified module if that module has already been -- imported qualified. (See #2197) addDefaultImport :: Qualified ModuleName -> Module -> Module -- | Adds import declarations to a module for an implicit Prim import and -- Prim | qualified as Prim, as necessary. importPrim :: Module -> Module declRefSourceSpan :: DeclarationRef -> SourceSpan declRefName :: DeclarationRef -> Name getTypeRef :: DeclarationRef -> Maybe (ProperName 'TypeName, Maybe [ProperName 'ConstructorName]) getTypeOpRef :: DeclarationRef -> Maybe (OpName 'TypeOpName) getValueRef :: DeclarationRef -> Maybe Ident getValueOpRef :: DeclarationRef -> Maybe (OpName 'ValueOpName) getTypeClassRef :: DeclarationRef -> Maybe (ProperName 'ClassName) isModuleRef :: DeclarationRef -> Bool isExplicit :: ImportDeclarationType -> Bool getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType) getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr]) mapDataCtorFields :: ([(Ident, SourceType)] -> [(Ident, SourceType)]) -> DataConstructorDeclaration -> DataConstructorDeclaration traverseDataCtorFields :: Monad m => ([(Ident, SourceType)] -> m [(Ident, SourceType)]) -> DataConstructorDeclaration -> m DataConstructorDeclaration mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody -- | A traversal for TypeInstanceBody traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody declSourceAnn :: Declaration -> SourceAnn declSourceSpan :: Declaration -> SourceSpan declName :: Declaration -> Maybe Name -- | Test if a declaration is a value declaration isValueDecl :: Declaration -> Bool -- | Test if a declaration is a data type declaration isDataDecl :: Declaration -> Bool -- | Test if a declaration is a type synonym declaration isTypeSynonymDecl :: Declaration -> Bool -- | Test if a declaration is a module import isImportDecl :: Declaration -> Bool -- | Test if a declaration is a role declaration isRoleDecl :: 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 getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity) -- | Test if a declaration is a foreign import isExternDecl :: Declaration -> Bool -- | Test if a declaration is a type class instance declaration isTypeClassInstanceDecl :: Declaration -> Bool -- | Test if a declaration is a type class declaration isTypeClassDecl :: Declaration -> Bool -- | Test if a declaration is a kind signature declaration. isKindDecl :: Declaration -> Bool -- | Recursively flatten data binding groups in the list of declarations flattenDecls :: [Declaration] -> [Declaration] isTrueExpr :: Expr -> Bool isAnonymousArgument :: Expr -> Bool data ScopedIdent LocalIdent :: Ident -> ScopedIdent ToplevelIdent :: Ident -> ScopedIdent guardedExprM :: Applicative m => (Guard -> m Guard) -> (Expr -> m Expr) -> GuardedExpr -> m GuardedExpr mapGuardedExpr :: (Guard -> Guard) -> (Expr -> Expr) -> GuardedExpr -> GuardedExpr litM :: Monad m => (a -> m a) -> Literal a -> m (Literal a) everywhereOnValues :: (Declaration -> Declaration) -> (Expr -> Expr) -> (Binder -> Binder) -> (Declaration -> Declaration, Expr -> Expr, Binder -> Binder) everywhereOnValuesTopDownM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everywhereOnValuesM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everythingOnValues :: forall r. (r -> r -> r) -> (Declaration -> r) -> (Expr -> r) -> (Binder -> r) -> (CaseAlternative -> r) -> (DoNotationElement -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) everythingWithContextOnValues :: forall s r. s -> r -> (r -> r -> r) -> (s -> Declaration -> (s, r)) -> (s -> Expr -> (s, r)) -> (s -> Binder -> (s, r)) -> (s -> CaseAlternative -> (s, r)) -> (s -> DoNotationElement -> (s, r)) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) everywhereWithContextOnValues :: forall s. s -> (s -> Declaration -> (s, Declaration)) -> (s -> Expr -> (s, Expr)) -> (s -> Binder -> (s, Binder)) -> (s -> CaseAlternative -> (s, CaseAlternative)) -> (s -> DoNotationElement -> (s, DoNotationElement)) -> (s -> Guard -> (s, Guard)) -> (Declaration -> Declaration, Expr -> Expr, Binder -> Binder, CaseAlternative -> CaseAlternative, DoNotationElement -> DoNotationElement, Guard -> Guard) everywhereWithContextOnValuesM :: forall m s. Monad m => s -> (s -> Declaration -> m (s, Declaration)) -> (s -> Expr -> m (s, Expr)) -> (s -> Binder -> m (s, Binder)) -> (s -> CaseAlternative -> m (s, CaseAlternative)) -> (s -> DoNotationElement -> m (s, DoNotationElement)) -> (s -> Guard -> m (s, Guard)) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder, CaseAlternative -> m CaseAlternative, DoNotationElement -> m DoNotationElement, Guard -> m Guard) inScope :: Ident -> Set ScopedIdent -> Bool everythingWithScope :: forall r. Monoid r => (Set ScopedIdent -> Declaration -> r) -> (Set ScopedIdent -> Expr -> r) -> (Set ScopedIdent -> Binder -> r) -> (Set ScopedIdent -> CaseAlternative -> r) -> (Set ScopedIdent -> DoNotationElement -> r) -> (Set ScopedIdent -> Declaration -> r, Set ScopedIdent -> Expr -> r, Set ScopedIdent -> Binder -> r, Set ScopedIdent -> CaseAlternative -> r, Set ScopedIdent -> DoNotationElement -> r) accumTypes :: Monoid r => (SourceType -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) -- | Map a function over type annotations appearing inside a value overTypes :: (SourceType -> SourceType) -> Expr -> Expr -- | Return a list of all declarations which are exported from a module. -- This function descends into data declarations to filter out unexported -- data constructors, and also filters out type instance declarations if -- they refer to classes or types which are not themselves exported. -- -- Note that this function assumes that the module has already had its -- imports desugared using desugarImports. It will produce -- incorrect results if this is not the case - for example, type class -- instances will be incorrectly removed in some cases. -- -- The returned declarations are in the same order as they appear in the -- export list, unless there is no export list, in which case they appear -- in the same order as they do in the source file. -- -- Kind signatures declarations are also exported if their associated -- declaration is exported. 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 -- | Replace every BoundValueDeclaration in Let -- expressions with Case expressions. desugarLetPatternModule :: Module -> Module type PrettyPrintConstraint = (Qualified (ProperName 'ClassName), [PrettyPrintType], [PrettyPrintType]) data PrettyPrintType PPTUnknown :: Int -> PrettyPrintType PPTypeVar :: Text -> Maybe Text -> PrettyPrintType PPTypeLevelString :: PSString -> PrettyPrintType PPTypeLevelInt :: Integer -> PrettyPrintType PPTypeWildcard :: Maybe Text -> PrettyPrintType PPTypeConstructor :: Qualified (ProperName 'TypeName) -> PrettyPrintType PPTypeOp :: Qualified (OpName 'TypeOpName) -> PrettyPrintType PPSkolem :: Text -> Int -> PrettyPrintType PPTypeApp :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPKindArg :: PrettyPrintType -> PrettyPrintType PPConstrainedType :: PrettyPrintConstraint -> PrettyPrintType -> PrettyPrintType PPKindedType :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPBinaryNoParensType :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPParensInType :: PrettyPrintType -> PrettyPrintType PPForAll :: [(TypeVarVisibility, Text, Maybe PrettyPrintType)] -> PrettyPrintType -> PrettyPrintType PPFunction :: PrettyPrintType -> PrettyPrintType -> PrettyPrintType PPRecord :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> PrettyPrintType PPRow :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> PrettyPrintType PPTruncated :: PrettyPrintType convertPrettyPrintType :: Int -> Type a -> PrettyPrintType typeAtomAsBox :: Int -> Type a -> Box -- | Generate a pretty-printed string representing a Type, as it should -- appear inside parentheses prettyPrintTypeAtom :: Int -> Type a -> String typeAsBox :: Int -> Type a -> Box typeDiffAsBox :: Int -> Type a -> Box -- | Generate a pretty-printed string representing a Type prettyPrintType :: Int -> Type a -> String -- | Generate a pretty-printed string representing a Type using -- unicode symbols where applicable prettyPrintTypeWithUnicode :: Int -> Type a -> String -- | Generate a pretty-printed string representing a suggested Type prettyPrintSuggestedType :: Type a -> String prettyPrintLabel :: Label -> Text prettyPrintObjectKey :: PSString -> Text -- | Pretty-print an expression prettyPrintValue :: Int -> Expr -> Box prettyPrintBinderAtom :: Binder -> Text -- | Generate a pretty-printed string representing a Binder prettyPrintBinder :: Binder -> Text -- | prettyPrintSingleError Options data PPEOptions PPEOptions :: Maybe (ColorIntensity, Color) -> Bool -> Level -> Bool -> FilePath -> [(FilePath, Text)] -> PPEOptions -- | Color code with this color... or not [ppeCodeColor] :: PPEOptions -> Maybe (ColorIntensity, Color) -- | Should write a full error message? [ppeFull] :: PPEOptions -> Bool -- | Should this report an error or a warning? [ppeLevel] :: PPEOptions -> Level -- | Should show a link to error message's doc page? [ppeShowDocs] :: PPEOptions -> Bool -- | FilePath to which the errors are relative [ppeRelativeDirectory] :: PPEOptions -> FilePath -- | Unparsed contents of source files [ppeFileContents] :: PPEOptions -> [(FilePath, Text)] -- | How critical the issue is data Level Error :: Level Warning :: Level -- | A map from rigid type variable name/unknown variable pairs to new -- variables. data TypeMap TypeMap :: Map Int (String, Int, Maybe SourceSpan) -> Map Int Int -> Int -> TypeMap -- | a map from skolems to their new names, including source and naming -- info [umSkolemMap] :: TypeMap -> Map Int (String, Int, Maybe SourceSpan) -- | a map from unification variables to their new names [umUnknownMap] :: TypeMap -> Map Int Int -- | unknowns and skolems share a source of names during renaming, to avoid -- overlaps in error messages. This is the next label for either case. [umNextIndex] :: TypeMap -> Int -- | A stack trace for an error newtype MultipleErrors MultipleErrors :: [ErrorMessage] -> MultipleErrors [runMultipleErrors] :: MultipleErrors -> [ErrorMessage] newtype ErrorSuggestion ErrorSuggestion :: Text -> ErrorSuggestion data ErrorMessage ErrorMessage :: [ErrorMessageHint] -> SimpleErrorMessage -> ErrorMessage -- | A type of error messages data SimpleErrorMessage InternalCompilerError :: Text -> Text -> SimpleErrorMessage ModuleNotFound :: ModuleName -> SimpleErrorMessage ErrorParsingFFIModule :: FilePath -> Maybe ErrorMessage -> SimpleErrorMessage ErrorParsingCSTModule :: ParserError -> SimpleErrorMessage WarningParsingCSTModule :: ParserWarning -> SimpleErrorMessage MissingFFIModule :: ModuleName -> SimpleErrorMessage UnnecessaryFFIModule :: ModuleName -> FilePath -> SimpleErrorMessage MissingFFIImplementations :: ModuleName -> [Ident] -> SimpleErrorMessage UnusedFFIImplementations :: ModuleName -> [Ident] -> SimpleErrorMessage InvalidFFIIdentifier :: ModuleName -> Text -> SimpleErrorMessage DeprecatedFFIPrime :: ModuleName -> Text -> SimpleErrorMessage DeprecatedFFICommonJSModule :: ModuleName -> FilePath -> SimpleErrorMessage UnsupportedFFICommonJSExports :: ModuleName -> [Text] -> SimpleErrorMessage UnsupportedFFICommonJSImports :: ModuleName -> [Text] -> SimpleErrorMessage -- | A description of what we were trying to do, and the error which -- occurred FileIOError :: Text -> IOError -> SimpleErrorMessage InfiniteType :: SourceType -> SimpleErrorMessage InfiniteKind :: SourceType -> SimpleErrorMessage MultipleValueOpFixities :: OpName 'ValueOpName -> SimpleErrorMessage MultipleTypeOpFixities :: OpName 'TypeOpName -> SimpleErrorMessage OrphanTypeDeclaration :: Ident -> SimpleErrorMessage OrphanKindDeclaration :: ProperName 'TypeName -> SimpleErrorMessage OrphanRoleDeclaration :: ProperName 'TypeName -> SimpleErrorMessage RedefinedIdent :: Ident -> SimpleErrorMessage OverlappingNamesInLet :: Ident -> SimpleErrorMessage UnknownName :: Qualified Name -> SimpleErrorMessage UnknownImport :: ModuleName -> Name -> SimpleErrorMessage UnknownImportDataConstructor :: ModuleName -> ProperName 'TypeName -> ProperName 'ConstructorName -> SimpleErrorMessage UnknownExport :: Name -> SimpleErrorMessage UnknownExportDataConstructor :: ProperName 'TypeName -> ProperName 'ConstructorName -> SimpleErrorMessage ScopeConflict :: Name -> [ModuleName] -> SimpleErrorMessage ScopeShadowing :: Name -> Maybe ModuleName -> [ModuleName] -> SimpleErrorMessage DeclConflict :: Name -> Name -> SimpleErrorMessage ExportConflict :: Qualified Name -> Qualified Name -> SimpleErrorMessage DuplicateModule :: ModuleName -> SimpleErrorMessage DuplicateTypeClass :: ProperName 'ClassName -> SourceSpan -> SimpleErrorMessage DuplicateInstance :: Ident -> SourceSpan -> SimpleErrorMessage DuplicateTypeArgument :: Text -> SimpleErrorMessage InvalidDoBind :: SimpleErrorMessage InvalidDoLet :: SimpleErrorMessage CycleInDeclaration :: Ident -> SimpleErrorMessage CycleInTypeSynonym :: NonEmpty (ProperName 'TypeName) -> SimpleErrorMessage CycleInTypeClassDeclaration :: NonEmpty (Qualified (ProperName 'ClassName)) -> SimpleErrorMessage CycleInKindDeclaration :: NonEmpty (Qualified (ProperName 'TypeName)) -> SimpleErrorMessage CycleInModules :: NonEmpty ModuleName -> SimpleErrorMessage NameIsUndefined :: Ident -> SimpleErrorMessage UndefinedTypeVariable :: ProperName 'TypeName -> SimpleErrorMessage PartiallyAppliedSynonym :: Qualified (ProperName 'TypeName) -> SimpleErrorMessage EscapedSkolem :: Text -> Maybe SourceSpan -> SourceType -> SimpleErrorMessage TypesDoNotUnify :: SourceType -> SourceType -> SimpleErrorMessage KindsDoNotUnify :: SourceType -> SourceType -> SimpleErrorMessage ConstrainedTypeUnified :: SourceType -> SourceType -> SimpleErrorMessage OverlappingInstances :: Qualified (ProperName 'ClassName) -> [SourceType] -> [Qualified (Either SourceType Ident)] -> SimpleErrorMessage NoInstanceFound :: SourceConstraint -> [Qualified (Either SourceType Ident)] -> Bool -> SimpleErrorMessage AmbiguousTypeVariables :: SourceType -> [(Text, Int)] -> SimpleErrorMessage UnknownClass :: Qualified (ProperName 'ClassName) -> SimpleErrorMessage PossiblyInfiniteInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage PossiblyInfiniteCoercibleInstance :: SimpleErrorMessage CannotDerive :: Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage InvalidDerivedInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> Int -> SimpleErrorMessage ExpectedTypeConstructor :: Qualified (ProperName 'ClassName) -> [SourceType] -> SourceType -> SimpleErrorMessage InvalidNewtypeInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage MissingNewtypeSuperclassInstance :: Qualified (ProperName 'ClassName) -> Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage UnverifiableSuperclassInstance :: Qualified (ProperName 'ClassName) -> Qualified (ProperName 'ClassName) -> [SourceType] -> SimpleErrorMessage CannotFindDerivingType :: ProperName 'TypeName -> SimpleErrorMessage DuplicateLabel :: Label -> Maybe Expr -> SimpleErrorMessage DuplicateValueDeclaration :: Ident -> SimpleErrorMessage ArgListLengthsDiffer :: Ident -> SimpleErrorMessage OverlappingArgNames :: Maybe Ident -> SimpleErrorMessage MissingClassMember :: NonEmpty (Ident, SourceType) -> SimpleErrorMessage ExtraneousClassMember :: Ident -> Qualified (ProperName 'ClassName) -> SimpleErrorMessage ExpectedType :: SourceType -> SourceType -> SimpleErrorMessage -- | constructor name, expected argument count, actual argument count IncorrectConstructorArity :: Qualified (ProperName 'ConstructorName) -> Int -> Int -> SimpleErrorMessage ExprDoesNotHaveType :: Expr -> SourceType -> SimpleErrorMessage PropertyIsMissing :: Label -> SimpleErrorMessage AdditionalProperty :: Label -> SimpleErrorMessage OrphanInstance :: Ident -> Qualified (ProperName 'ClassName) -> Set ModuleName -> [SourceType] -> SimpleErrorMessage InvalidNewtype :: ProperName 'TypeName -> SimpleErrorMessage InvalidInstanceHead :: SourceType -> SimpleErrorMessage TransitiveExportError :: DeclarationRef -> [DeclarationRef] -> SimpleErrorMessage TransitiveDctorExportError :: DeclarationRef -> [ProperName 'ConstructorName] -> SimpleErrorMessage HiddenConstructors :: DeclarationRef -> Qualified (ProperName 'ClassName) -> SimpleErrorMessage ShadowedName :: Ident -> SimpleErrorMessage ShadowedTypeVar :: Text -> SimpleErrorMessage UnusedTypeVar :: Text -> SimpleErrorMessage UnusedName :: Ident -> SimpleErrorMessage UnusedDeclaration :: Ident -> SimpleErrorMessage WildcardInferredType :: SourceType -> Context -> SimpleErrorMessage HoleInferredType :: Text -> SourceType -> Context -> Maybe TypeSearch -> SimpleErrorMessage MissingTypeDeclaration :: Ident -> SourceType -> SimpleErrorMessage MissingKindDeclaration :: KindSignatureFor -> ProperName 'TypeName -> SourceType -> SimpleErrorMessage OverlappingPattern :: [[Binder]] -> Bool -> SimpleErrorMessage IncompleteExhaustivityCheck :: SimpleErrorMessage ImportHidingModule :: ModuleName -> SimpleErrorMessage UnusedImport :: ModuleName -> Maybe ModuleName -> SimpleErrorMessage UnusedExplicitImport :: ModuleName -> [Name] -> Maybe ModuleName -> [DeclarationRef] -> SimpleErrorMessage UnusedDctorImport :: ModuleName -> ProperName 'TypeName -> Maybe ModuleName -> [DeclarationRef] -> SimpleErrorMessage UnusedDctorExplicitImport :: ModuleName -> ProperName 'TypeName -> [ProperName 'ConstructorName] -> Maybe ModuleName -> [DeclarationRef] -> SimpleErrorMessage DuplicateSelectiveImport :: ModuleName -> SimpleErrorMessage DuplicateImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> SimpleErrorMessage DuplicateImportRef :: Name -> SimpleErrorMessage DuplicateExportRef :: Name -> SimpleErrorMessage IntOutOfRange :: Integer -> Text -> Integer -> Integer -> SimpleErrorMessage ImplicitQualifiedImport :: ModuleName -> ModuleName -> [DeclarationRef] -> SimpleErrorMessage ImplicitQualifiedImportReExport :: ModuleName -> ModuleName -> [DeclarationRef] -> SimpleErrorMessage ImplicitImport :: ModuleName -> [DeclarationRef] -> SimpleErrorMessage HidingImport :: ModuleName -> [DeclarationRef] -> SimpleErrorMessage CaseBinderLengthDiffers :: Int -> [Binder] -> SimpleErrorMessage IncorrectAnonymousArgument :: SimpleErrorMessage InvalidOperatorInBinder :: Qualified (OpName 'ValueOpName) -> Qualified Ident -> SimpleErrorMessage CannotGeneralizeRecursiveFunction :: Ident -> SourceType -> SimpleErrorMessage CannotDeriveNewtypeForData :: ProperName 'TypeName -> SimpleErrorMessage ExpectedWildcard :: ProperName 'TypeName -> SimpleErrorMessage CannotUseBindWithDo :: Ident -> SimpleErrorMessage -- | instance name, type class, expected argument count, actual argument -- count ClassInstanceArityMismatch :: Ident -> Qualified (ProperName 'ClassName) -> Int -> Int -> SimpleErrorMessage -- | a user-defined warning raised by using the Warn type class UserDefinedWarning :: SourceType -> SimpleErrorMessage -- | a declaration couldn't be used because it contained free variables UnusableDeclaration :: Ident -> [[Text]] -> SimpleErrorMessage CannotDefinePrimModules :: ModuleName -> SimpleErrorMessage MixedAssociativityError :: NonEmpty (Qualified (OpName 'AnyOpName), Associativity) -> SimpleErrorMessage NonAssociativeError :: NonEmpty (Qualified (OpName 'AnyOpName)) -> SimpleErrorMessage QuantificationCheckFailureInKind :: Text -> SimpleErrorMessage QuantificationCheckFailureInType :: [Int] -> SourceType -> SimpleErrorMessage VisibleQuantificationCheckFailureInType :: Text -> SimpleErrorMessage UnsupportedTypeInKind :: SourceType -> SimpleErrorMessage -- | Declared role was more permissive than inferred. RoleMismatch :: Text -> Role -> Role -> SimpleErrorMessage InvalidCoercibleInstanceDeclaration :: [SourceType] -> SimpleErrorMessage UnsupportedRoleDeclaration :: SimpleErrorMessage RoleDeclarationArityMismatch :: ProperName 'TypeName -> Int -> Int -> SimpleErrorMessage DuplicateRoleDeclaration :: ProperName 'TypeName -> SimpleErrorMessage CannotDeriveInvalidConstructorArg :: Qualified (ProperName 'ClassName) -> [Qualified (ProperName 'ClassName)] -> Bool -> SimpleErrorMessage CannotSkipTypeApplication :: SourceType -> SimpleErrorMessage CannotApplyExpressionOfTypeOnType :: SourceType -> SourceType -> SimpleErrorMessage -- | Get the source span for an error errorSpan :: ErrorMessage -> Maybe (NonEmpty 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 -> Text -- | 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 simple error message and source -- annotation errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors -- | Create an error set from a single simple error message and source -- annotations errorMessage'' :: NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors -- | Create an error from multiple (possibly empty) source spans, reversed -- sorted. errorMessage''' :: [SourceSpan] -> 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 -- | Add hints to an error message addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors defaultUnknownMap :: TypeMap -- | Extract nested error messages from wrapper errors unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage replaceUnknowns :: SourceType -> State TypeMap SourceType onTypesInErrorMessage :: (SourceType -> SourceType) -> ErrorMessage -> ErrorMessage onTypesInErrorMessageM :: Applicative m => (SourceType -> m SourceType) -> ErrorMessage -> m ErrorMessage errorDocUri :: ErrorMessage -> Text errorSuggestion :: SimpleErrorMessage -> Maybe ErrorSuggestion suggestionSpan :: ErrorMessage -> Maybe SourceSpan showSuggestion :: SimpleErrorMessage -> Text ansiColor :: (ColorIntensity, Color) -> String ansiColorReset :: String colorCode :: Maybe (ColorIntensity, Color) -> Text -> Text colorCodeBox :: Maybe (ColorIntensity, Color) -> Box -> Box commasAndConjunction :: Text -> [Text] -> Text -- | Default color intensity and color for code defaultCodeColor :: (ColorIntensity, Color) -- | Default options for PPEOptions defaultPPEOptions :: PPEOptions -- | Pretty print a single error, simplifying if necessary prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box prettyPrintExport :: DeclarationRef -> Text prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Text prettyPrintRef :: DeclarationRef -> Maybe Text prettyPrintKindSignatureFor :: KindSignatureFor -> Text prettyPrintSuggestedTypeSimplified :: Type a -> String -- | Pretty print multiple errors prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String -- | Pretty print multiple warnings prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String -- | Pretty print warnings as a Box prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box] -- | Pretty print errors as a Box prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box] prettyPrintMultipleErrorsWith :: PPEOptions -> String -> String -> MultipleErrors -> [Box] line :: Text -> Box lineS :: String -> Box renderBox :: Box -> String toTypelevelString :: Type a -> Maybe Box -- | Rethrow an error with a more detailed error message in the case of -- failure rethrow :: MonadError e m => (e -> e) -> m 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 withoutPosition :: ErrorMessage -> ErrorMessage positionedError :: SourceSpan -> ErrorMessageHint -- | 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 :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b] internalCompilerError :: (MonadError MultipleErrors m, HasCallStack) => Text -> m a -- | Lookup the roles for a type in the environment. If the type does not -- have roles (e.g. is a type synonym or a type variable), then this -- function returns an empty list. lookupRoles :: Environment -> Qualified (ProperName 'TypeName) -> [Role] -- | Compares the inferred roles to the explicitly declared roles and -- ensures that the explicitly declared roles are not more permissive -- than the inferred ones. checkRoles :: forall m. MonadError MultipleErrors m => [(Text, Maybe SourceType, Role)] -> [Role] -> m () checkRoleDeclarationArity :: forall m. MonadError MultipleErrors m => ProperName 'TypeName -> [Role] -> Int -> m () -- | Infers roles for the given data type declaration. inferRoles :: Environment -> ModuleName -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> [DataConstructorDeclaration] -> [Role] inferDataBindingGroupRoles :: Environment -> ModuleName -> [RoleDeclarationData] -> [DataDeclaration] -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> [Role] -- | Unification variables type Unknown = Int -- | State required for type checking data CheckState CheckState :: Environment -> Int -> Int -> Int -> Maybe ModuleName -> [(SourceAnn, ModuleName, ImportDeclarationType, Maybe ModuleName, Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource))] -> Substitution -> [ErrorMessageHint] -> Set (ModuleName, Qualified (ProperName 'ConstructorName)) -> CheckState -- | The current Environment [checkEnv] :: CheckState -> Environment -- | The next type unification variable [checkNextType] :: 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 module imports and their exported types. Newtype -- constructors have to be in scope for some Coercible constraints to be -- solvable, so we need to know which constructors are imported and -- whether they are actually defined in or re-exported from the imported -- modules. [checkCurrentModuleImports] :: CheckState -> [(SourceAnn, ModuleName, ImportDeclarationType, Maybe ModuleName, Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource))] -- | The current substitution [checkSubstitution] :: CheckState -> Substitution -- | The current error message hint stack. This goes into state, rather -- than using rethrow, since this way, we can provide good error -- messages during instance resolution. [checkHints] :: CheckState -> [ErrorMessageHint] -- | Newtype constructors imports required to solve Coercible constraints. -- We have to keep track of them so that we don't emit unused import -- warnings. [checkConstructorImportsForCoercible] :: CheckState -> Set (ModuleName, Qualified (ProperName 'ConstructorName)) -- | A substitution of unification variables for types. data Substitution Substitution :: Map Int SourceType -> Map Int (UnkLevel, SourceType) -> Map Int Text -> Substitution -- | Type substitution [substType] :: Substitution -> Map Int SourceType -- | Unsolved unification variables with their level (scope ordering) and -- kind [substUnsolved] :: Substitution -> Map Int (UnkLevel, SourceType) -- | The original names of unknowns [substNames] :: Substitution -> Map Int Text newtype UnkLevel UnkLevel :: NonEmpty Unknown -> UnkLevel insertUnkName :: MonadState CheckState m => Unknown -> Text -> m () lookupUnkName :: MonadState CheckState m => Unknown -> m (Maybe Text) -- | An empty substitution emptySubstitution :: Substitution -- | Create an empty CheckState emptyCheckState :: Environment -> CheckState -- | Temporarily bind a collection of names to values bindNames :: MonadState CheckState m => Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> m a -> m a -- | Temporarily bind a collection of names to types bindTypes :: MonadState CheckState m => Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -> m a -> m a -- | Temporarily bind a collection of names to types withScopedTypeVars :: (MonadState CheckState m, MonadWriter MultipleErrors m) => ModuleName -> [(Text, SourceType)] -> m a -> m a withErrorMessageHint :: (MonadState CheckState m, MonadError MultipleErrors m) => ErrorMessageHint -> m a -> m a -- | These hints are added at the front, so the most nested hint occurs at -- the front, but the simplifier assumes the reverse order. getHints :: MonadState CheckState m => m [ErrorMessageHint] rethrowWithPositionTC :: (MonadState CheckState m, MonadError MultipleErrors m) => SourceSpan -> m a -> m a warnAndRethrowWithPositionTC :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a -- | Temporarily make a collection of type class dictionaries available withTypeClassDictionaries :: MonadState CheckState m => [NamedDict] -> m a -> m a -- | Get the currently available map of type class dictionaries getTypeClassDictionaries :: MonadState CheckState m => m (Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) -- | Lookup type class dictionaries in a module. lookupTypeClassDictionaries :: MonadState CheckState m => QualifiedBy -> m (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -- | Lookup type class dictionaries in a module. lookupTypeClassDictionariesForClass :: MonadState CheckState m => QualifiedBy -> Qualified (ProperName 'ClassName) -> m (Map (Qualified Ident) (NonEmpty NamedDict)) -- | Temporarily bind a collection of names to local variables bindLocalVariables :: MonadState CheckState m => [(SourceSpan, Ident, SourceType, NameVisibility)] -> m a -> m a -- | Temporarily bind a collection of names to local type variables bindLocalTypeVariables :: MonadState CheckState m => ModuleName -> [(ProperName 'TypeName, SourceType)] -> 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) => Qualified Ident -> m SourceType -- | Lookup the visibility of a value by name in the Environment getVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m NameVisibility -- | Assert that a name is visible checkVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => 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 SourceType -- | Get the current Environment getEnv :: MonadState CheckState m => m Environment -- | Get locally-bound names in context, to create an error message. getLocalContext :: MonadState CheckState m => m Context -- | 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, failing with an error, or -- succeeding with a return value and the final Environment. runCheck :: Functor m => CheckState -> StateT CheckState m a -> m (a, Environment) -- | Make an assertion, failing with an error message guardWith :: MonadError e m => e -> Bool -> m () capturingSubstitution :: MonadState CheckState m => (a -> Substitution -> b) -> m a -> m b withFreshSubstitution :: MonadState CheckState m => m a -> m a withoutWarnings :: MonadWriter w m => m a -> m (a, w) unsafeCheckCurrentModule :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => m ModuleName debugEnv :: Environment -> [String] debugType :: Type a -> String debugConstraint :: Constraint a -> String debugTypes :: Environment -> [String] debugNames :: Environment -> [String] debugDataConstructors :: Environment -> [String] debugTypeSynonyms :: Environment -> [String] debugTypeClassDictionaries :: Environment -> [String] debugTypeClasses :: Environment -> [String] debugValue :: Expr -> String debugSubstitution :: Substitution -> [String] type KindMap = Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | Type synonym information (arguments with kinds, aliased type), indexed -- by name type SynonymMap = Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) -- | Replace fully applied type synonyms replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => SourceType -> m SourceType -- | Replace fully applied type synonyms by explicitly providing a -- SynonymMap. replaceAllTypeSynonymsM :: MonadError MultipleErrors m => SynonymMap -> KindMap -> SourceType -> m SourceType freshKind :: MonadState CheckState m => SourceSpan -> m SourceType freshKindWithKind :: MonadState CheckState m => SourceSpan -> SourceType -> m SourceType unknownsWithKinds :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, HasCallStack) => [Unknown] -> m [(Unknown, SourceType)] inferKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m (SourceType, SourceType) checkKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m SourceType instantiateKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => (SourceType, SourceType) -> SourceType -> m SourceType subsumesKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () unifyKinds :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () -- | Does not attach positions to the error node, instead relies on the | -- local position context. This is useful when invoking kind unification -- | outside of kind checker internals. unifyKinds' :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () -- | Check the kind of a type, failing if it is not of kind *. checkTypeKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> SourceType -> m () elaborateKind :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m SourceType kindOfWithUnknowns :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m (([(Unknown, SourceType)], SourceType), SourceType) -- | Infer the kind of a single type kindOf :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m (SourceType, SourceType) -- | Infer the kind of a single type, returning the kinds of any scoped -- type variables kindOfWithScopedVars :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => SourceType -> m (([(Text, SourceType)], SourceType), SourceType) kindOfData :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> DataDeclarationArgs -> m DataDeclarationResult kindOfTypeSynonym :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> TypeDeclarationArgs -> m TypeDeclarationResult kindOfClass :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> ClassDeclarationArgs -> m ClassDeclarationResult checkConstraint :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => SourceConstraint -> m SourceConstraint checkInstanceDeclaration :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> InstanceDeclarationArgs -> m InstanceDeclarationResult checkKindDeclaration :: forall m. (MonadSupply m, MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> SourceType -> m SourceType kindsOfAll :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> [TypeDeclarationArgs] -> [DataDeclarationArgs] -> [ClassDeclarationArgs] -> m ([TypeDeclarationResult], [DataDeclarationResult], [ClassDeclarationResult]) -- | Replace all top level type declarations in a module with type -- annotations desugarTypeDeclarationsModule :: forall m. MonadError MultipleErrors m => Module -> m Module desugarObjectConstructors :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module desugarDecl :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration -- | 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 exported declarations from a module. data Exports Exports :: Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) -> Map (OpName 'TypeOpName) ExportSource -> Map (ProperName 'ClassName) ExportSource -> Map Ident ExportSource -> Map (OpName 'ValueOpName) ExportSource -> Exports -- | The exported types along with the module they originally came from. [exportedTypes] :: Exports -> Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) -- | The exported type operators along with the module they originally came -- from. [exportedTypeOps] :: Exports -> Map (OpName 'TypeOpName) ExportSource -- | The exported classes along with the module they originally came from. [exportedTypeClasses] :: Exports -> Map (ProperName 'ClassName) ExportSource -- | The exported values along with the module they originally came from. [exportedValues] :: Exports -> Map Ident ExportSource -- | The exported value operators along with the module they originally -- came from. [exportedValueOps] :: Exports -> Map (OpName 'ValueOpName) ExportSource -- | The imported declarations for a module, including the module's own -- members. data Imports Imports :: ImportMap (ProperName 'TypeName) -> ImportMap (OpName 'TypeOpName) -> ImportMap (ProperName 'ConstructorName) -> ImportMap (ProperName 'ClassName) -> ImportMap Ident -> ImportMap (OpName 'ValueOpName) -> Set ModuleName -> Set ModuleName -> ImportMap (ProperName 'TypeName) -> Imports -- | Local names for types within a module mapped to their qualified names [importedTypes] :: Imports -> ImportMap (ProperName 'TypeName) -- | Local names for type operators within a module mapped to their -- qualified names [importedTypeOps] :: Imports -> ImportMap (OpName 'TypeOpName) -- | Local names for data constructors within a module mapped to their -- qualified names [importedDataConstructors] :: Imports -> ImportMap (ProperName 'ConstructorName) -- | Local names for classes within a module mapped to their qualified -- names [importedTypeClasses] :: Imports -> ImportMap (ProperName 'ClassName) -- | Local names for values within a module mapped to their qualified names [importedValues] :: Imports -> ImportMap Ident -- | Local names for value operators within a module mapped to their -- qualified names [importedValueOps] :: Imports -> ImportMap (OpName 'ValueOpName) -- | The name of modules that have been imported into the current scope -- that can be re-exported. If a module is imported with as -- qualification, the as name appears here, otherwise the -- original name. [importedModules] :: Imports -> Set ModuleName -- | The "as" names of modules that have been imported qualified. [importedQualModules] :: Imports -> Set ModuleName -- | Local names for kinds within a module mapped to their qualified names [importedKinds] :: Imports -> ImportMap (ProperName 'TypeName) -- | 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 Prim :: ImportProvenance -- | 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 -> SourceSpan -> ImportProvenance -> ImportRecord a [importName] :: ImportRecord a -> Qualified a [importSourceModule] :: ImportRecord a -> ModuleName [importSourceSpan] :: ImportRecord a -> SourceSpan [importProvenance] :: ImportRecord a -> ImportProvenance -- | Environment which only contains the Prim modules. primEnv :: Env -- | Replace all DoNotationBind and DoNotationValue -- constructors with applications of the bind function in scope, and all -- DoNotationLet constructors with let expressions. desugarDoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module -- | Replace all top-level binders in a module with case expressions. desugarCasesModule :: (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module desugarCaseGuards :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] -- | Replace all top-level binders with case expressions. desugarCases :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] -- | Replace all sets of mutually-recursive declarations in a module with -- binding groups createBindingGroupsModule :: MonadError MultipleErrors m => Module -> m Module createBindingGroups :: forall m. MonadError MultipleErrors m => ModuleName -> [Declaration] -> m [Declaration] -- | Collapse all binding groups to individual declarations collapseBindingGroups :: [Declaration] -> [Declaration] -- | Replace all AdoNotationBind and AdoNotationValue -- constructors with applications of the pure and apply functions in -- scope, and all AdoNotationLet constructors with let -- expressions. desugarAdoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module data DependencyDepth Direct :: DependencyDepth Transitive :: DependencyDepth -- | A module signature for sorting dependencies. data ModuleSignature ModuleSignature :: SourceSpan -> ModuleName -> [(ModuleName, SourceSpan)] -> ModuleSignature [sigSourceSpan] :: ModuleSignature -> SourceSpan [sigModuleName] :: ModuleSignature -> ModuleName [sigImports] :: ModuleSignature -> [(ModuleName, SourceSpan)] -- | A list of modules with their transitive dependencies type ModuleGraph = [(ModuleName, [ModuleName])] -- | Sort a collection of modules based on module dependencies. -- -- Reports an error if the module graph contains a cycle. sortModules :: forall m a. MonadError MultipleErrors m => DependencyDepth -> (a -> ModuleSignature) -> [a] -> m ([a], ModuleGraph) moduleSignature :: Module -> ModuleSignature -- | Map of module name to list of imported names from that module which -- have been used. type UsedImports = Map ModuleName [Qualified Name] -- | Find and warn on: -- -- lintImports :: forall m. MonadWriter MultipleErrors m => Module -> Env -> UsedImports -> m () -- | Exhaustivity checking checkExhaustiveExpr :: forall m. MonadWriter MultipleErrors m => SourceSpan -> Environment -> ModuleName -> Expr -> m Expr -- | Lint the PureScript AST. | | Right now, this pass performs a shadowing -- check and a check for unused bindings. lint :: forall m. MonadWriter MultipleErrors m => Module -> m () -- | Renames within each declaration in a module. Returns the map of -- renamed identifiers in the top-level scope, so that they can be -- renamed in the externs files as well. renameInModule :: Module Ann -> (Map Ident Ident, Module Ann) -- | A type or value declaration appearing in an externs file data ExternsDeclaration -- | A type declaration EDType :: ProperName 'TypeName -> SourceType -> TypeKind -> ExternsDeclaration [edTypeName] :: ExternsDeclaration -> ProperName 'TypeName [edTypeKind] :: ExternsDeclaration -> SourceType [edTypeDeclarationKind] :: ExternsDeclaration -> TypeKind -- | A type synonym EDTypeSynonym :: ProperName 'TypeName -> [(Text, Maybe SourceType)] -> SourceType -> ExternsDeclaration [edTypeSynonymName] :: ExternsDeclaration -> ProperName 'TypeName [edTypeSynonymArguments] :: ExternsDeclaration -> [(Text, Maybe SourceType)] [edTypeSynonymType] :: ExternsDeclaration -> SourceType -- | A data constructor EDDataConstructor :: ProperName 'ConstructorName -> DataDeclType -> ProperName 'TypeName -> SourceType -> [Ident] -> ExternsDeclaration [edDataCtorName] :: ExternsDeclaration -> ProperName 'ConstructorName [edDataCtorOrigin] :: ExternsDeclaration -> DataDeclType [edDataCtorTypeCtor] :: ExternsDeclaration -> ProperName 'TypeName [edDataCtorType] :: ExternsDeclaration -> SourceType [edDataCtorFields] :: ExternsDeclaration -> [Ident] -- | A value declaration EDValue :: Ident -> SourceType -> ExternsDeclaration [edValueName] :: ExternsDeclaration -> Ident [edValueType] :: ExternsDeclaration -> SourceType -- | A type class declaration EDClass :: ProperName 'ClassName -> [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Bool -> ExternsDeclaration [edClassName] :: ExternsDeclaration -> ProperName 'ClassName [edClassTypeArguments] :: ExternsDeclaration -> [(Text, Maybe SourceType)] [edClassMembers] :: ExternsDeclaration -> [(Ident, SourceType)] [edClassConstraints] :: ExternsDeclaration -> [SourceConstraint] [edFunctionalDependencies] :: ExternsDeclaration -> [FunctionalDependency] [edIsEmpty] :: ExternsDeclaration -> Bool -- | An instance declaration EDInstance :: Qualified (ProperName 'ClassName) -> Ident -> [(Text, SourceType)] -> [SourceType] -> [SourceType] -> Maybe [SourceConstraint] -> Maybe ChainId -> Integer -> NameSource -> SourceSpan -> ExternsDeclaration [edInstanceClassName] :: ExternsDeclaration -> Qualified (ProperName 'ClassName) [edInstanceName] :: ExternsDeclaration -> Ident [edInstanceForAll] :: ExternsDeclaration -> [(Text, SourceType)] [edInstanceKinds] :: ExternsDeclaration -> [SourceType] [edInstanceTypes] :: ExternsDeclaration -> [SourceType] [edInstanceConstraints] :: ExternsDeclaration -> Maybe [SourceConstraint] [edInstanceChain] :: ExternsDeclaration -> Maybe ChainId [edInstanceChainIndex] :: ExternsDeclaration -> Integer [edInstanceNameSource] :: ExternsDeclaration -> NameSource [edInstanceSourceSpan] :: ExternsDeclaration -> SourceSpan -- | A type fixity declaration in an externs file data ExternsTypeFixity ExternsTypeFixity :: Associativity -> Precedence -> OpName 'TypeOpName -> Qualified (ProperName 'TypeName) -> ExternsTypeFixity -- | The associativity of the operator [efTypeAssociativity] :: ExternsTypeFixity -> Associativity -- | The precedence level of the operator [efTypePrecedence] :: ExternsTypeFixity -> Precedence -- | The operator symbol [efTypeOperator] :: ExternsTypeFixity -> OpName 'TypeOpName -- | The value the operator is an alias for [efTypeAlias] :: ExternsTypeFixity -> Qualified (ProperName 'TypeName) -- | A fixity declaration in an externs file data ExternsFixity ExternsFixity :: Associativity -> Precedence -> OpName 'ValueOpName -> Qualified (Either Ident (ProperName 'ConstructorName)) -> ExternsFixity -- | The associativity of the operator [efAssociativity] :: ExternsFixity -> Associativity -- | The precedence level of the operator [efPrecedence] :: ExternsFixity -> Precedence -- | The operator symbol [efOperator] :: ExternsFixity -> OpName 'ValueOpName -- | The value the operator is an alias for [efAlias] :: ExternsFixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -- | 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 -- | The data which will be serialized to an externs file data ExternsFile ExternsFile :: Text -> ModuleName -> [DeclarationRef] -> [ExternsImport] -> [ExternsFixity] -> [ExternsTypeFixity] -> [ExternsDeclaration] -> SourceSpan -> ExternsFile -- | The externs version [efVersion] :: ExternsFile -> Text -- | 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 operators and their fixities [efTypeFixities] :: ExternsFile -> [ExternsTypeFixity] -- | List of type and value declaration [efDeclarations] :: ExternsFile -> [ExternsDeclaration] -- | Source span for error reporting [efSourceSpan] :: ExternsFile -> SourceSpan -- | Check whether the version in an externs file matches the currently -- running version. externsIsCurrentVersion :: ExternsFile -> Bool -- | Convert an externs file back into a module applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment -- | Generate an externs file for all declarations in a module. -- -- The `Map Ident Ident` argument should contain any top-level -- GenIdents that were rewritten to Idents when the -- module was compiled; this rewrite only happens in the CoreFn, not the -- original module AST, so it needs to be applied to the exported names -- here also. (The appropriate map is returned by renameInModule.) moduleToExternsFile :: Module -> Environment -> Map Ident Ident -> ExternsFile externsFileName :: FilePath -- | 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 -> Text superClassDictionaryNames :: [Constraint a] -> [Text] 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 -> [((SourceAnn, Ident), Expr)] -> m [((SourceAnn, Ident), (Expr, SourceType))] -- | Check that a newtype has just one data constructor with just one -- field, or throw an error. If the newtype is valid, this function -- returns the single data constructor declaration and the single field, -- as a proof that the newtype was indeed a valid newtype. checkNewtype :: forall m. MonadError MultipleErrors m => ProperName 'TypeName -> [DataConstructorDeclaration] -> m (DataConstructorDeclaration, (Ident, SourceType)) -- | 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 :: forall m. (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Map ModuleName Exports -> Module -> m Module -- | Elaborates deriving instance declarations by code generation. deriveInstances :: forall m. (MonadError MultipleErrors m, MonadSupply m) => Module -> m Module -- | Indicates whether the rebracketModule is being called with the -- full desugar pass run via `purs compile` or whether only the partial -- desugar pass is run via `purs docs`. This indication is needed to -- prevent a `purs docs` error when using `case _ of` syntax in a type -- class instance. data RebracketCaller CalledByCompile :: RebracketCaller CalledByDocs :: RebracketCaller -- | Removes unary negation operators and replaces them with calls to -- negate. desugarSignedLiterals :: Module -> Module -- | Remove explicit parentheses and reorder binary operator applications. -- -- This pass requires name desugaring and export elaboration to have run -- first. rebracket :: forall m. MonadError MultipleErrors m => MonadSupply m => [ExternsFile] -> Module -> m Module -- | A version of rebracket which allows you to choose which -- declarations should be affected. This is used in docs generation, -- where we want to desugar type operators in instance declarations to -- ensure that instances are paired up with their types correctly, but we -- don't want to desugar type operators in value declarations. rebracketFiltered :: forall m. MonadError MultipleErrors m => MonadSupply m => RebracketCaller -> (Declaration -> Bool) -> [ExternsFile] -> Module -> m Module -- | Checks all the fixity exports within a module to ensure that members -- aliased by the operators are also exported from the module. -- -- This pass requires name desugaring and export elaboration to have run -- first. checkFixityExports :: forall m. MonadError MultipleErrors m => Module -> m Module -- | Replaces all local names with qualified names. desugarImports :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState (Env, UsedImports) m) => Module -> m Module -- | Create an environment from a collection of externs files externsEnv :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Env -> ExternsFile -> m Env -- | The desugaring pipeline proceeds as follows: -- -- desugar :: MonadSupply m => MonadError MultipleErrors m => MonadWriter MultipleErrors m => MonadState (Env, UsedImports) m => [ExternsFile] -> Module -> m Module -- | 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) -- | Run an IO action in the Make monad. The String -- argument should describe what we were trying to do; it is used for -- rendering errors in the case that an IOException is thrown. makeIO :: (MonadIO m, MonadError MultipleErrors m) => Text -> IO a -> m a -- | Get a file's modification time in the Make monad, capturing any -- errors using the MonadError instance. getTimestamp :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m UTCTime -- | Get a file's modification time in the Make monad, returning -- Nothing if the file does not exist. getTimestampMaybe :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe UTCTime) -- | Read a text file strictly in the Make monad, capturing any -- errors using the MonadError instance. readTextFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m Text -- | Read a JSON file in the Make monad, returning Nothing if -- the file does not exist or could not be parsed. Errors are captured -- using the MonadError instance. readJSONFile :: (MonadIO m, MonadError MultipleErrors m) => FromJSON a => FilePath -> m (Maybe a) readJSONFileIO :: FromJSON a => FilePath -> IO (Maybe a) -- | Read a Cbor encoded file in the Make monad, returning -- Nothing if the file does not exist or could not be parsed. -- Errors are captured using the MonadError instance. readCborFile :: (MonadIO m, MonadError MultipleErrors m) => Serialise a => FilePath -> m (Maybe a) readCborFileIO :: Serialise a => FilePath -> IO (Maybe a) -- | Read an externs file, returning Nothing if the file does not -- exist, could not be parsed, or was generated by a different version of -- the compiler. readExternsFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe ExternsFile) hashFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m ContentHash -- | Write a text file in the Make monad, capturing any errors using -- the MonadError instance. writeTextFile :: FilePath -> ByteString -> Make () -- | Write a JSON file in the Make monad, capturing any errors using -- the MonadError instance. writeJSONFile :: (MonadIO m, MonadError MultipleErrors m) => ToJSON a => FilePath -> a -> m () writeCborFile :: (MonadIO m, MonadError MultipleErrors m) => Serialise a => FilePath -> a -> m () writeCborFileIO :: Serialise a => FilePath -> a -> IO () -- | Copy a file in the Make monad, capturing any errors using the -- MonadError instance. copyFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> FilePath -> m () -- | 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 (Map FilePath (UTCTime, m ContentHash)))) -> (ModuleName -> m (Maybe UTCTime)) -> (ModuleName -> m (FilePath, Maybe ExternsFile)) -> (Module Ann -> Module -> ExternsFile -> SupplyT m ()) -> (Module Ann -> m ()) -> (ProgressMessage -> m ()) -> m CacheDb -> (CacheDb -> m ()) -> m () -> m () -> MakeActions m -- | Get the timestamps and content hashes for the input files for a -- module. The content hash is returned as a monadic action so that the -- file does not have to be read if it's not necessary. [getInputTimestampsAndHashes] :: MakeActions m -> ModuleName -> m (Either RebuildPolicy (Map FilePath (UTCTime, m ContentHash))) -- | Get the time this module was last compiled, provided that all of the -- requested codegen targets were also produced then. The -- defaultMakeActions implementation uses the modification time of the -- externs file, because the externs file is written first and we always -- write one. If there is no externs file, or if any of the requested -- codegen targets were not produced the last time this module was -- compiled, this function must return Nothing; this indicates that the -- module will have to be recompiled. [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, Maybe ExternsFile) -- | Run the code generator for the module and write any required output -- files. [codegen] :: MakeActions m -> Module Ann -> Module -> ExternsFile -> SupplyT m () -- | Check ffi and print it in the output directory. [ffiCodegen] :: MakeActions m -> Module Ann -> m () -- | Respond to a progress update. [progress] :: MakeActions m -> ProgressMessage -> m () -- | Read the cache database (which contains timestamps and hashes for -- input files) from some external source, e.g. a file on disk. [readCacheDb] :: MakeActions m -> m CacheDb -- | Write the given cache database to some external source (e.g. a file on -- disk). [writeCacheDb] :: MakeActions m -> CacheDb -> m () -- | Write to the output directory the package.json file allowing Node.js -- to load .js files as ES modules. [writePackageJson] :: MakeActions m -> m () -- | If generating docs, output the documentation for the Prim modules [outputPrimDocs] :: MakeActions m -> m () -- | Progress messages from the make process data ProgressMessage -- | Compilation started for the specified module CompilingModule :: ModuleName -> Maybe (Int, Int) -> ProgressMessage -- | Determines when to rebuild a module data RebuildPolicy -- | Never rebuild this module RebuildNever :: RebuildPolicy -- | Always rebuild this module RebuildAlways :: RebuildPolicy -- | Render a progress message renderProgressMessage :: Text -> ProgressMessage -> Text -- | Given the output directory, determines the location for the CacheDb -- file cacheDbFile :: FilePath -> FilePath readCacheDb' :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m CacheDb writeCacheDb' :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> CacheDb -> m () -- | 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 -- | Check that the declarations in a given PureScript module match with -- those in its corresponding foreign module. checkForeignDecls :: Module ann -> FilePath -> Make (Either MultipleErrors (ForeignModuleType, Set Ident)) -- | FFI check and codegen action. If path maker is supplied copies foreign -- module to the output. ffiCodegen' :: Map ModuleName FilePath -> Set CodegenTarget -> Maybe (ModuleName -> String -> FilePath) -> Module Ann -> Make () -- | Rebuild a single module. -- -- This function is used for fast-rebuild workflows (PSCi and psc-ide are -- examples). rebuildModule :: forall m. (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [ExternsFile] -> Module -> m ExternsFile rebuildModule' :: forall m. (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> Env -> [ExternsFile] -> Module -> m ExternsFile -- | Compiles in "make" mode, compiling each module separately to a -- .js file and an externs.cbor file. -- -- If timestamps or hashes have not changed, existing externs files can -- be used to provide upstream modules' types without having to typecheck -- those modules again. make :: forall m. (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [PartialResult Module] -> m [ExternsFile] -- | Infer the module name for a module by looking for the same filename -- with a .js extension. inferForeignModules :: forall m. MonadIO m => Map ModuleName (Either RebuildPolicy FilePath) -> m (Map ModuleName FilePath) -- | Given a set of filepaths, try to build the dependency graph and return -- that as its JSON representation (or a bunch of errors, if any) graph :: [FilePath] -> IO (Either MultipleErrors Value, MultipleErrors) version :: Version 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 UnacceptableVersion :: (PackageName, Text) -> PackageWarning DirtyWorkingTreeWarn :: PackageWarning -- | An error that should be fixed by the user. data UserError PackageManifestNotFound :: FilePath -> UserError ResolutionsFileNotFound :: UserError CouldntConvertPackageManifest :: BowerError -> UserError CouldntDecodePackageManifest :: ParseError ManifestError -> UserError TagMustBeCheckedOut :: UserError AmbiguousVersions :: [Version] -> UserError BadRepositoryField :: RepositoryFieldError -> UserError NoLicenseSpecified :: UserError InvalidLicense :: UserError MissingDependencies :: NonEmpty PackageName -> UserError CompileError :: MultipleErrors -> UserError DirtyWorkingTree :: UserError ResolutionsFileError :: FilePath -> ParseError PackageError -> UserError -- | An error that probably indicates a bug in this module. data InternalError CouldntParseGitTagDate :: Text -> InternalError data OtherError ProcessFailed :: String -> [String] -> IOException -> OtherError IOExceptionThrown :: IOException -> OtherError data RepositoryFieldError RepositoryFieldMissing :: Maybe Text -> RepositoryFieldError BadRepositoryType :: Text -> RepositoryFieldError NotOnGithub :: RepositoryFieldError data JSONSource FromFile :: FilePath -> JSONSource FromResolutions :: JSONSource printError :: PackageError -> IO () renderError :: PackageError -> Box printWarnings :: [PackageWarning] -> IO () renderWarnings :: [PackageWarning] -> Box instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.PackageWarning instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.RepositoryFieldError instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.UserError 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.OtherError instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.PackageError 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.Base.Semigroup Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings instance GHC.Base.Monoid Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings -- | Type declarations and associated basic functions for PSCI. module Language.PureScript.Interactive.Types -- | The PSCI configuration. -- -- These configuration values do not change during execution. newtype PSCiConfig PSCiConfig :: [String] -> PSCiConfig [psciFileGlobs] :: PSCiConfig -> [String] psciEnvironment :: PSCiState -> Environment -- | The PSCI state. -- -- Holds a list of imported modules, loaded files, and partial let -- bindings, plus the currently configured interactive printing function. -- -- The let bindings are partial, because it makes more sense to apply the -- binding to the final evaluated expression. -- -- The last two fields are derived from the first three via -- updateImportExports each time a module is imported, a let binding is -- added, or the session is cleared or reloaded data PSCiState -- | All of the data that is contained by an ImportDeclaration in the AST. -- That is: -- -- type ImportedModule = (ModuleName, ImportDeclarationType, Maybe ModuleName) psciExports :: PSCiState -> Exports psciImports :: PSCiState -> Imports psciLoadedExterns :: PSCiState -> [(Module, ExternsFile)] psciInteractivePrint :: PSCiState -> (ModuleName, Ident) psciImportedModules :: PSCiState -> [ImportedModule] psciLetBindings :: PSCiState -> [Declaration] initialPSCiState :: PSCiState -- | The default interactive print function. initialInteractivePrint :: (ModuleName, Ident) -- | Updates the imported modules in the state record. updateImportedModules :: ([ImportedModule] -> [ImportedModule]) -> PSCiState -> PSCiState -- | Updates the loaded externs files in the state record. updateLoadedExterns :: ([(Module, ExternsFile)] -> [(Module, ExternsFile)]) -> PSCiState -> PSCiState -- | Updates the let bindings in the state record. updateLets :: ([Declaration] -> [Declaration]) -> PSCiState -> PSCiState -- | Replaces the interactive printing function in the state record with a -- new one. setInteractivePrint :: (ModuleName, Ident) -> PSCiState -> PSCiState -- | Valid Meta-commands for PSCI data Command -- | A purescript expression Expression :: Expr -> Command -- | Show the help (ie, list of directives) ShowHelp :: Command -- | Import a module from a loaded file Import :: ImportedModule -> Command -- | Browse a module BrowseModule :: ModuleName -> Command -- | Exit PSCI QuitPSCi :: Command -- | Reload all the imported modules of the REPL ReloadState :: Command -- | Clear the state of the REPL ClearState :: Command -- | Add some declarations to the current evaluation context Decls :: [Declaration] -> Command -- | Find the type of an expression TypeOf :: Expr -> Command -- | Find the kind of an expression KindOf :: SourceType -> Command -- | Shows information about the current state of the REPL ShowInfo :: ReplQuery -> Command -- | Paste multiple lines PasteLines :: Command -- | Return auto-completion output as if pressing tab CompleteStr :: String -> Command -- | Set the interactive printing function SetInteractivePrint :: (ModuleName, Ident) -> Command data ReplQuery QueryLoaded :: ReplQuery QueryImport :: ReplQuery QueryPrint :: ReplQuery -- | A list of all ReplQuery values. replQueries :: [ReplQuery] replQueryStrings :: [String] showReplQuery :: ReplQuery -> String parseReplQuery :: String -> Maybe ReplQuery data Directive Help :: Directive Quit :: Directive Reload :: Directive Clear :: Directive Browse :: Directive Type :: Directive Kind :: Directive Show :: Directive Paste :: Directive Complete :: Directive Print :: Directive instance GHC.Show.Show Language.PureScript.Interactive.Types.PSCiConfig instance GHC.Show.Show Language.PureScript.Interactive.Types.PSCiState instance GHC.Show.Show Language.PureScript.Interactive.Types.ReplQuery instance GHC.Classes.Eq Language.PureScript.Interactive.Types.ReplQuery instance GHC.Show.Show Language.PureScript.Interactive.Types.Command instance GHC.Show.Show Language.PureScript.Interactive.Types.Directive instance GHC.Classes.Eq Language.PureScript.Interactive.Types.Directive -- | Directives for PSCI. module Language.PureScript.Interactive.Directive -- | A mapping of directives to the different strings that can be used to -- invoke them. directiveStrings :: [(Directive, [String])] -- | Like directiveStrings, but the other way around. directiveStrings' :: [(String, Directive)] -- | Returns all possible string representations of a directive. stringsFor :: Directive -> [String] -- | Returns the default string representation of a directive. stringFor :: Directive -> String -- | Returns the list of directives which could be expanded from the string -- argument, together with the string alias that matched. directivesFor' :: String -> [(Directive, String)] directivesFor :: String -> [Directive] directiveStringsFor :: String -> [String] -- | The help menu. help :: [(Directive, String, String)] module Language.PureScript.Interactive.Message -- | The guide URL guideURL :: String -- | The help message. helpMessage :: String -- | The welcome prologue. prologueMessage :: String noInputMessage :: String supportModuleMessage :: String -- | The quit message. quitMessage :: String module Language.PureScript.Interactive.Printer textT :: Text -> Box -- | Pretty print a module's signatures printModuleSignatures :: ModuleName -> Environment -> String -- | Parser for PSCI. module Language.PureScript.Interactive.Parser -- | Parses a limited set of commands from from .purs-repl parseDotFile :: FilePath -> String -> Either String [Command] -- | Parses PSCI metacommands or expressions input from the user. parseCommand :: String -> Either String [Command] module Language.PureScript.Interactive.Module -- | The name of the PSCI support module supportModuleName :: ModuleName -- | Checks if the Console module is defined supportModuleIsDefined :: [ModuleName] -> Bool -- | Load all modules. loadAllModules :: [FilePath] -> IO (Either MultipleErrors [(FilePath, Module)]) -- | Makes a volatile module to execute the current expression. createTemporaryModule :: Bool -> PSCiState -> Expr -> Module -- | Makes a volatile module to hold a non-qualified type synonym for a -- fully-qualified data type declaration. createTemporaryModuleForKind :: PSCiState -> SourceType -> Module -- | Makes a volatile module to execute the current imports. createTemporaryModuleForImports :: PSCiState -> Module importDecl :: ImportedModule -> Declaration indexFile :: FilePath modulesDir :: FilePath internalSpan :: SourceSpan module Language.PureScript.Interactive.Completion type CompletionM = ReaderT PSCiState IO liftCompletionM :: (MonadState PSCiState m, MonadIO m) => CompletionM a -> m a -- | Loads module, function, and file completions. completion :: (MonadState PSCiState m, MonadIO m) => CompletionFunc m completion' :: CompletionFunc CompletionM -- | Convert Haskeline completion result to results as they would be -- displayed formatCompletions :: (String, [Completion]) -> [String] instance GHC.Show.Show Language.PureScript.Interactive.Completion.CompletionContext module Language.PureScript.Interactive -- | Performs a PSCi command handleCommand :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => (String -> m ()) -> m () -> (String -> m ()) -> Command -> m () -- | Build the collection of modules from scratch. This is usually done on -- startup. make :: [(FilePath, PartialResult Module)] -> Make ([ExternsFile], Environment) -- | This is different than the runMake in Make in that it specifies -- the options and ignores the warning messages. runMake :: Make a -> IO (Either MultipleErrors a) -- | Generate Directed Graphs of PureScript TypeClasses module Language.PureScript.Hierarchy newtype SuperMap SuperMap :: Either (ProperName 'ClassName) (ProperName 'ClassName, ProperName 'ClassName) -> SuperMap [_unSuperMap] :: SuperMap -> Either (ProperName 'ClassName) (ProperName 'ClassName, ProperName 'ClassName) data Graph Graph :: GraphName -> Digraph -> Graph [graphName] :: Graph -> GraphName [digraph] :: Graph -> Digraph newtype GraphName GraphName :: Text -> GraphName [_unGraphName] :: GraphName -> Text newtype Digraph Digraph :: Text -> Digraph [_unDigraph] :: Digraph -> Text prettyPrint :: SuperMap -> Text runModuleName :: ModuleName -> GraphName typeClasses :: Functor f => f Module -> f (Maybe Graph) typeClassGraph :: Module -> Maybe Graph typeClassPrologue :: GraphName -> Text typeClassBody :: [SuperMap] -> Text typeClassEpilogue :: Text superClasses :: Declaration -> [SuperMap] instance GHC.Classes.Eq Language.PureScript.Hierarchy.SuperMap instance GHC.Show.Show Language.PureScript.Hierarchy.GraphName instance GHC.Classes.Eq Language.PureScript.Hierarchy.GraphName instance GHC.Show.Show Language.PureScript.Hierarchy.Digraph instance GHC.Classes.Eq Language.PureScript.Hierarchy.Digraph instance GHC.Show.Show Language.PureScript.Hierarchy.Graph instance GHC.Classes.Eq Language.PureScript.Hierarchy.Graph instance GHC.Classes.Ord Language.PureScript.Hierarchy.SuperMap 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 :: Text -> Maybe ErrorPosition -> ErrorSuggestion [replacement] :: ErrorSuggestion -> Text [replaceRange] :: ErrorSuggestion -> Maybe ErrorPosition data JSONError JSONError :: Maybe ErrorPosition -> String -> Text -> Text -> Maybe String -> Maybe Text -> Maybe ErrorSuggestion -> [SourceSpan] -> JSONError [position] :: JSONError -> Maybe ErrorPosition [message] :: JSONError -> String [errorCode] :: JSONError -> Text [errorLink] :: JSONError -> Text [filename] :: JSONError -> Maybe String [moduleName] :: JSONError -> Maybe Text [suggestion] :: JSONError -> Maybe ErrorSuggestion [allSpans] :: JSONError -> [SourceSpan] data JSONResult JSONResult :: [JSONError] -> [JSONError] -> JSONResult [warnings] :: JSONResult -> [JSONError] [errors] :: JSONResult -> [JSONError] toJSONErrors :: Bool -> Level -> [(FilePath, Text)] -> MultipleErrors -> [JSONError] toJSONError :: Bool -> Level -> [(FilePath, Text)] -> ErrorMessage -> JSONError instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Errors.JSON.JSONResult instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Errors.JSON.JSONResult instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Errors.JSON.JSONError instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Errors.JSON.JSONError instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Errors.JSON.ErrorSuggestion instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Errors.JSON.ErrorSuggestion instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Errors.JSON.ErrorPosition instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Errors.JSON.ErrorPosition 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 instance GHC.Classes.Eq Language.PureScript.Errors.JSON.ErrorSuggestion instance GHC.Show.Show Language.PureScript.Errors.JSON.ErrorSuggestion 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.JSONResult instance GHC.Show.Show Language.PureScript.Errors.JSON.JSONResult -- | Type definitions for psc-ide module Language.PureScript.Ide.Types type ModuleIdent = Text type ModuleMap a = Map ModuleName a data IdeDeclaration IdeDeclValue :: IdeValue -> IdeDeclaration IdeDeclType :: IdeType -> IdeDeclaration IdeDeclTypeSynonym :: IdeTypeSynonym -> IdeDeclaration IdeDeclDataConstructor :: IdeDataConstructor -> IdeDeclaration IdeDeclTypeClass :: IdeTypeClass -> IdeDeclaration IdeDeclValueOperator :: IdeValueOperator -> IdeDeclaration IdeDeclTypeOperator :: IdeTypeOperator -> IdeDeclaration IdeDeclModule :: ModuleName -> IdeDeclaration data IdeValue IdeValue :: Ident -> SourceType -> IdeValue [_ideValueIdent] :: IdeValue -> Ident [_ideValueType] :: IdeValue -> SourceType data IdeType IdeType :: ProperName 'TypeName -> SourceType -> [(ProperName 'ConstructorName, SourceType)] -> IdeType [_ideTypeName] :: IdeType -> ProperName 'TypeName [_ideTypeKind] :: IdeType -> SourceType [_ideTypeDtors] :: IdeType -> [(ProperName 'ConstructorName, SourceType)] data IdeTypeSynonym IdeTypeSynonym :: ProperName 'TypeName -> SourceType -> SourceType -> IdeTypeSynonym [_ideSynonymName] :: IdeTypeSynonym -> ProperName 'TypeName [_ideSynonymType] :: IdeTypeSynonym -> SourceType [_ideSynonymKind] :: IdeTypeSynonym -> SourceType data IdeDataConstructor IdeDataConstructor :: ProperName 'ConstructorName -> ProperName 'TypeName -> SourceType -> IdeDataConstructor [_ideDtorName] :: IdeDataConstructor -> ProperName 'ConstructorName [_ideDtorTypeName] :: IdeDataConstructor -> ProperName 'TypeName [_ideDtorType] :: IdeDataConstructor -> SourceType data IdeTypeClass IdeTypeClass :: ProperName 'ClassName -> SourceType -> [IdeInstance] -> IdeTypeClass [_ideTCName] :: IdeTypeClass -> ProperName 'ClassName [_ideTCKind] :: IdeTypeClass -> SourceType [_ideTCInstances] :: IdeTypeClass -> [IdeInstance] data IdeInstance IdeInstance :: ModuleName -> Ident -> [SourceType] -> Maybe [SourceConstraint] -> IdeInstance [_ideInstanceModule] :: IdeInstance -> ModuleName [_ideInstanceName] :: IdeInstance -> Ident [_ideInstanceTypes] :: IdeInstance -> [SourceType] [_ideInstanceConstraints] :: IdeInstance -> Maybe [SourceConstraint] data IdeValueOperator IdeValueOperator :: OpName 'ValueOpName -> Qualified (Either Ident (ProperName 'ConstructorName)) -> Precedence -> Associativity -> Maybe SourceType -> IdeValueOperator [_ideValueOpName] :: IdeValueOperator -> OpName 'ValueOpName [_ideValueOpAlias] :: IdeValueOperator -> Qualified (Either Ident (ProperName 'ConstructorName)) [_ideValueOpPrecedence] :: IdeValueOperator -> Precedence [_ideValueOpAssociativity] :: IdeValueOperator -> Associativity [_ideValueOpType] :: IdeValueOperator -> Maybe SourceType data IdeTypeOperator IdeTypeOperator :: OpName 'TypeOpName -> Qualified (ProperName 'TypeName) -> Precedence -> Associativity -> Maybe SourceType -> IdeTypeOperator [_ideTypeOpName] :: IdeTypeOperator -> OpName 'TypeOpName [_ideTypeOpAlias] :: IdeTypeOperator -> Qualified (ProperName 'TypeName) [_ideTypeOpPrecedence] :: IdeTypeOperator -> Precedence [_ideTypeOpAssociativity] :: IdeTypeOperator -> Associativity [_ideTypeOpKind] :: IdeTypeOperator -> Maybe SourceType _IdeDeclValue :: Traversal' IdeDeclaration IdeValue _IdeDeclType :: Traversal' IdeDeclaration IdeType _IdeDeclTypeSynonym :: Traversal' IdeDeclaration IdeTypeSynonym _IdeDeclDataConstructor :: Traversal' IdeDeclaration IdeDataConstructor _IdeDeclTypeClass :: Traversal' IdeDeclaration IdeTypeClass _IdeDeclValueOperator :: Traversal' IdeDeclaration IdeValueOperator _IdeDeclTypeOperator :: Traversal' IdeDeclaration IdeTypeOperator _IdeDeclModule :: Traversal' IdeDeclaration ModuleName anyOf :: Getting Any s a -> (a -> Bool) -> s -> Bool ideValueType :: Lens' IdeValue SourceType ideValueIdent :: Lens' IdeValue Ident ideTypeName :: Lens' IdeType (ProperName 'TypeName) ideTypeKind :: Lens' IdeType SourceType ideTypeDtors :: Lens' IdeType [(ProperName 'ConstructorName, SourceType)] ideSynonymType :: Lens' IdeTypeSynonym SourceType ideSynonymName :: Lens' IdeTypeSynonym (ProperName 'TypeName) ideSynonymKind :: Lens' IdeTypeSynonym SourceType ideDtorTypeName :: Lens' IdeDataConstructor (ProperName 'TypeName) ideDtorType :: Lens' IdeDataConstructor SourceType ideDtorName :: Lens' IdeDataConstructor (ProperName 'ConstructorName) ideTCName :: Lens' IdeTypeClass (ProperName 'ClassName) ideTCKind :: Lens' IdeTypeClass SourceType ideTCInstances :: Lens' IdeTypeClass [IdeInstance] ideValueOpType :: Lens' IdeValueOperator (Maybe SourceType) ideValueOpPrecedence :: Lens' IdeValueOperator Precedence ideValueOpName :: Lens' IdeValueOperator (OpName 'ValueOpName) ideValueOpAssociativity :: Lens' IdeValueOperator Associativity ideValueOpAlias :: Lens' IdeValueOperator (Qualified (Either Ident (ProperName 'ConstructorName))) ideTypeOpPrecedence :: Lens' IdeTypeOperator Precedence ideTypeOpName :: Lens' IdeTypeOperator (OpName 'TypeOpName) ideTypeOpKind :: Lens' IdeTypeOperator (Maybe SourceType) ideTypeOpAssociativity :: Lens' IdeTypeOperator Associativity ideTypeOpAlias :: Lens' IdeTypeOperator (Qualified (ProperName 'TypeName)) data IdeDeclarationAnn IdeDeclarationAnn :: Annotation -> IdeDeclaration -> IdeDeclarationAnn [_idaAnnotation] :: IdeDeclarationAnn -> Annotation [_idaDeclaration] :: IdeDeclarationAnn -> IdeDeclaration data Annotation Annotation :: Maybe SourceSpan -> Maybe ModuleName -> Maybe SourceType -> Maybe Text -> Annotation [_annLocation] :: Annotation -> Maybe SourceSpan [_annExportedFrom] :: Annotation -> Maybe ModuleName [_annTypeAnnotation] :: Annotation -> Maybe SourceType [_annDocumentation] :: Annotation -> Maybe Text annTypeAnnotation :: Lens' Annotation (Maybe SourceType) annLocation :: Lens' Annotation (Maybe SourceSpan) annExportedFrom :: Lens' Annotation (Maybe ModuleName) annDocumentation :: Lens' Annotation (Maybe Text) idaDeclaration :: Lens' IdeDeclarationAnn IdeDeclaration idaAnnotation :: Lens' IdeDeclarationAnn Annotation emptyAnn :: Annotation type DefinitionSites a = Map IdeNamespaced a type TypeAnnotations = Map Ident SourceType newtype AstData a -- | SourceSpans for the definition sites of values and types as well as -- type annotations found in a module AstData :: ModuleMap (DefinitionSites a, TypeAnnotations) -> AstData a data IdeLogLevel LogDebug :: IdeLogLevel LogPerf :: IdeLogLevel LogAll :: IdeLogLevel LogDefault :: IdeLogLevel LogNone :: IdeLogLevel data IdeConfiguration IdeConfiguration :: FilePath -> IdeLogLevel -> [FilePath] -> IdeConfiguration [confOutputPath] :: IdeConfiguration -> FilePath [confLogLevel] :: IdeConfiguration -> IdeLogLevel [confGlobs] :: IdeConfiguration -> [FilePath] data IdeEnvironment IdeEnvironment :: TVar IdeState -> IdeConfiguration -> IORef (Maybe UTCTime) -> IdeEnvironment [ideStateVar] :: IdeEnvironment -> TVar IdeState [ideConfiguration] :: IdeEnvironment -> IdeConfiguration [ideCacheDbTimestamp] :: IdeEnvironment -> IORef (Maybe UTCTime) type Ide m = (MonadIO m, MonadReader IdeEnvironment m) data IdeState IdeState :: IdeFileState -> IdeVolatileState -> IdeState [ideFileState] :: IdeState -> IdeFileState [ideVolatileState] :: IdeState -> IdeVolatileState emptyIdeState :: IdeState emptyFileState :: IdeFileState emptyVolatileState :: IdeVolatileState -- | IdeFileState holds data that corresponds 1-to-1 to an entity -- on the filesystem. Externs correspond to the ExternsFiles the compiler -- emits into the output folder, and modules are parsed ASTs from source -- files. This means, that we can update single modules or ExternsFiles -- inside this state whenever the corresponding entity changes on the -- file system. data IdeFileState IdeFileState :: ModuleMap ExternsFile -> ModuleMap (Module, FilePath) -> IdeFileState [fsExterns] :: IdeFileState -> ModuleMap ExternsFile [fsModules] :: IdeFileState -> ModuleMap (Module, FilePath) -- | IdeVolatileState is derived from the IdeFileState -- and needs to be invalidated and refreshed carefully. It holds -- AstData, which is the data we extract from the parsed ASTs, -- as well as the IdeDeclarations, which contain lots of denormalized -- data, so they need to fully rebuilt whenever IdeFileState -- changes. The vsCachedRebuild field can hold a rebuild result with open -- imports which is used to provide completions for module private -- declarations data IdeVolatileState IdeVolatileState :: AstData SourceSpan -> ModuleMap [IdeDeclarationAnn] -> Maybe (ModuleName, ExternsFile) -> IdeVolatileState [vsAstData] :: IdeVolatileState -> AstData SourceSpan [vsDeclarations] :: IdeVolatileState -> ModuleMap [IdeDeclarationAnn] [vsCachedRebuild] :: IdeVolatileState -> Maybe (ModuleName, ExternsFile) newtype Match a Match :: (ModuleName, a) -> Match a -- | A completion as it gets sent to the editors data Completion Completion :: Text -> Text -> Text -> Text -> Maybe SourceSpan -> Maybe Text -> [ModuleName] -> Maybe DeclarationType -> Completion [complModule] :: Completion -> Text [complIdentifier] :: Completion -> Text [complType] :: Completion -> Text [complExpandedType] :: Completion -> Text [complLocation] :: Completion -> Maybe SourceSpan [complDocumentation] :: Completion -> Maybe Text [complExportedFrom] :: Completion -> [ModuleName] [complDeclarationType] :: Completion -> Maybe DeclarationType identifierFromDeclarationRef :: DeclarationRef -> Text declarationType :: IdeDeclaration -> DeclarationType data Success CompletionResult :: [Completion] -> Success TextResult :: Text -> Success UsagesResult :: [SourceSpan] -> Success MultilineTextResult :: [Text] -> Success ImportList :: (ModuleName, [(ModuleName, ImportDeclarationType, Maybe ModuleName)]) -> Success ModuleList :: [ModuleIdent] -> Success RebuildSuccess :: MultipleErrors -> Success encodeSuccess :: ToJSON a => a -> Value encodeImport :: (ModuleName, ImportDeclarationType, Maybe ModuleName) -> Value -- | Denotes the different namespaces a name in PureScript can reside in. data IdeNamespace IdeNSValue :: IdeNamespace IdeNSType :: IdeNamespace IdeNSModule :: IdeNamespace -- | A name tagged with a namespace data IdeNamespaced IdeNamespaced :: IdeNamespace -> Text -> IdeNamespaced instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeLogLevel instance GHC.Show.Show Language.PureScript.Ide.Types.IdeLogLevel instance GHC.Show.Show Language.PureScript.Ide.Types.IdeFileState instance GHC.Base.Functor Language.PureScript.Ide.Types.Match instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Ide.Types.Match a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Ide.Types.Match a) instance GHC.Classes.Ord Language.PureScript.Ide.Types.Completion instance GHC.Classes.Eq Language.PureScript.Ide.Types.Completion instance GHC.Show.Show Language.PureScript.Ide.Types.Completion instance GHC.Show.Show Language.PureScript.Ide.Types.Success instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeNamespace instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeNamespace instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeNamespace instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeNamespace instance GHC.Show.Show Language.PureScript.Ide.Types.IdeNamespace instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeNamespaced instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeNamespaced instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeNamespaced instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeNamespaced instance GHC.Show.Show Language.PureScript.Ide.Types.IdeNamespaced instance Data.Foldable.Foldable Language.PureScript.Ide.Types.AstData instance GHC.Base.Functor Language.PureScript.Ide.Types.AstData instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Ide.Types.AstData a) instance GHC.Generics.Generic (Language.PureScript.Ide.Types.AstData a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.Ide.Types.AstData a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Ide.Types.AstData a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Ide.Types.AstData a) instance GHC.Show.Show Language.PureScript.Ide.Types.IdeVolatileState instance GHC.Show.Show Language.PureScript.Ide.Types.IdeState instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Types.IdeNamespace instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Ide.Types.Success instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Ide.Types.Completion instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.Annotation instance GHC.Generics.Generic Language.PureScript.Ide.Types.Annotation instance GHC.Classes.Ord Language.PureScript.Ide.Types.Annotation instance GHC.Classes.Eq Language.PureScript.Ide.Types.Annotation instance GHC.Show.Show Language.PureScript.Ide.Types.Annotation instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeDeclarationAnn instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeDeclarationAnn instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeDeclarationAnn instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeDeclarationAnn instance GHC.Show.Show Language.PureScript.Ide.Types.IdeDeclarationAnn instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeValue instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeValue instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeValue instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeValue instance GHC.Show.Show Language.PureScript.Ide.Types.IdeValue instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeType instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeType instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeType instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeType instance GHC.Show.Show Language.PureScript.Ide.Types.IdeType instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeTypeSynonym instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeTypeSynonym instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeTypeSynonym instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeTypeSynonym instance GHC.Show.Show Language.PureScript.Ide.Types.IdeTypeSynonym instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeDataConstructor instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeDataConstructor instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeDataConstructor instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeDataConstructor instance GHC.Show.Show Language.PureScript.Ide.Types.IdeDataConstructor instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeInstance instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeInstance instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeInstance instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeInstance instance GHC.Show.Show Language.PureScript.Ide.Types.IdeInstance instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeTypeClass instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeTypeClass instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeTypeClass instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeTypeClass instance GHC.Show.Show Language.PureScript.Ide.Types.IdeTypeClass instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeValueOperator instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeValueOperator instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeValueOperator instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeValueOperator instance GHC.Show.Show Language.PureScript.Ide.Types.IdeValueOperator instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeTypeOperator instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeTypeOperator instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeTypeOperator instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeTypeOperator instance GHC.Show.Show Language.PureScript.Ide.Types.IdeTypeOperator instance Control.DeepSeq.NFData Language.PureScript.Ide.Types.IdeDeclaration instance GHC.Generics.Generic Language.PureScript.Ide.Types.IdeDeclaration instance GHC.Classes.Ord Language.PureScript.Ide.Types.IdeDeclaration instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeDeclaration instance GHC.Show.Show Language.PureScript.Ide.Types.IdeDeclaration module Language.PureScript.Ide.Prim idePrimDeclarations :: ModuleMap [IdeDeclarationAnn] module Language.PureScript.Ide.Logging runLogger :: MonadIO m => IdeLogLevel -> LoggingT m a -> m a logPerf :: (MonadIO m, MonadLogger m) => (TimeSpec -> Text) -> m t -> m t displayTimeSpec :: TimeSpec -> Text labelTimespec :: Text -> TimeSpec -> Text -- | Error types for psc-ide module Language.PureScript.Ide.Error data IdeError GeneralError :: Text -> IdeError NotFound :: Text -> IdeError ModuleNotFound :: ModuleIdent -> IdeError ModuleFileNotFound :: ModuleIdent -> IdeError RebuildError :: [(FilePath, Text)] -> MultipleErrors -> IdeError prettyPrintTypeSingleLine :: Type a -> Text instance GHC.Show.Show Language.PureScript.Ide.Error.IdeError instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Ide.Error.IdeError -- | Generally useful functions module Language.PureScript.Ide.Util identifierFromIdeDeclaration :: IdeDeclaration -> Text unwrapMatch :: Match a -> a namespaceForDeclaration :: IdeDeclaration -> IdeNamespace encodeT :: ToJSON a => a -> Text decodeT :: FromJSON a => Text -> Either Text a discardAnn :: IdeDeclarationAnn -> IdeDeclaration withEmptyAnn :: IdeDeclaration -> IdeDeclarationAnn valueOperatorAliasT :: Qualified (Either Ident (ProperName 'ConstructorName)) -> Text typeOperatorAliasT :: Qualified (ProperName 'TypeName) -> Text properNameT :: Getting r (ProperName a) Text identT :: Getting r Ident Text opNameT :: Getting r (OpName a) Text ideReadFile :: (MonadIO m, MonadError IdeError m) => FilePath -> m (FilePath, Text) -- | Resolves reexports for psc-ide module Language.PureScript.Ide.Reexports -- | Resolves Reexports for the given Modules, by looking up the reexported -- values from the passed in DeclarationRefs resolveReexports :: ModuleMap [(ModuleName, DeclarationRef)] -> ModuleMap [IdeDeclarationAnn] -> ModuleMap (ReexportResult [IdeDeclarationAnn]) -- | Uses the passed formatter to format the resolved module, and adds -- possible failures prettyPrintReexportResult :: (a -> Text) -> ReexportResult a -> Text -- | Whether any Refs couldn't be resolved reexportHasFailures :: ReexportResult a -> Bool -- | Contains the module with resolved reexports, and possible failures data ReexportResult a ReexportResult :: a -> [(ModuleName, DeclarationRef)] -> ReexportResult a [reResolved] :: ReexportResult a -> a [reFailed] :: ReexportResult a -> [(ModuleName, DeclarationRef)] resolveReexports' :: ModuleMap [IdeDeclarationAnn] -> [(ModuleName, DeclarationRef)] -> ReexportResult [IdeDeclarationAnn] instance GHC.Generics.Generic (Language.PureScript.Ide.Reexports.ReexportResult a) instance GHC.Base.Functor Language.PureScript.Ide.Reexports.ReexportResult instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Ide.Reexports.ReexportResult a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Ide.Reexports.ReexportResult a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Ide.Reexports.ReexportResult a) -- | Matchers for psc-ide commands module Language.PureScript.Ide.Matcher data Matcher a runMatcher :: Matcher a -> [Match a] -> [Match a] -- | Matches any occurrence 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 IdeDeclarationAnn instance GHC.Base.Monoid (Language.PureScript.Ide.Matcher.Matcher a) instance GHC.Base.Semigroup (Language.PureScript.Ide.Matcher.Matcher a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Ide.Matcher.Matcher Language.PureScript.Ide.Types.IdeDeclarationAnn) -- | Getting declarations from PureScript sourcefiles module Language.PureScript.Ide.SourceFile parseModulesFromFiles :: (MonadIO m, MonadError IdeError m) => [FilePath] -> m [Either FilePath (FilePath, Module)] -- | Extracts AST information from a parsed module extractAstInformation :: Module -> (DefinitionSites SourceSpan, TypeAnnotations) -- | Given a surrounding Sourcespan and a Declaration from the PS AST, -- extracts definition sites inside that Declaration. extractSpans :: Declaration -> [(IdeNamespaced, SourceSpan)] -- | Extracts type annotations for functions from a given Module extractTypeAnnotations :: [Declaration] -> [(Ident, SourceType)] -- | Provides functionality to manage imports module Language.PureScript.Ide.Imports -- | Reads a file and returns the parsed module name as well as the parsed -- imports, while ignoring eventual parse errors that aren't relevant to -- the import section parseImportsFromFile :: (MonadIO m, MonadError IdeError m) => FilePath -> m (ModuleName, [(ModuleName, ImportDeclarationType, Maybe ModuleName)]) -- | Reads a file and returns the (lines before the imports, the imports, -- the lines after the imports) parseImportsFromFile' :: (MonadIO m, MonadError IdeError m) => FilePath -> m (ModuleName, [Text], [Import], [Text]) -- | Test and ghci helper parseImport :: Text -> Maybe Import prettyPrintImportSection :: [Import] -> [Text] sliceImportSection :: [Text] -> Either Text (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 module Language.PureScript.Ide.Filter.Imports matchImport :: Maybe ModuleName -> ModuleName -> IdeDeclarationAnn -> Import -> Bool -- | Filters for psc-ide commands module Language.PureScript.Ide.Filter data Filter -- | Only keeps Declarations in the given modules moduleFilter :: Set ModuleName -> Filter -- | Only keeps Identifiers in the given Namespaces namespaceFilter :: Set IdeNamespace -> Filter -- | Only keeps Identifiers that are equal to the search string exactFilter :: Text -> Filter -- | Only keeps Identifiers that start with the given prefix prefixFilter :: Text -> Filter -- | Only keeps Identifiers in the given type declarations declarationTypeFilter :: Set DeclarationType -> Filter dependencyFilter :: Maybe ModuleName -> ModuleName -> [Import] -> Filter applyFilters :: [Filter] -> ModuleMap [IdeDeclarationAnn] -> ModuleMap [IdeDeclarationAnn] instance GHC.Show.Show Language.PureScript.Ide.Filter.DeclarationFilter instance GHC.Show.Show Language.PureScript.Ide.Filter.Filter instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Filter.Filter module Language.PureScript.Ide.Externs readExternFile :: (MonadIO m, MonadError IdeError m, MonadLogger m) => FilePath -> m ExternsFile convertExterns :: ExternsFile -> ([IdeDeclarationAnn], [(ModuleName, DeclarationRef)]) -- | Functions to access psc-ide's state module Language.PureScript.Ide.State -- | Gets the loaded Modulenames getLoadedModulenames :: Ide m => m [ModuleName] -- | Gets all loaded ExternFiles getExternFiles :: Ide m => m (ModuleMap ExternsFile) -- | Retrieves the FileState from the State. This includes loaded -- Externfiles and parsed Modules getFileState :: Ide m => m IdeFileState -- | Resets all State inside psc-ide resetIdeState :: Ide m => m () -- | Sets rebuild cache to the given ExternsFile cacheRebuild :: Ide m => ExternsFile -> m () -- | Retrieves the rebuild cache cachedRebuild :: Ide m => m (Maybe (ModuleName, ExternsFile)) -- | Adds an ExternsFile into psc-ide's FileState. This does not populate -- the VolatileState, which needs to be done after all the necessary -- Externs and SourceFiles have been loaded. insertExterns :: Ide m => ExternsFile -> m () -- | Insert a Module into Stage1 of the State insertModule :: Ide m => (FilePath, Module) -> m () -- | STM version of insertExterns insertExternsSTM :: TVar IdeState -> ExternsFile -> STM () -- | Checks if the given ModuleName matches the last rebuild cache and if -- it does returns all loaded definitions + the definitions inside the -- rebuild cache getAllModules :: Ide m => Maybe ModuleName -> m (ModuleMap [IdeDeclarationAnn]) populateVolatileState :: Ide m => m (Async ()) -- | Resolves reexports and populates VolatileState with data to be used in -- queries. populateVolatileStateSync :: (Ide m, MonadLogger m) => m () -- | STM version of populateVolatileState populateVolatileStateSTM :: TVar IdeState -> STM (ModuleMap (ReexportResult [IdeDeclarationAnn])) getOutputDirectory :: Ide m => m FilePath updateCacheTimestamp :: Ide m => m (Maybe (Maybe UTCTime, Maybe UTCTime)) -- | Looks up the types and kinds for operators and assigns them to their -- declarations resolveOperatorsForModule :: ModuleMap [IdeDeclarationAnn] -> [IdeDeclarationAnn] -> [IdeDeclarationAnn] resolveInstances :: ModuleMap ExternsFile -> ModuleMap [IdeDeclarationAnn] -> ModuleMap [IdeDeclarationAnn] resolveDataConstructorsForModule :: [IdeDeclarationAnn] -> [IdeDeclarationAnn] module Language.PureScript.Ide.Usage findReexportingModules :: (ModuleName, IdeDeclaration) -> ModuleMap [IdeDeclarationAnn] -> [ModuleName] directDependants :: IdeDeclaration -> ModuleMap Module -> ModuleName -> ModuleMap (NonEmpty Search) eligibleModules :: (ModuleName, IdeDeclaration) -> ModuleMap [IdeDeclarationAnn] -> ModuleMap Module -> ModuleMap (NonEmpty Search) -- | Finds all usages for a given Search throughout a module applySearch :: Module -> Search -> [SourceSpan] -- | How we find usages, given an IdeDeclaration and the module it was -- defined in: -- --
    --
  1. Find all modules that reexport the given declaration
  2. --
  3. Find all modules that import from those modules, and while -- traversing the imports build a specification for how the identifier -- can be found in the module.
  4. --
  5. Apply the collected search specifications and collect the -- results
  6. --
findUsages :: Ide m => IdeDeclaration -> ModuleName -> m (ModuleMap (NonEmpty SourceSpan)) module Language.PureScript.Ide.Rebuild rebuildFileSync :: forall m. (Ide m, MonadLogger m, MonadError IdeError m) => FilePath -> Maybe FilePath -> Set CodegenTarget -> m Success rebuildFileAsync :: forall m. (Ide m, MonadLogger m, MonadError IdeError m) => FilePath -> Maybe FilePath -> Set CodegenTarget -> m Success -- | Given a filepath performs the following steps: -- -- rebuildFile :: (Ide m, MonadLogger m, MonadError IdeError m) => FilePath -> Maybe FilePath -> Set CodegenTarget -> (ReaderT IdeEnvironment (LoggingT IO) () -> m ()) -> m Success 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 IdeDeclarationAnn -> CompletionOptions -> ModuleMap [IdeDeclarationAnn] -> [Completion] getExactMatches :: Text -> [Filter] -> ModuleMap [IdeDeclarationAnn] -> [Match IdeDeclarationAnn] getExactCompletions :: Text -> [Filter] -> ModuleMap [IdeDeclarationAnn] -> [Completion] simpleExport :: Match a -> (Match a, [ModuleName]) completionFromMatch :: (Match IdeDeclarationAnn, [ModuleName]) -> Completion data CompletionOptions CompletionOptions :: Maybe Int -> Bool -> CompletionOptions [coMaxResults] :: CompletionOptions -> Maybe Int [coGroupReexports] :: CompletionOptions -> Bool defaultCompletionOptions :: CompletionOptions applyCompletionOptions :: CompletionOptions -> [Match IdeDeclarationAnn] -> [(Match IdeDeclarationAnn, [ModuleName])] instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.Ide.Completion.Namespaced a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Ide.Completion.Namespaced a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Ide.Completion.Namespaced a) instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Completion.CompletionOptions module Language.PureScript.Ide.Imports.Actions -- | Adds an implicit import like import Prelude to a Sourcefile. addImplicitImport :: (MonadIO m, MonadError IdeError m) => FilePath -> ModuleName -> m [Text] -- | Adds a qualified import like import Data.Map as Map to a -- source file. addQualifiedImport :: (MonadIO m, MonadError IdeError m) => FilePath -> ModuleName -> ModuleName -> m [Text] -- | Looks up the given identifier in the currently loaded modules. -- -- addImportForIdentifier :: (Ide m, MonadError IdeError m) => FilePath -> Text -> Maybe ModuleName -> [Filter] -> m (Either [Match IdeDeclaration] [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 addImplicitImport' :: [Import] -> ModuleName -> [Text] addQualifiedImport' :: [Import] -> ModuleName -> ModuleName -> [Text] addExplicitImport' :: IdeDeclaration -> ModuleName -> Maybe ModuleName -> [Import] -> [Import] -- | 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 :: MonadError IdeError m => Text -> WildcardAnnotations -> m [Text] caseSplit :: (Ide m, MonadError IdeError m) => Text -> m [Constructor] -- | Datatypes for the commands psc-ide accepts module Language.PureScript.Ide.Command data Command Load :: [ModuleName] -> Command LoadSync :: [ModuleName] -> Command Type :: Text -> [Filter] -> Maybe ModuleName -> Command [typeSearch] :: Command -> Text [typeFilters] :: Command -> [Filter] [typeCurrentModule] :: Command -> Maybe ModuleName Complete :: [Filter] -> Matcher IdeDeclarationAnn -> Maybe ModuleName -> CompletionOptions -> Command [completeFilters] :: Command -> [Filter] [completeMatcher] :: Command -> Matcher IdeDeclarationAnn [completeCurrentModule] :: Command -> Maybe ModuleName [completeOptions] :: Command -> CompletionOptions 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 FindUsages :: ModuleName -> Text -> IdeNamespace -> Command [usagesModule] :: Command -> ModuleName [usagesIdentifier] :: Command -> Text [usagesNamespace] :: Command -> IdeNamespace Import :: FilePath -> Maybe FilePath -> [Filter] -> ImportCommand -> Command List :: ListType -> Command [listType] :: Command -> ListType Rebuild :: FilePath -> Maybe FilePath -> Set CodegenTarget -> Command RebuildSync :: FilePath -> Maybe FilePath -> Set CodegenTarget -> Command Cwd :: Command Reset :: Command Quit :: Command commandName :: Command -> Text data ImportCommand AddImplicitImport :: ModuleName -> ImportCommand AddQualifiedImport :: ModuleName -> ModuleName -> ImportCommand AddImportForIdentifier :: Text -> Maybe ModuleName -> 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.FromJSON.FromJSON Language.PureScript.Ide.Command.Command instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Command.ListType instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Command.ImportCommand -- | Interface for the psc-ide-server module Language.PureScript.Ide -- | Accepts a Command and runs it against psc-ide's State. This is the -- main entry point for the server. handleCommand :: (Ide m, MonadLogger m, MonadError IdeError m) => Command -> m Success module Language.PureScript.Docs.AsMarkdown type Docs = Writer [Text] () runDocs :: Docs -> Text moduleAsMarkdown :: Module -> Docs codeToString :: RenderedCode -> Text instance GHC.Classes.Ord Language.PureScript.Docs.AsMarkdown.First instance GHC.Classes.Eq Language.PureScript.Docs.AsMarkdown.First instance GHC.Show.Show Language.PureScript.Docs.AsMarkdown.First -- | Functions for rendering generated documentation from PureScript code -- as HTML. module Language.PureScript.Docs.AsHtml data HtmlOutput a HtmlOutput :: [(Maybe Char, a)] -> [(ModuleName, HtmlOutputModule a)] -> HtmlOutput a [htmlIndex] :: HtmlOutput a -> [(Maybe Char, a)] [htmlModules] :: HtmlOutput a -> [(ModuleName, HtmlOutputModule a)] data HtmlOutputModule a HtmlOutputModule :: a -> [(InPackage ModuleName, a)] -> HtmlOutputModule a [htmlOutputModuleLocals] :: HtmlOutputModule a -> a [htmlOutputModuleReExports] :: HtmlOutputModule a -> [(InPackage ModuleName, a)] data HtmlRenderContext HtmlRenderContext :: (Namespace -> Text -> ContainingModule -> Maybe DocLink) -> (DocLink -> Text) -> (SourceSpan -> Maybe Text) -> HtmlRenderContext [buildDocLink] :: HtmlRenderContext -> Namespace -> Text -> ContainingModule -> Maybe DocLink [renderDocLink] :: HtmlRenderContext -> DocLink -> Text [renderSourceLink] :: HtmlRenderContext -> SourceSpan -> Maybe Text -- | An HtmlRenderContext for when you don't want to render any links. nullRenderContext :: HtmlRenderContext packageAsHtml :: (InPackage ModuleName -> Maybe HtmlRenderContext) -> Package a -> HtmlOutput Html moduleAsHtml :: (InPackage ModuleName -> Maybe HtmlRenderContext) -> Module -> (ModuleName, HtmlOutputModule Html) makeFragment :: Namespace -> Text -> Text -- | Render Markdown to HTML. Safe for untrusted input. Relative links are -- | removed. renderMarkdown :: Text -> Html instance GHC.Base.Functor Language.PureScript.Docs.AsHtml.HtmlOutputModule instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Docs.AsHtml.HtmlOutputModule a) instance GHC.Base.Functor Language.PureScript.Docs.AsHtml.HtmlOutput instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Docs.AsHtml.HtmlOutput a) module Language.PureScript.Docs.Collect -- | Given a compiler output directory, a list of input PureScript source -- files, and a list of dependency PureScript source files, produce -- documentation for the input files in the intermediate documentation -- format. Note that dependency files are not included in the result. -- -- If the output directory is not up to date with respect to the provided -- input and dependency files, the files will be built as if with just -- the "docs" codegen target, i.e. "purs compile --codegen docs". collectDocs :: forall m. (MonadError MultipleErrors m, MonadIO m) => FilePath -> [FilePath] -> [(PackageName, FilePath)] -> m ([(FilePath, Module)], Map ModuleName PackageName) -- | Data types and functions for rendering generated documentation from -- PureScript code, in a variety of formats. module Language.PureScript.Docs 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 (Text, Version) -> (Text -> PrepareM UTCTime) -> PrepareM () -> FilePath -> FilePath -> FilePath -> PublishOptions -- | How to obtain the version tag and version that the data being -- generated will refer to. [publishGetVersion] :: PublishOptions -> PrepareM (Text, Version) -- | How to obtain at what time the version was committed [publishGetTagTime] :: PublishOptions -> Text -> PrepareM UTCTime -- | What to do when the working tree is dirty [publishWorkingTreeDirty] :: PublishOptions -> PrepareM () -- | Compiler output directory (which must include up-to-date docs.json -- files for any modules we are producing docs for). [publishCompileOutputDir] :: PublishOptions -> FilePath -- | Path to the manifest file; a JSON file including information about the -- package, such as name, author, dependency version bounds. [publishManifestFile] :: PublishOptions -> FilePath -- | Path to the resolutions file; a JSON file containing all of the -- package's dependencies, their versions, and their paths on the disk. [publishResolutionsFile] :: PublishOptions -> FilePath defaultPublishOptions :: PublishOptions getGitWorkingTreeStatus :: FilePath -> PrepareM TreeStatus checkCleanWorkingTree :: PublishOptions -> PrepareM () getVersionFromGitTag :: PrepareM (Text, Version) getManifestRepositoryInfo :: PackageMeta -> PrepareM (GithubUser, GithubRepo) getModules :: PublishOptions -> [(PackageName, FilePath)] -> PrepareM ([Module], Map ModuleName PackageName) 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 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.Show.Show Language.PureScript.Publish.TreeStatus instance GHC.Classes.Eq Language.PureScript.Publish.DependencyStatus instance GHC.Show.Show Language.PureScript.Publish.DependencyStatus instance Control.Monad.IO.Class.MonadIO Language.PureScript.Publish.PrepareM