-- 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.11.5
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
readUTF8FileT :: FilePath -> IO Text
writeUTF8FileT :: FilePath -> Text -> IO ()
readUTF8File :: FilePath -> IO String
writeUTF8File :: FilePath -> String -> IO ()
-- | Common functions for implementing generic traversals
module Language.PureScript.Traversals
fstM :: (Functor f) => (a -> f c) -> (a, b) -> f (c, b)
sndM :: (Functor f) => (b -> f c) -> (a, b) -> f (a, c)
thirdM :: (Functor f) => (c -> f d) -> (a, b, c) -> f (a, b, d)
pairM :: (Applicative f) => (a -> f c) -> (b -> f d) -> (a, b) -> f (c, d)
maybeM :: (Applicative f) => (a -> f b) -> Maybe a -> f (Maybe b)
eitherM :: (Applicative f) => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d)
defS :: (Monad m) => st -> val -> m (st, val)
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
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 ()
printToStdout :: Box -> IO ()
-- | State for the parser monad
module Language.PureScript.Parser.State
-- | State for the parser monad
data ParseState
ParseState :: Column -> ParseState
-- | The most recently marked indentation level
[indentationLevel] :: ParseState -> Column
instance GHC.Show.Show Language.PureScript.Parser.State.ParseState
module 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 Haskell/PureScript escape sequences.
-- This is identical to the Show instance except that we get a Text out
-- instead of a String.
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.Classes.Ord Language.PureScript.PSString.PSString
instance GHC.Classes.Eq Language.PureScript.PSString.PSString
instance Control.DeepSeq.NFData 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
-- | The data type of compiler options
module Language.PureScript.Options
-- | The data type of compiler options
data Options
Options :: Bool -> Bool -> Bool -> Bool -> Options
-- | Verbose error message
[optionsVerboseErrors] :: Options -> Bool
-- | Remove the comments from the generated js
[optionsNoComments] :: Options -> Bool
-- | Generate source maps
[optionsSourceMaps] :: Options -> Bool
-- | Dump CoreFn
[optionsDumpCoreFn] :: Options -> Bool
defaultOptions :: Options
instance GHC.Show.Show Language.PureScript.Options.Options
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 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
module Language.PureScript.Interactive.IO
-- | Locates the node executable. Checks for either nodejs or
-- node.
findNodeProcess :: IO (Maybe String)
-- | Grabs the filename where the history is stored.
getHistoryFilename :: IO FilePath
module Language.PureScript.Docs.Utils.MonoidExtras
mintersperse :: (Monoid m) => m -> [m] -> m
module Language.PureScript.Crash
-- | A compatibility wrapper for the GHC.Stack.HasCallStack
-- constraint.
type HasCallStack = HasCallStack
-- | Exit with an error message and a crash report link.
internalError :: HasCallStack => String -> a
-- | 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.Classes.Ord Language.PureScript.Comments.Comment
instance GHC.Classes.Eq Language.PureScript.Comments.Comment
instance GHC.Show.Show Language.PureScript.Comments.Comment
-- | The first step in the parsing process - turns source code into a list
-- of lexemes
module Language.PureScript.Parser.Lexer
data PositionedToken
PositionedToken :: SourcePos -> SourcePos -> Maybe SourcePos -> Token -> [Comment] -> PositionedToken
-- | Start position of this token
[ptSourcePos] :: PositionedToken -> SourcePos
-- | End position of this token (not including whitespace)
[ptEndPos] :: PositionedToken -> SourcePos
-- | End position of the previous token
[ptPrevEndPos] :: PositionedToken -> Maybe SourcePos
[ptToken] :: PositionedToken -> Token
[ptComments] :: PositionedToken -> [Comment]
data Token
type TokenParser a = Parsec [PositionedToken] ParseState a
lex :: FilePath -> Text -> Either ParseError [PositionedToken]
-- | Lexes the given file, and on encountering a parse error, returns the
-- progress made up to that point, instead of returning an error
lexLenient :: FilePath -> Text -> Either ParseError [PositionedToken]
anyToken :: TokenParser PositionedToken
token :: (Token -> Maybe a) -> TokenParser a
match :: Token -> TokenParser ()
lparen :: TokenParser ()
rparen :: TokenParser ()
parens :: TokenParser a -> TokenParser a
lbrace :: TokenParser ()
rbrace :: TokenParser ()
braces :: TokenParser a -> TokenParser a
lsquare :: TokenParser ()
rsquare :: TokenParser ()
squares :: TokenParser a -> TokenParser a
indent :: TokenParser Int
indentAt :: Column -> TokenParser ()
larrow :: TokenParser ()
rarrow :: TokenParser ()
lfatArrow :: TokenParser ()
rfatArrow :: TokenParser ()
colon :: TokenParser ()
doubleColon :: TokenParser ()
equals :: TokenParser ()
pipe :: TokenParser ()
tick :: TokenParser ()
dot :: TokenParser ()
comma :: TokenParser ()
semi :: TokenParser ()
at :: TokenParser ()
underscore :: TokenParser ()
holeLit :: TokenParser Text
-- | Parse zero or more values separated by semicolons
semiSep :: TokenParser a -> TokenParser [a]
-- | Parse one or more values separated by semicolons
semiSep1 :: TokenParser a -> TokenParser [a]
-- | Parse zero or more values separated by commas
commaSep :: TokenParser a -> TokenParser [a]
-- | Parse one or more values separated by commas
commaSep1 :: TokenParser a -> TokenParser [a]
lname :: TokenParser Text
lname' :: Text -> TokenParser ()
qualifier :: TokenParser Text
tyname :: TokenParser Text
kiname :: TokenParser Text
dconsname :: TokenParser Text
uname :: TokenParser Text
uname' :: Text -> TokenParser ()
mname :: TokenParser Text
reserved :: Text -> TokenParser ()
symbol :: TokenParser Text
symbol' :: Text -> TokenParser ()
identifier :: TokenParser Text
charLiteral :: TokenParser Char
stringLiteral :: TokenParser PSString
number :: TokenParser (Either Integer Double)
natural :: TokenParser Integer
-- | A list of purescript reserved identifiers
reservedPsNames :: [Text]
reservedTypeNames :: [Text]
-- | The characters allowed for use in operators
isSymbolChar :: Char -> Bool
-- | Strings allowed to be left unquoted in a record key
isUnquotedKey :: Text -> Bool
instance GHC.Classes.Eq Language.PureScript.Parser.Lexer.PositionedToken
instance GHC.Classes.Ord Language.PureScript.Parser.Lexer.Token
instance GHC.Classes.Eq Language.PureScript.Parser.Lexer.Token
instance GHC.Show.Show Language.PureScript.Parser.Lexer.Token
instance GHC.Show.Show Language.PureScript.Parser.Lexer.PositionedToken
-- | Bundles compiled PureScript modules for the browser.
--
-- This module takes as input the individual generated modules from
-- Make and performs dead code elimination, filters empty modules,
-- and generates the final JavaScript bundle.
module Language.PureScript.Bundle
-- | The bundling function. This function performs dead code elimination,
-- filters empty modules and generates and prints the final JavaScript
-- bundle.
bundle :: (MonadError ErrorMessage m) => [(ModuleIdentifier, String)] -> [ModuleIdentifier] -> Maybe String -> String -> m String
-- | The bundling function. This function performs dead code elimination,
-- filters empty modules and generates and prints the final JavaScript
-- bundle.
bundleSM :: (MonadError ErrorMessage m) => [(ModuleIdentifier, Maybe FilePath, String)] -> [ModuleIdentifier] -> Maybe String -> String -> Maybe FilePath -> m (Maybe SourceMapping, String)
-- | Given a filename, assuming it is in the correct place on disk, infer a
-- ModuleIdentifier.
guessModuleIdentifier :: MonadError ErrorMessage m => FilePath -> m ModuleIdentifier
-- | A module is identified by its module name and its type.
data ModuleIdentifier
ModuleIdentifier :: String -> ModuleType -> ModuleIdentifier
moduleName :: ModuleIdentifier -> String
-- | Modules are either "regular modules" (i.e. those generated by psc) or
-- foreign modules.
data ModuleType
Regular :: ModuleType
Foreign :: ModuleType
-- | The type of error messages. We separate generation and rendering of
-- errors using a data type, in case we need to match on error types
-- later.
data ErrorMessage
UnsupportedModulePath :: String -> ErrorMessage
InvalidTopLevel :: ErrorMessage
UnableToParseModule :: String -> ErrorMessage
UnsupportedExport :: ErrorMessage
ErrorInModule :: ModuleIdentifier -> ErrorMessage -> ErrorMessage
MissingEntryPoint :: String -> ErrorMessage
MissingMainModule :: String -> ErrorMessage
-- | Prepare an error message for consumption by humans.
printErrorMessage :: ErrorMessage -> [String]
getExportedIdentifiers :: (MonadError ErrorMessage m) => String -> JSAST -> m [String]
instance GHC.Show.Show Language.PureScript.Bundle.Module
instance GHC.Show.Show Language.PureScript.Bundle.ModuleElement
instance GHC.Classes.Ord Language.PureScript.Bundle.ExportType
instance GHC.Classes.Eq Language.PureScript.Bundle.ExportType
instance GHC.Show.Show Language.PureScript.Bundle.ExportType
instance GHC.Show.Show Language.PureScript.Bundle.ErrorMessage
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.Classes.Ord Language.PureScript.Bundle.ModuleType
instance GHC.Classes.Eq Language.PureScript.Bundle.ModuleType
instance GHC.Show.Show Language.PureScript.Bundle.ModuleType
-- | Source position information
module Language.PureScript.AST.SourcePos
-- | Source position information
data SourcePos
SourcePos :: Int -> Int -> SourcePos
-- | Line number
[sourcePosLine] :: SourcePos -> Int
-- | Column number
[sourcePosColumn] :: SourcePos -> Int
displaySourcePos :: SourcePos -> Text
data SourceSpan
SourceSpan :: String -> SourcePos -> SourcePos -> SourceSpan
-- | Source name
[spanName] :: SourceSpan -> String
-- | Start of the span
[spanStart] :: SourceSpan -> SourcePos
[spanEnd] :: SourceSpan -> SourcePos
displayStartEndPos :: SourceSpan -> Text
displaySourceSpan :: FilePath -> SourceSpan -> Text
internalModuleSourceSpan :: String -> 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 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 Control.DeepSeq.NFData Language.PureScript.AST.SourcePos.SourcePos
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.SourcePos.SourcePos
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.SourcePos.SourcePos
instance Control.DeepSeq.NFData 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
-- | 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.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 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 Control.DeepSeq.NFData 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
instance Control.DeepSeq.NFData Language.PureScript.AST.Operators.Fixity
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Operators.Fixity
-- | 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)
-- | Fresh variable supply
module Control.Monad.Supply
newtype SupplyT m a
SupplyT :: StateT Integer m a -> SupplyT m a
[unSupplyT] :: SupplyT m a -> StateT Integer m a
runSupplyT :: Integer -> SupplyT m a -> m (a, Integer)
evalSupplyT :: (Functor m) => Integer -> SupplyT m a -> m a
type Supply = SupplyT Identity
runSupply :: Integer -> Supply a -> (a, Integer)
evalSupply :: Integer -> Supply a -> a
instance 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 where fresh = lift fresh peek = lift peek
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)
-- | 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
KiName :: (ProperName KindName) -> 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)
getModName :: Name -> Maybe ModuleName
-- | Names for value identifiers
data Ident
-- | An alphanumeric identifier
Ident :: Text -> Ident
-- | A generated name for an identifier
GenIdent :: (Maybe Text) -> Integer -> Ident
runIdent :: Ident -> Text
showIdent :: Ident -> Text
freshIdent :: MonadSupply m => Text -> m Ident
freshIdent' :: MonadSupply m => m Ident
-- | Operator alias names.
newtype OpName (a :: OpNameType)
OpName :: Text -> OpName
[runOpName] :: OpName -> Text
showOp :: OpName a -> Text
-- | The closed set of operator alias types.
data OpNameType
ValueOpName :: OpNameType
TypeOpName :: OpNameType
-- | Proper names, i.e. capitalized names for e.g. module names, type//data
-- constructors.
newtype ProperName (a :: ProperNameType)
ProperName :: Text -> ProperName
[runProperName] :: ProperName -> Text
-- | The closed set of proper name types.
data ProperNameType
TypeName :: ProperNameType
ConstructorName :: ProperNameType
ClassName :: ProperNameType
KindName :: ProperNameType
Namespace :: ProperNameType
-- | Coerces a ProperName from one ProperNameType to another. This should
-- be used with care, and is primarily used to convert ClassNames into
-- TypeNames after classes have been desugared.
coerceProperName :: ProperName a -> ProperName b
-- | Module names
newtype ModuleName
ModuleName :: [ProperName Namespace] -> ModuleName
runModuleName :: ModuleName -> Text
moduleNameFromString :: Text -> ModuleName
-- | A qualified name, i.e. a name with an optional module name
data Qualified a
Qualified :: (Maybe ModuleName) -> 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.ModuleName
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Names.ModuleName
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 a0 => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Names.Qualified a0)
instance Data.Aeson.Types.FromJSON.FromJSON a0 => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Names.Qualified a0)
instance GHC.Generics.Generic (Language.PureScript.Names.Qualified a)
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 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.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.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 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.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 Control.DeepSeq.NFData Language.PureScript.Names.Name
instance Control.DeepSeq.NFData Language.PureScript.Names.Ident
instance Control.DeepSeq.NFData (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.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.ModuleName
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Names.Qualified a)
-- | Common code generation utility functions
module Language.PureScript.CodeGen.JS.Common
moduleNameToJs :: ModuleName -> Text
-- | Convert an Ident into a valid JavaScript identifier:
--
--
-- - Alphanumeric characters are kept unmodified.
-- - Reserved javascript identifiers are prefixed with
-- $$.
-- - Symbols are prefixed with $ followed by a symbol name or
-- their ordinal value.
--
identToJs :: Ident -> Text
properToJs :: Text -> Text
-- | Test if a string is a valid AST identifier without escaping.
identNeedsEscaping :: 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]
-- | Various constants which refer to things in the Prelude
module Language.PureScript.Constants
($) :: forall a. (IsString a) => a
apply :: forall a. (IsString a) => a
(#) :: forall a. (IsString a) => a
applyFlipped :: forall a. (IsString a) => a
(<>) :: forall a. (IsString a) => a
(++) :: forall a. (IsString a) => a
append :: forall a. (IsString a) => a
(>>=) :: forall a. (IsString a) => a
bind :: forall a. (IsString a) => a
discard :: forall a. (IsString a) => a
(+) :: forall a. (IsString a) => a
add :: forall a. (IsString a) => a
(-) :: forall a. (IsString a) => a
sub :: forall a. (IsString a) => a
(*) :: forall a. (IsString a) => a
mul :: forall a. (IsString a) => a
(/) :: forall a. (IsString a) => a
div :: forall a. (IsString a) => a
(%) :: forall a. (IsString a) => a
mod :: forall a. (IsString a) => a
(<) :: forall a. (IsString a) => a
lessThan :: forall a. (IsString a) => a
(>) :: forall a. (IsString a) => a
greaterThan :: forall a. (IsString a) => a
(<=) :: forall a. (IsString a) => a
lessThanOrEq :: forall a. (IsString a) => a
(>=) :: forall a. (IsString a) => a
greaterThanOrEq :: forall a. (IsString a) => a
(==) :: forall a. (IsString a) => a
eq :: forall a. (IsString a) => a
(/=) :: forall a. (IsString a) => a
notEq :: forall a. (IsString a) => a
compare :: forall a. (IsString a) => a
(&&) :: forall a. (IsString a) => a
conj :: forall a. (IsString a) => a
(||) :: forall a. (IsString a) => a
disj :: forall a. (IsString a) => a
unsafeIndex :: forall a. (IsString a) => a
or :: forall a. (IsString a) => a
and :: forall a. (IsString a) => a
xor :: forall a. (IsString a) => a
(<<<) :: forall a. (IsString a) => a
compose :: forall a. (IsString a) => a
(>>>) :: forall a. (IsString a) => a
composeFlipped :: forall a. (IsString a) => a
map :: forall a. (IsString a) => a
negate :: forall a. (IsString a) => a
not :: forall a. (IsString a) => a
shl :: forall a. (IsString a) => a
shr :: forall a. (IsString a) => a
zshr :: forall a. (IsString a) => a
complement :: forall a. (IsString a) => a
zero :: forall a. (IsString a) => a
one :: forall a. (IsString a) => a
bottom :: forall a. (IsString a) => a
top :: forall a. (IsString a) => a
return :: forall a. (IsString a) => a
pure' :: forall a. (IsString a) => a
returnEscaped :: forall a. (IsString a) => a
untilE :: forall a. (IsString a) => a
whileE :: forall a. (IsString a) => a
runST :: forall a. (IsString a) => a
stRefValue :: forall a. (IsString a) => a
newSTRef :: forall a. (IsString a) => a
readSTRef :: forall a. (IsString a) => a
writeSTRef :: forall a. (IsString a) => a
modifySTRef :: forall a. (IsString a) => a
mkFn :: forall a. (IsString a) => a
runFn :: forall a. (IsString a) => a
unit :: forall a. (IsString a) => a
undefined :: forall a. (IsString a) => a
monadEffDictionary :: forall a. (IsString a) => a
applicativeEffDictionary :: forall a. (IsString a) => a
bindEffDictionary :: forall a. (IsString a) => a
discardUnitDictionary :: forall a. (IsString a) => a
semiringNumber :: forall a. (IsString a) => a
semiringInt :: forall a. (IsString a) => a
ringNumber :: forall a. (IsString a) => a
ringInt :: forall a. (IsString a) => a
moduloSemiringNumber :: forall a. (IsString a) => a
moduloSemiringInt :: forall a. (IsString a) => a
euclideanRingNumber :: forall a. (IsString a) => a
euclideanRingInt :: forall a. (IsString a) => a
ordBoolean :: forall a. (IsString a) => a
ordNumber :: forall a. (IsString a) => a
ordInt :: forall a. (IsString a) => a
ordString :: forall a. (IsString a) => a
ordChar :: forall a. (IsString a) => a
eqNumber :: forall a. (IsString a) => a
eqInt :: forall a. (IsString a) => a
eqString :: forall a. (IsString a) => a
eqChar :: forall a. (IsString a) => a
eqBoolean :: forall a. (IsString a) => a
boundedBoolean :: forall a. (IsString a) => a
booleanAlgebraBoolean :: forall a. (IsString a) => a
heytingAlgebraBoolean :: forall a. (IsString a) => a
semigroupString :: forall a. (IsString a) => a
semigroupoidFn :: forall a. (IsString a) => a
generic :: forall a. (IsString a) => a
toSpine :: forall a. (IsString a) => a
fromSpine :: forall a. (IsString a) => a
toSignature :: forall a. (IsString a) => a
typeDataOrdering :: ModuleName
orderingLT :: Qualified (ProperName TypeName)
orderingEQ :: Qualified (ProperName TypeName)
orderingGT :: Qualified (ProperName TypeName)
main :: forall a. (IsString a) => a
partial :: forall a. (IsString a) => a
typ :: forall a. (IsString a) => a
symbol :: forall a. (IsString a) => a
__unused :: forall a. (IsString a) => a
prim :: forall a. (IsString a) => a
prelude :: forall a. (IsString a) => a
dataArray :: forall a. (IsString a) => a
eff :: forall a. (IsString a) => a
st :: forall a. (IsString a) => a
controlApplicative :: forall a. (IsString a) => a
controlSemigroupoid :: forall a. (IsString a) => a
controlBind :: forall a. (IsString a) => a
dataBounded :: forall a. (IsString a) => a
dataSemigroup :: forall a. (IsString a) => a
dataHeytingAlgebra :: forall a. (IsString a) => a
dataEq :: forall a. (IsString a) => a
dataOrd :: forall a. (IsString a) => a
dataSemiring :: forall a. (IsString a) => a
dataRing :: forall a. (IsString a) => a
dataEuclideanRing :: forall a. (IsString a) => a
dataFunction :: forall a. (IsString a) => a
dataFunctionUncurried :: forall a. (IsString a) => a
dataIntBits :: forall a. (IsString a) => a
partialUnsafe :: forall a. (IsString a) => a
unsafePartial :: forall a. (IsString a) => 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)
-- | 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
ObjectUpdate :: a -> (Expr a) -> [(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.Base.Functor Language.PureScript.CoreFn.Expr.Expr
instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Expr.Expr a)
instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Expr.CaseAlternative a)
instance GHC.Base.Functor Language.PureScript.CoreFn.Expr.CaseAlternative
-- | CoreFn traversal helpers
module Language.PureScript.CoreFn.Traversals
everywhereOnValues :: (Bind a -> Bind a) -> (Expr a -> Expr a) -> (Binder a -> Binder a) -> (Bind a -> Bind a, Expr a -> Expr a, Binder a -> Binder a)
everythingOnValues :: (r -> r -> r) -> (Bind a -> r) -> (Expr a -> r) -> (Binder a -> r) -> (CaseAlternative a -> r) -> (Bind a -> r, Expr a -> r, Binder a -> r, CaseAlternative a -> r)
-- | Metadata annotations for core functional representation
module Language.PureScript.CoreFn.Meta
-- | Metadata annotations
data Meta
-- | The contained value is a data constructor
IsConstructor :: ConstructorType -> [Ident] -> Meta
-- | The contained value is a newtype
IsNewtype :: Meta
-- | The contained value is a typeclass dictionary constructor
IsTypeClassConstructor :: Meta
-- | The contained reference is for a foreign member
IsForeign :: Meta
-- | Data constructor metadata
data ConstructorType
-- | The constructor is for a type with a single construcor
ProductType :: ConstructorType
-- | The constructor is for a type with multiple construcors
SumType :: ConstructorType
instance GHC.Classes.Ord Language.PureScript.CoreFn.Meta.Meta
instance GHC.Classes.Eq Language.PureScript.CoreFn.Meta.Meta
instance GHC.Show.Show Language.PureScript.CoreFn.Meta.Meta
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
module Language.PureScript.Kinds
-- | The data type of kinds
data Kind
-- | Unification variable of type Kind
KUnknown :: Int -> Kind
-- | Kinds for labelled, unordered rows without duplicates
Row :: Kind -> Kind
-- | Function kinds
FunKind :: Kind -> Kind -> Kind
-- | A named kind
NamedKind :: (Qualified (ProperName KindName)) -> Kind
kindFromJSON :: Parse Text Kind
everywhereOnKinds :: (Kind -> Kind) -> Kind -> Kind
everywhereOnKindsM :: Monad m => (Kind -> m Kind) -> Kind -> m Kind
everythingOnKinds :: (r -> r -> r) -> (Kind -> r) -> Kind -> r
instance GHC.Generics.Generic Language.PureScript.Kinds.Kind
instance GHC.Classes.Ord Language.PureScript.Kinds.Kind
instance GHC.Classes.Eq Language.PureScript.Kinds.Kind
instance GHC.Show.Show Language.PureScript.Kinds.Kind
instance Control.DeepSeq.NFData Language.PureScript.Kinds.Kind
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Kinds.Kind
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Kinds.Kind
-- | Useful common functions for building parsers
module Language.PureScript.Parser.Common
-- | Parse a general proper name.
properName :: TokenParser (ProperName a)
-- | Parse a proper name for a type.
typeName :: TokenParser (ProperName TypeName)
-- | Parse a proper name for a kind.
kindName :: TokenParser (ProperName KindName)
-- | Parse a proper name for a data constructor.
dataConstructorName :: TokenParser (ProperName ConstructorName)
-- | Parse a module name
moduleName :: TokenParser ModuleName
-- | Parse a qualified name, i.e. M.name or just name
parseQualified :: TokenParser a -> TokenParser (Qualified a)
-- | Parse an identifier.
parseIdent :: TokenParser Ident
-- | Parse a label, which may look like an identifier or a string
parseLabel :: TokenParser PSString
-- | Parse an operator.
parseOperator :: TokenParser (OpName a)
-- | Run the first parser, then match the second if possible, applying the
-- specified function on a successful match
augment :: Stream s m t => ParsecT s u m a -> ParsecT s u m b -> (a -> b -> a) -> ParsecT s u m a
-- | Run the first parser, then match the second zero or more times,
-- applying the specified function for each match
fold :: ParsecT s u m a -> ParsecT s u m b -> (a -> b -> a) -> ParsecT s u m a
-- | Build a parser from a smaller parser and a list of parsers for postfix
-- operators
buildPostfixParser :: Stream s m t => [a -> ParsecT s u m a] -> ParsecT s u m a -> ParsecT s u m a
-- | Mark the current indentation level
mark :: Parsec s ParseState a -> Parsec s ParseState a
-- | Check that the current identation level matches a predicate
checkIndentation :: (Column -> Text) -> (Column -> Column -> Bool) -> Parsec s ParseState ()
-- | Check that the current indentation level is past the current mark
indented :: Parsec s ParseState ()
-- | Check that the current indentation level is at the same indentation as
-- the current mark
same :: Parsec s ParseState ()
-- | Read the comments from the the next token, without consuming it
readComments :: Parsec [PositionedToken] u [Comment]
-- | Run a parser
runTokenParser :: FilePath -> TokenParser a -> [PositionedToken] -> Either ParseError a
-- | Convert from Parsec sourcepos
toSourcePos :: SourcePos -> SourcePos
-- | Read source position information and comments
withSourceSpan :: (SourceSpan -> [Comment] -> a -> b) -> Parsec [PositionedToken] u a -> Parsec [PositionedToken] u b
-- | A parser for kinds
module Language.PureScript.Parser.Kinds
-- | Parse a kind
parseKind :: TokenParser Kind
-- | Data types for types
module Language.PureScript.Types
-- | An identifier for the scope of a skolem variable
newtype SkolemScope
SkolemScope :: Int -> SkolemScope
[runSkolemScope] :: SkolemScope -> Int
-- | The type of types
data Type
-- | A unification variable of type Type
TUnknown :: Int -> Type
-- | A named type variable
TypeVar :: Text -> Type
-- | A type-level string
TypeLevelString :: PSString -> Type
-- | A type wildcard, as would appear in a partial type synonym
TypeWildcard :: SourceSpan -> Type
-- | A type constructor
TypeConstructor :: (Qualified (ProperName TypeName)) -> Type
-- | A type operator. This will be desugared into a type constructor during
-- the "operators" phase of desugaring.
TypeOp :: (Qualified (OpName TypeOpName)) -> Type
-- | A type application
TypeApp :: Type -> Type -> Type
-- | Forall quantifier
ForAll :: Text -> Type -> (Maybe SkolemScope) -> Type
-- | A type with a set of type class constraints
ConstrainedType :: Constraint -> Type -> Type
-- | A skolem constant
Skolem :: Text -> Int -> SkolemScope -> (Maybe SourceSpan) -> Type
-- | An empty row
REmpty :: Type
-- | A non-empty row
RCons :: Label -> Type -> Type -> Type
-- | A type with a kind annotation
KindedType :: Type -> Kind -> Type
-- | A placeholder used in pretty printing
PrettyPrintFunction :: Type -> Type -> Type
-- | A placeholder used in pretty printing
PrettyPrintObject :: Type -> Type
-- | A placeholder used in pretty printing
PrettyPrintForAll :: [Text] -> Type -> Type
-- | Binary operator application. During the rebracketing phase of
-- desugaring, this data constructor will be removed.
BinaryNoParensType :: Type -> Type -> Type -> Type
-- | Explicit parentheses. During the rebracketing phase of desugaring,
-- this data constructor will be removed.
--
-- Note: although it seems this constructor is not used, it _is_ useful,
-- since it prevents certain traversals from matching.
ParensInType :: Type -> Type
-- | 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
Constraint :: Qualified (ProperName ClassName) -> [Type] -> Maybe ConstraintData -> Constraint
-- | constraint class name
[constraintClass] :: Constraint -> Qualified (ProperName ClassName)
-- | type arguments
[constraintArgs] :: Constraint -> [Type]
-- | additional data relevant to this constraint
[constraintData] :: Constraint -> Maybe ConstraintData
mapConstraintArgs :: ([Type] -> [Type]) -> Constraint -> Constraint
overConstraintArgs :: Functor f => ([Type] -> f [Type]) -> Constraint -> f Constraint
-- | Convert a row to a list of pairs of labels and types
rowToList :: Type -> ([(Label, Type)], Type)
-- | Convert a row to a list of pairs of labels and types, sorted by the
-- labels.
rowToSortedList :: Type -> ([(Label, Type)], Type)
-- | Convert a list of labels and types to a row
rowFromList :: ([(Label, Type)], Type) -> Type
-- | Check whether a type is a monotype
isMonoType :: Type -> Bool
-- | Universally quantify a type
mkForAll :: [Text] -> Type -> Type
-- | Replace a type variable, taking into account variable shadowing
replaceTypeVars :: Text -> Type -> Type -> Type
-- | Replace named type variables with types
replaceAllTypeVars :: [(Text, Type)] -> Type -> Type
-- | Collect all type variables appearing in a type
usedTypeVariables :: Type -> [Text]
-- | Collect all free type variables appearing in a type
freeTypeVariables :: Type -> [Text]
-- | Universally quantify over all type variables appearing free in a type
quantify :: Type -> Type
-- | Move all universal quantifiers to the front of a type
moveQuantifiersToFront :: Type -> Type
-- | Check if a type contains wildcards
containsWildcards :: Type -> Bool
-- | Check if a type contains forall
containsForAll :: Type -> Bool
everywhereOnTypes :: (Type -> Type) -> Type -> Type
everywhereOnTypesTopDown :: (Type -> Type) -> Type -> Type
everywhereOnTypesM :: Monad m => (Type -> m Type) -> Type -> m Type
everywhereOnTypesTopDownM :: Monad m => (Type -> m Type) -> Type -> m Type
everythingOnTypes :: (r -> r -> r) -> (Type -> r) -> Type -> r
everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type -> (s, r)) -> Type -> r
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.ConstraintData
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.ConstraintData
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.Constraint
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.Constraint
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.Type
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.Type
instance GHC.Generics.Generic Language.PureScript.Types.Type
instance GHC.Classes.Ord Language.PureScript.Types.Type
instance GHC.Classes.Eq Language.PureScript.Types.Type
instance GHC.Show.Show Language.PureScript.Types.Type
instance GHC.Generics.Generic Language.PureScript.Types.Constraint
instance GHC.Classes.Ord Language.PureScript.Types.Constraint
instance GHC.Classes.Eq Language.PureScript.Types.Constraint
instance GHC.Show.Show Language.PureScript.Types.Constraint
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 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 Control.DeepSeq.NFData Language.PureScript.Types.SkolemScope
instance Control.DeepSeq.NFData Language.PureScript.Types.Type
instance Control.DeepSeq.NFData Language.PureScript.Types.ConstraintData
instance Control.DeepSeq.NFData Language.PureScript.Types.Constraint
-- | Case binders
module Language.PureScript.AST.Binders
-- | Data type for binders
data Binder
-- | Wildcard binder
NullBinder :: Binder
-- | A binder which matches a literal
LiteralBinder :: (Literal Binder) -> Binder
-- | A binder which binds an identifier
VarBinder :: Ident -> Binder
-- | A binder which matches a data constructor
ConstructorBinder :: (Qualified (ProperName ConstructorName)) -> [Binder] -> Binder
-- | A operator alias binder. During the rebracketing phase of desugaring,
-- this data constructor will be removed.
OpBinder :: (Qualified (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 :: Ident -> Binder -> Binder
-- | A binder with source position information
PositionedBinder :: SourceSpan -> [Comment] -> Binder -> Binder
-- | A binder with a type annotation
TypedBinder :: Type -> Binder -> Binder
-- | Collect all names introduced in binders in an expression
binderNames :: Binder -> [Ident]
isIrrefutable :: Binder -> Bool
instance GHC.Classes.Ord Language.PureScript.AST.Binders.Binder
instance GHC.Classes.Eq Language.PureScript.AST.Binders.Binder
instance GHC.Show.Show Language.PureScript.AST.Binders.Binder
module Language.PureScript.CoreFn.Ann
-- | Type alias for basic annotations
type Ann = (Maybe SourceSpan, [Comment], Maybe Type, Maybe Meta)
-- | Initial annotation with no metadata
nullAnn :: Ann
-- | Remove the comments from an annotation
removeComments :: Ann -> Ann
module Language.PureScript.CoreFn.Module
-- | The CoreFn module representation
data Module a
Module :: [Comment] -> ModuleName -> [(a, ModuleName)] -> [Ident] -> [ForeignDecl] -> [Bind a] -> Module a
[moduleComments] :: Module a -> [Comment]
[moduleName] :: Module a -> ModuleName
[moduleImports] :: Module a -> [(a, ModuleName)]
[moduleExports] :: Module a -> [Ident]
[moduleForeign] :: Module a -> [ForeignDecl]
[moduleDecls] :: Module a -> [Bind a]
type ForeignDecl = (Ident, Type)
instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.CoreFn.Module.Module a)
module Language.PureScript.TypeClassDictionaries
-- | Data representing a type class dictionary which is in scope
data TypeClassDictionaryInScope v
TypeClassDictionaryInScope :: v -> [(Qualified (ProperName ClassName), Integer)] -> Qualified (ProperName ClassName) -> [Type] -> Maybe [Constraint] -> TypeClassDictionaryInScope v
-- | 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)
-- | The types to which this type class instance applies
[tcdInstanceTypes] :: TypeClassDictionaryInScope v -> [Type]
-- | Type class dependencies which must be satisfied to construct this
-- dictionary
[tcdDependencies] :: TypeClassDictionaryInScope v -> Maybe [Constraint]
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)
module Language.PureScript.Environment
-- | The Environment defines all values and types which are
-- currently in scope:
data Environment
Environment :: Map (Qualified Ident) (Type, NameKind, NameVisibility) -> Map (Qualified (ProperName TypeName)) (Kind, TypeKind) -> Map (Qualified (ProperName ConstructorName)) (DataDeclType, ProperName TypeName, Type, [Ident]) -> Map (Qualified (ProperName TypeName)) ([(Text, Maybe Kind)], Type) -> Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) NamedDict)) -> Map (Qualified (ProperName ClassName)) TypeClassData -> Set (Qualified (ProperName KindName)) -> Environment
-- | Values currently in scope
[names] :: Environment -> Map (Qualified Ident) (Type, NameKind, NameVisibility)
-- | Type names currently in scope
[types] :: Environment -> Map (Qualified (ProperName TypeName)) (Kind, TypeKind)
-- | Data constructors currently in scope, along with their associated type
-- constructor name, argument types and return type.
[dataConstructors] :: Environment -> Map (Qualified (ProperName ConstructorName)) (DataDeclType, ProperName TypeName, Type, [Ident])
-- | Type synonyms currently in scope
[typeSynonyms] :: Environment -> Map (Qualified (ProperName TypeName)) ([(Text, Maybe Kind)], Type)
-- | Available type class dictionaries
[typeClassDictionaries] :: Environment -> Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) NamedDict))
-- | Type classes
[typeClasses] :: Environment -> Map (Qualified (ProperName ClassName)) TypeClassData
-- | Kinds in scope
[kinds] :: Environment -> Set (Qualified (ProperName KindName))
-- | Information about a type class
data TypeClassData
TypeClassData :: [(Text, Maybe Kind)] -> [(Ident, Type)] -> [Constraint] -> [FunctionalDependency] -> Set Int -> Set (Set Int) -> TypeClassData
-- | A list of type argument names, and their kinds, where kind annotations
-- were provided.
[typeClassArguments] :: TypeClassData -> [(Text, Maybe Kind)]
-- | A list of type class members and their types. Type arguments listed
-- above are considered bound in these types.
[typeClassMembers] :: TypeClassData -> [(Ident, Type)]
-- | A list of superclasses of this type class. Type arguments listed above
-- are considered bound in the types appearing in these constraints.
[typeClassSuperclasses] :: TypeClassData -> [Constraint]
-- | 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)
-- | 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 Kind)] -> [(Ident, Type)] -> [Constraint] -> [FunctionalDependency] -> TypeClassData
-- | The visibility of a name in scope
data NameVisibility
-- | The name is defined in the current binding group, but is not visible
Undefined :: NameVisibility
-- | The name is defined in the another binding group, or has been made
-- visible by a function binder
Defined :: NameVisibility
-- | A flag for whether a name is for an private or public value - only
-- public values will be included in a generated externs file.
data NameKind
-- | A private value introduced as an artifact of code generation (class
-- instances, class member accessors, etc.)
Private :: NameKind
-- | A public value for a module member or foreing import declaration
Public :: NameKind
-- | A name for member introduced by foreign import
External :: NameKind
-- | The kinds of a type
data TypeKind
-- | Data type
DataType :: [(Text, Maybe Kind)] -> [(ProperName ConstructorName, [Type])] -> TypeKind
-- | Type synonym
TypeSynonym :: TypeKind
-- | Foreign data
ExternData :: TypeKind
-- | A local type variable
LocalTypeVariable :: TypeKind
-- | A scoped type variable
ScopedTypeVar :: TypeKind
-- | The type ('data' or 'newtype') of a data type declaration
data DataDeclType
-- | A standard data constructor
Data :: DataDeclType
-- | A newtype constructor
Newtype :: DataDeclType
showDataDeclType :: DataDeclType -> Text
-- | Construct a ProperName in the Prim module
primName :: Text -> Qualified (ProperName a)
primKind :: Text -> Kind
-- | Kind of ground types
kindType :: Kind
kindSymbol :: Kind
-- | Construct a type in the Prim module
primTy :: Text -> Type
-- | Type constructor for functions
tyFunction :: Type
-- | Type constructor for strings
tyString :: Type
-- | Type constructor for strings
tyChar :: Type
-- | Type constructor for numbers
tyNumber :: Type
-- | Type constructor for integers
tyInt :: Type
-- | Type constructor for booleans
tyBoolean :: Type
-- | Type constructor for arrays
tyArray :: Type
-- | Type constructor for records
tyRecord :: Type
-- | Check whether a type is a record
isObject :: Type -> Bool
-- | Check whether a type is a function
isFunction :: Type -> Bool
isTypeOrApplied :: Type -> Type -> Bool
-- | Smart constructor for function types
function :: Type -> Type -> Type
-- | The primitive kinds
primKinds :: Set (Qualified (ProperName KindName))
-- | The primitive types in the external javascript environment with their
-- associated kinds. There are also pseudo Fail, Warn,
-- and Partial types that correspond to the classes with the
-- same names.
primTypes :: Map (Qualified (ProperName TypeName)) (Kind, TypeKind)
-- | The primitive class map. This just contains the Fail,
-- Warn, and Partial classes. Partial is used
-- as a kind of magic constraint for partial functions. Fail is
-- used for user-defined type errors. Warn for user-defined
-- warnings.
primClasses :: Map (Qualified (ProperName ClassName)) TypeClassData
-- | Finds information about data constructors from the current
-- environment.
lookupConstructor :: Environment -> Qualified (ProperName ConstructorName) -> (DataDeclType, ProperName TypeName, Type, [Ident])
-- | Checks whether a data constructor is for a newtype.
isNewtypeConstructor :: Environment -> Qualified (ProperName ConstructorName) -> Bool
-- | Finds information about values from the current environment.
lookupValue :: Environment -> Qualified Ident -> Maybe (Type, NameKind, NameVisibility)
instance GHC.Generics.Generic Language.PureScript.Environment.Environment
instance GHC.Show.Show Language.PureScript.Environment.Environment
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.NameKind
instance GHC.Classes.Eq Language.PureScript.Environment.NameKind
instance GHC.Show.Show Language.PureScript.Environment.NameKind
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.TypeClassData
instance GHC.Show.Show Language.PureScript.Environment.TypeClassData
instance GHC.Generics.Generic Language.PureScript.Environment.FunctionalDependency
instance GHC.Show.Show Language.PureScript.Environment.FunctionalDependency
instance Control.DeepSeq.NFData Language.PureScript.Environment.Environment
instance Control.DeepSeq.NFData Language.PureScript.Environment.TypeClassData
instance Control.DeepSeq.NFData Language.PureScript.Environment.FunctionalDependency
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Environment.FunctionalDependency
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Environment.FunctionalDependency
instance Control.DeepSeq.NFData Language.PureScript.Environment.NameVisibility
instance Control.DeepSeq.NFData Language.PureScript.Environment.NameKind
instance Control.DeepSeq.NFData Language.PureScript.Environment.TypeKind
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Environment.TypeKind
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Environment.TypeKind
instance Control.DeepSeq.NFData Language.PureScript.Environment.DataDeclType
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Environment.DataDeclType
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Environment.DataDeclType
-- | Data types for modules and declarations
module Language.PureScript.AST.Declarations
-- | A map of locally-bound names in scope.
type Context = [(Ident, Type)]
-- | 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, Type)] -> Maybe [(Label, Type)] -> TypeSearch
-- | The identifiers that fully satisfy the subsumption check
[tsAfterIdentifiers] :: TypeSearch -> [(Qualified Text, Type)]
-- | Record fields that are available on the first argument to the typed
-- hole
[tsAfterRecordFields] :: TypeSearch -> Maybe [(Label, Type)]
onTypeSearchTypes :: (Type -> Type) -> TypeSearch -> TypeSearch
onTypeSearchTypesM :: (Applicative m) => (Type -> m Type) -> TypeSearch -> m TypeSearch
-- | A type of error messages
data SimpleErrorMessage
ModuleNotFound :: ModuleName -> SimpleErrorMessage
ErrorParsingFFIModule :: FilePath -> (Maybe ErrorMessage) -> SimpleErrorMessage
ErrorParsingModule :: ParseError -> SimpleErrorMessage
MissingFFIModule :: ModuleName -> SimpleErrorMessage
MultipleFFIModules :: ModuleName -> [FilePath] -> SimpleErrorMessage
UnnecessaryFFIModule :: ModuleName -> FilePath -> SimpleErrorMessage
MissingFFIImplementations :: ModuleName -> [Ident] -> SimpleErrorMessage
UnusedFFIImplementations :: ModuleName -> [Ident] -> SimpleErrorMessage
InvalidFFIIdentifier :: ModuleName -> Text -> SimpleErrorMessage
CannotGetFileInfo :: FilePath -> SimpleErrorMessage
CannotReadFile :: FilePath -> SimpleErrorMessage
CannotWriteFile :: FilePath -> SimpleErrorMessage
InfiniteType :: Type -> SimpleErrorMessage
InfiniteKind :: Kind -> SimpleErrorMessage
MultipleValueOpFixities :: (OpName ValueOpName) -> SimpleErrorMessage
MultipleTypeOpFixities :: (OpName TypeOpName) -> SimpleErrorMessage
OrphanTypeDeclaration :: Ident -> SimpleErrorMessage
RedefinedIdent :: Ident -> SimpleErrorMessage
OverlappingNamesInLet :: 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 -> [SourceSpan] -> SimpleErrorMessage
DuplicateTypeArgument :: Text -> SimpleErrorMessage
InvalidDoBind :: SimpleErrorMessage
InvalidDoLet :: SimpleErrorMessage
CycleInDeclaration :: Ident -> SimpleErrorMessage
CycleInTypeSynonym :: (Maybe (ProperName TypeName)) -> SimpleErrorMessage
CycleInModules :: [ModuleName] -> SimpleErrorMessage
NameIsUndefined :: Ident -> SimpleErrorMessage
UndefinedTypeVariable :: (ProperName TypeName) -> SimpleErrorMessage
PartiallyAppliedSynonym :: (Qualified (ProperName TypeName)) -> SimpleErrorMessage
EscapedSkolem :: Text -> (Maybe SourceSpan) -> Type -> SimpleErrorMessage
TypesDoNotUnify :: Type -> Type -> SimpleErrorMessage
KindsDoNotUnify :: Kind -> Kind -> SimpleErrorMessage
ConstrainedTypeUnified :: Type -> Type -> SimpleErrorMessage
OverlappingInstances :: (Qualified (ProperName ClassName)) -> [Type] -> [Qualified Ident] -> SimpleErrorMessage
NoInstanceFound :: Constraint -> SimpleErrorMessage
AmbiguousTypeVariables :: Type -> Constraint -> SimpleErrorMessage
UnknownClass :: (Qualified (ProperName ClassName)) -> SimpleErrorMessage
PossiblyInfiniteInstance :: (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage
CannotDerive :: (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage
InvalidDerivedInstance :: (Qualified (ProperName ClassName)) -> [Type] -> Int -> SimpleErrorMessage
ExpectedTypeConstructor :: (Qualified (ProperName ClassName)) -> [Type] -> Type -> SimpleErrorMessage
InvalidNewtypeInstance :: (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage
MissingNewtypeSuperclassInstance :: (Qualified (ProperName ClassName)) -> (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage
UnverifiableSuperclassInstance :: (Qualified (ProperName ClassName)) -> (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage
CannotFindDerivingType :: (ProperName TypeName) -> SimpleErrorMessage
DuplicateLabel :: Label -> (Maybe Expr) -> SimpleErrorMessage
DuplicateValueDeclaration :: Ident -> SimpleErrorMessage
ArgListLengthsDiffer :: Ident -> SimpleErrorMessage
OverlappingArgNames :: (Maybe Ident) -> SimpleErrorMessage
MissingClassMember :: Ident -> SimpleErrorMessage
ExtraneousClassMember :: Ident -> (Qualified (ProperName ClassName)) -> SimpleErrorMessage
ExpectedType :: Type -> Kind -> SimpleErrorMessage
IncorrectConstructorArity :: (Qualified (ProperName ConstructorName)) -> SimpleErrorMessage
ExprDoesNotHaveType :: Expr -> Type -> SimpleErrorMessage
PropertyIsMissing :: Label -> SimpleErrorMessage
AdditionalProperty :: Label -> SimpleErrorMessage
TypeSynonymInstance :: SimpleErrorMessage
OrphanInstance :: Ident -> (Qualified (ProperName ClassName)) -> [Type] -> SimpleErrorMessage
InvalidNewtype :: (ProperName TypeName) -> SimpleErrorMessage
InvalidInstanceHead :: Type -> SimpleErrorMessage
TransitiveExportError :: DeclarationRef -> [DeclarationRef] -> SimpleErrorMessage
TransitiveDctorExportError :: DeclarationRef -> (ProperName ConstructorName) -> SimpleErrorMessage
ShadowedName :: Ident -> SimpleErrorMessage
ShadowedTypeVar :: Text -> SimpleErrorMessage
UnusedTypeVar :: Text -> SimpleErrorMessage
WildcardInferredType :: Type -> Context -> SimpleErrorMessage
HoleInferredType :: Text -> Type -> Context -> TypeSearch -> SimpleErrorMessage
MissingTypeDeclaration :: Ident -> Type -> SimpleErrorMessage
OverlappingPattern :: [[Binder]] -> Bool -> SimpleErrorMessage
IncompleteExhaustivityCheck :: SimpleErrorMessage
MisleadingEmptyTypeImport :: ModuleName -> (ProperName TypeName) -> SimpleErrorMessage
ImportHidingModule :: ModuleName -> SimpleErrorMessage
UnusedImport :: 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
ImplicitImport :: ModuleName -> [DeclarationRef] -> SimpleErrorMessage
HidingImport :: ModuleName -> [DeclarationRef] -> SimpleErrorMessage
CaseBinderLengthDiffers :: Int -> [Binder] -> SimpleErrorMessage
IncorrectAnonymousArgument :: SimpleErrorMessage
InvalidOperatorInBinder :: (Qualified (OpName ValueOpName)) -> (Qualified Ident) -> SimpleErrorMessage
CannotGeneralizeRecursiveFunction :: Ident -> Type -> 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 :: Type -> SimpleErrorMessage
-- | a declaration couldn't be used because there wouldn't be enough
-- information | to choose an instance
UnusableDeclaration :: Ident -> SimpleErrorMessage
-- | Error message hints, providing more detailed information about
-- failure.
data ErrorMessageHint
ErrorUnifyingTypes :: Type -> Type -> ErrorMessageHint
ErrorInExpression :: Expr -> ErrorMessageHint
ErrorInModule :: ModuleName -> ErrorMessageHint
ErrorInInstance :: (Qualified (ProperName ClassName)) -> [Type] -> ErrorMessageHint
ErrorInSubsumption :: Type -> Type -> ErrorMessageHint
ErrorCheckingAccessor :: Expr -> PSString -> ErrorMessageHint
ErrorCheckingType :: Expr -> Type -> ErrorMessageHint
ErrorCheckingKind :: Type -> ErrorMessageHint
ErrorCheckingGuard :: ErrorMessageHint
ErrorInferringType :: Expr -> ErrorMessageHint
ErrorInApplication :: Expr -> Type -> Expr -> ErrorMessageHint
ErrorInDataConstructor :: (ProperName ConstructorName) -> ErrorMessageHint
ErrorInTypeConstructor :: (ProperName TypeName) -> ErrorMessageHint
ErrorInBindingGroup :: [Ident] -> ErrorMessageHint
ErrorInDataBindingGroup :: [ProperName TypeName] -> ErrorMessageHint
ErrorInTypeSynonym :: (ProperName TypeName) -> ErrorMessageHint
ErrorInValueDeclaration :: Ident -> ErrorMessageHint
ErrorInTypeDeclaration :: Ident -> ErrorMessageHint
ErrorInTypeClassDeclaration :: (ProperName ClassName) -> ErrorMessageHint
ErrorInForeignImport :: Ident -> ErrorMessageHint
ErrorSolvingConstraint :: Constraint -> ErrorMessageHint
PositionedError :: SourceSpan -> ErrorMessageHint
-- | Categories of hints
data HintCategory
ExprHint :: HintCategory
KindHint :: HintCategory
CheckHint :: HintCategory
PositionHint :: HintCategory
SolverHint :: HintCategory
OtherHint :: HintCategory
data ErrorMessage
ErrorMessage :: [ErrorMessageHint] -> SimpleErrorMessage -> ErrorMessage
-- | 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
-- | Add an import declaration for a module if it does not already
-- explicitly import it.
addDefaultImport :: ModuleName -> Module -> Module
-- | An item in a list of explicit imports or exports
data DeclarationRef
-- | A type constructor with data constructors
TypeRef :: (ProperName TypeName) -> (Maybe [ProperName ConstructorName]) -> DeclarationRef
-- | A type operator
TypeOpRef :: (OpName TypeOpName) -> DeclarationRef
-- | A value
ValueRef :: Ident -> DeclarationRef
-- | A value-level operator
ValueOpRef :: (OpName ValueOpName) -> DeclarationRef
-- | A type class
TypeClassRef :: (ProperName ClassName) -> DeclarationRef
-- | A type class instance, created during typeclass desugaring (name,
-- class name, instance types)
TypeInstanceRef :: Ident -> DeclarationRef
-- | A module, in its entirety
ModuleRef :: ModuleName -> DeclarationRef
-- | A named kind
KindRef :: (ProperName KindName) -> DeclarationRef
-- | A value re-exported from another module. These will be inserted during
-- elaboration in name desugaring.
ReExportRef :: ModuleName -> DeclarationRef -> DeclarationRef
-- | A declaration reference with source position information
PositionedDeclarationRef :: SourceSpan -> [Comment] -> DeclarationRef -> DeclarationRef
compDecRef :: DeclarationRef -> DeclarationRef -> Ordering
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)
getKindRef :: DeclarationRef -> Maybe (ProperName KindName)
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
isImplicit :: ImportDeclarationType -> Bool
isExplicit :: ImportDeclarationType -> Bool
-- | The data type of declarations
data Declaration
-- | A data type declaration (data or newtype, name, arguments, data
-- constructors)
DataDeclaration :: DataDeclType -> (ProperName TypeName) -> [(Text, Maybe Kind)] -> [(ProperName ConstructorName, [Type])] -> Declaration
-- | A minimal mutually recursive set of data type declarations
DataBindingGroupDeclaration :: [Declaration] -> Declaration
-- | A type synonym declaration (name, arguments, type)
TypeSynonymDeclaration :: (ProperName TypeName) -> [(Text, Maybe Kind)] -> Type -> Declaration
-- | A type declaration for a value (name, ty)
TypeDeclaration :: Ident -> Type -> Declaration
-- | A value declaration (name, top-level binders, optional guard, value)
ValueDeclaration :: Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration
-- | A declaration paired with pattern matching in let-in expression
-- (binder, optional guard, value)
BoundValueDeclaration :: Binder -> Expr -> Declaration
-- | A minimal mutually recursive set of value declarations
BindingGroupDeclaration :: [(Ident, NameKind, Expr)] -> Declaration
-- | A foreign import declaration (name, type)
ExternDeclaration :: Ident -> Type -> Declaration
-- | A data type foreign import (name, kind)
ExternDataDeclaration :: (ProperName TypeName) -> Kind -> Declaration
-- | A foreign kind import (name)
ExternKindDeclaration :: (ProperName KindName) -> Declaration
-- | A fixity declaration
FixityDeclaration :: (Either ValueFixity TypeFixity) -> Declaration
-- | A module import (module name, qualifiedunqualifiedhiding,
-- optional "qualified as" name)
ImportDeclaration :: ModuleName -> ImportDeclarationType -> (Maybe ModuleName) -> Declaration
-- | A type class declaration (name, argument, implies, member
-- declarations)
TypeClassDeclaration :: (ProperName ClassName) -> [(Text, Maybe Kind)] -> [Constraint] -> [FunctionalDependency] -> [Declaration] -> Declaration
-- | A type instance declaration (name, dependencies, class name, instance
-- types, member declarations)
TypeInstanceDeclaration :: Ident -> [Constraint] -> (Qualified (ProperName ClassName)) -> [Type] -> TypeInstanceBody -> Declaration
-- | A declaration with source position information
PositionedDeclaration :: SourceSpan -> [Comment] -> Declaration -> Declaration
data ValueFixity
ValueFixity :: Fixity -> (Qualified (Either Ident (ProperName ConstructorName))) -> (OpName ValueOpName) -> ValueFixity
data TypeFixity
TypeFixity :: Fixity -> (Qualified (ProperName TypeName)) -> (OpName TypeOpName) -> TypeFixity
-- | 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 an instance derived from a newtype, desugared to include a
-- dictionary for the type under the newtype.
NewtypeInstanceWithDictionary :: Expr -> TypeInstanceBody
-- | This is a regular (explicit) instance
ExplicitInstance :: [Declaration] -> TypeInstanceBody
mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody
-- | A traversal for TypeInstanceBody
traverseTypeInstanceBody :: (Applicative f) => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody
-- | Test if a declaration is a value declaration
isValueDecl :: Declaration -> Bool
-- | Test if a declaration is a data type or type synonym declaration
isDataDecl :: Declaration -> Bool
-- | Test if a declaration is a module import
isImportDecl :: Declaration -> Bool
-- | Test if a declaration is a data type foreign import
isExternDataDecl :: Declaration -> Bool
-- | Test if a declaration is a foreign kind import
isExternKindDecl :: 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
isTypeClassInstanceDeclaration :: Declaration -> Bool
-- | Test if a declaration is a type class declaration
isTypeClassDeclaration :: Declaration -> Bool
-- | Recursively flatten data binding groups in the list of declarations
flattenDecls :: [Declaration] -> [Declaration]
-- | A guard is just a boolean-valued expression that appears alongside a
-- set of binders
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
-- | Data type for expressions and terms
data Expr
-- | A literal value
Literal :: (Literal Expr) -> Expr
-- | A prefix -, will be desugared
UnaryMinus :: Expr -> Expr
-- | Binary operator application. During the rebracketing phase of
-- desugaring, this data constructor will be removed.
BinaryNoParens :: Expr -> Expr -> Expr -> Expr
-- | Explicit parentheses. During the rebracketing phase of desugaring,
-- this data constructor will be removed.
--
-- Note: although it seems this constructor is not used, it _is_ useful,
-- since it prevents certain traversals from matching.
Parens :: Expr -> Expr
-- | 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
-- | Variable
Var :: (Qualified Ident) -> Expr
-- | An operator. This will be desugared into a function during the
-- "operators" phase of desugaring.
Op :: (Qualified (OpName ValueOpName)) -> Expr
-- | Conditional (if-then-else expression)
IfThenElse :: Expr -> Expr -> Expr -> Expr
-- | A data constructor
Constructor :: (Qualified (ProperName ConstructorName)) -> Expr
-- | A case expression. During the case expansion phase of desugaring,
-- top-level binders will get desugared into case expressions, hence the
-- need for guards and multiple binders per branch here.
Case :: [Expr] -> [CaseAlternative] -> Expr
-- | A value with a type annotation
TypedValue :: Bool -> Expr -> Type -> Expr
-- | A let binding
Let :: [Declaration] -> Expr -> Expr
-- | A do-notation block
Do :: [DoNotationElement] -> Expr
-- | An application of a typeclass dictionary constructor. The value should
-- be an ObjectLiteral.
TypeClassDictionaryConstructorApp :: (Qualified (ProperName ClassName)) -> Expr -> Expr
-- | A placeholder for a type class dictionary to be inserted later. At the
-- end of type checking, these placeholders will be replaced with actual
-- expressions representing type classes dictionaries which can be
-- evaluated at runtime. The constructor arguments represent (in order):
-- whether or not to look at superclass implementations when searching
-- for a dictionary, the type class name and instance type, and the type
-- class dictionaries in scope.
TypeClassDictionary :: Constraint -> (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) NamedDict))) -> [ErrorMessageHint] -> Expr
-- | A typeclass dictionary accessor, the implementation is left
-- unspecified until CoreFn desugaring.
TypeClassDictionaryAccessor :: (Qualified (ProperName ClassName)) -> Ident -> Expr
-- | A placeholder for a superclass dictionary to be turned into a
-- TypeClassDictionary during typechecking
DeferredDictionary :: (Qualified (ProperName ClassName)) -> [Type] -> Expr
-- | A placeholder for an anonymous function argument
AnonymousArgument :: Expr
-- | A typed hole that will be turned into a hint/error duing typechecking
Hole :: Text -> Expr
-- | A value with source position information
PositionedValue :: SourceSpan -> [Comment] -> Expr -> Expr
-- | 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
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 GHC.Show.Show Language.PureScript.AST.Declarations.ErrorMessage
instance GHC.Show.Show Language.PureScript.AST.Declarations.SimpleErrorMessage
instance GHC.Show.Show Language.PureScript.AST.Declarations.Module
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 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 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 t, GHC.Classes.Ord k) => GHC.Classes.Ord (Language.PureScript.AST.Declarations.AssocList k t)
instance (GHC.Classes.Eq t, GHC.Classes.Eq k) => GHC.Classes.Eq (Language.PureScript.AST.Declarations.AssocList k t)
instance (GHC.Show.Show t, GHC.Show.Show k) => GHC.Show.Show (Language.PureScript.AST.Declarations.AssocList k t)
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.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.ImportDeclarationType
instance GHC.Classes.Eq Language.PureScript.AST.Declarations.ImportDeclarationType
instance GHC.Show.Show Language.PureScript.AST.Declarations.DeclarationRef
instance GHC.Classes.Eq Language.PureScript.AST.Declarations.HintCategory
instance GHC.Show.Show Language.PureScript.AST.Declarations.HintCategory
instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeSearch
instance GHC.Classes.Eq Language.PureScript.AST.Declarations.DeclarationRef
module Language.PureScript.AST.Exported
-- | Return a list of all declarations which are exported from a module.
-- This function descends into data declarations to filter out unexported
-- data constructors, and also filters out type instance declarations if
-- they refer to classes or types which are not themselves exported.
--
-- Note that this function assumes that the module has already had its
-- imports desugared using desugarImports. It will produce
-- incorrect results if this is not the case - for example, type class
-- instances will be incorrectly removed in some cases.
exportedDeclarations :: Module -> [Declaration]
-- | Test if a declaration is exported, given a module's export list. Note
-- that this function does not account for type instance declarations of
-- non-exported types, or non-exported data constructors. Therefore, you
-- should prefer exportedDeclarations to this function, where
-- possible.
isExported :: Maybe [DeclarationRef] -> Declaration -> Bool
-- | AST traversal helpers
module Language.PureScript.AST.Traversals
guardedExprM :: Applicative m => (Guard -> m Guard) -> (Expr -> m Expr) -> GuardedExpr -> m GuardedExpr
mapGuardedExpr :: (Guard -> Guard) -> (Expr -> Expr) -> GuardedExpr -> GuardedExpr
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)
everywhereWithContextOnValuesM :: forall m s. (Monad m) => s -> (s -> Declaration -> m (s, Declaration)) -> (s -> Expr -> m (s, Expr)) -> (s -> Binder -> m (s, Binder)) -> (s -> CaseAlternative -> m (s, CaseAlternative)) -> (s -> DoNotationElement -> m (s, DoNotationElement)) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder, CaseAlternative -> m CaseAlternative, DoNotationElement -> m DoNotationElement)
everythingWithScope :: forall r. (Monoid r) => (Set Ident -> Declaration -> r) -> (Set Ident -> Expr -> r) -> (Set Ident -> Binder -> r) -> (Set Ident -> CaseAlternative -> r) -> (Set Ident -> DoNotationElement -> r) -> (Set Ident -> Declaration -> r, Set Ident -> Expr -> r, Set Ident -> Binder -> r, Set Ident -> CaseAlternative -> r, Set Ident -> DoNotationElement -> r)
accumTypes :: (Monoid r) => (Type -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)
accumKinds :: (Monoid r) => (Kind -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)
-- | Map a function over type annotations appearing inside a value
overTypes :: (Type -> Type) -> Expr -> Expr
-- | The initial PureScript AST
module Language.PureScript.AST
-- | 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 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
-- | A block of expressions in braces
Block :: (Maybe SourceSpan) -> [AST] -> AST
-- | A variable introduction and optional initialization
VariableIntroduction :: (Maybe SourceSpan) -> Text -> (Maybe 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 :: (Maybe SourceSpan) -> [Comment] -> 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.AST
instance GHC.Show.Show Language.PureScript.CoreImp.AST.AST
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.UnaryOperator
instance GHC.Show.Show Language.PureScript.CoreImp.AST.UnaryOperator
-- | 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
-- | 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
isUsed :: Text -> AST -> Bool
targetVariable :: AST -> Text
isUpdated :: Text -> AST -> Bool
removeFromBlock :: ([AST] -> [AST]) -> AST -> AST
isDict :: (Text, PSString) -> AST -> Bool
isDict' :: [(Text, PSString)] -> AST -> Bool
-- | This module performs basic inlining of known functions
module Language.PureScript.CoreImp.Optimizer.Inliner
inlineVariables :: AST -> AST
inlineCommonValues :: AST -> AST
inlineCommonOperators :: AST -> AST
inlineFnComposition :: forall m. MonadSupply m => AST -> m AST
inlineUnsafePartial :: AST -> AST
etaConvert :: AST -> AST
unThunk :: AST -> AST
evaluateIifes :: 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
-- | 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(); ... }
magicDo :: AST -> AST
-- | This module implements tail call elimination.
module Language.PureScript.CoreImp.Optimizer.TCO
-- | Eliminate tail calls
tco :: AST -> AST
-- | Removes unused variables
module Language.PureScript.CoreImp.Optimizer.Unused
removeCodeAfterReturnStatements :: AST -> AST
removeUnusedArg :: AST -> AST
removeUndefinedApp :: AST -> AST
-- | This module optimizes code in the simplified-JavaScript intermediate
-- representation.
--
-- The following optimizations are supported:
--
--
-- - Collapsing nested blocks
-- - Tail call elimination
-- - Inlining of (>>=) and ret for the Eff monad
-- - Removal of unnecessary thunks
-- - Eta conversion
-- - Inlining variables
-- - Inline Prelude.($), Prelude.(#), Prelude.(++), Prelude.(!!)
-- - Inlining primitive JavaScript operators
--
module Language.PureScript.CoreImp.Optimizer
-- | Apply a series of optimizer passes to simplified JavaScript code
optimize :: MonadSupply m => AST -> m AST
-- | The imperative core language
module Language.PureScript.CoreImp
-- | 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
asRenderedCodeElement :: Parse 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 ContainingModule to a Maybe ModuleName,
-- using the obvious isomorphism.
containingModuleToMaybe :: ContainingModule -> Maybe ModuleName
-- | Convert a Maybe ModuleName to a ContainingModule,
-- using the obvious isomorphism.
maybeToContainingModule :: Maybe ModuleName -> ContainingModule
-- | A version of fromMaybe for ContainingModule values.
fromContainingModule :: ModuleName -> ContainingModule -> ModuleName
fromQualified :: Qualified a -> (ContainingModule, a)
data Namespace
ValueLevel :: Namespace
TypeLevel :: Namespace
KindLevel :: 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
asRenderedCode :: Parse Text 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
-- | Wrap a RenderedCode value in parens.
parens :: RenderedCode -> RenderedCode
syntax :: Text -> RenderedCode
keyword :: Text -> RenderedCode
keywordForall :: RenderedCode
keywordData :: RenderedCode
keywordNewtype :: RenderedCode
keywordType :: RenderedCode
keywordClass :: RenderedCode
keywordInstance :: RenderedCode
keywordWhere :: RenderedCode
keywordFixity :: Associativity -> RenderedCode
keywordKind :: 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
kind :: Qualified (ProperName KindName) -> RenderedCode
alias :: FixityAlias -> RenderedCode
aliasName :: FixityAlias -> Text -> RenderedCode
instance GHC.Base.Monoid Language.PureScript.Docs.RenderedCode.Types.RenderedCode
instance GHC.Classes.Ord Language.PureScript.Docs.RenderedCode.Types.RenderedCode
instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.RenderedCode
instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.RenderedCode
instance GHC.Classes.Ord Language.PureScript.Docs.RenderedCode.Types.RenderedCodeElement
instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.RenderedCodeElement
instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.RenderedCodeElement
instance GHC.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.Link
instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.Link
instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.Link
instance GHC.Classes.Ord Language.PureScript.Docs.RenderedCode.Types.ContainingModule
instance GHC.Classes.Eq Language.PureScript.Docs.RenderedCode.Types.ContainingModule
instance GHC.Show.Show Language.PureScript.Docs.RenderedCode.Types.ContainingModule
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.RenderedCode.Types.ContainingModule
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Docs.RenderedCode.Types.ContainingModule
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 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.RenderedCodeElement
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.RenderedCode.Types.RenderedCode
-- | Functions for producing RenderedCode values from PureScript Kind
-- values.
module Language.PureScript.Docs.RenderedCode.RenderKind
-- | Generate RenderedCode value representing a Kind
renderKind :: Kind -> RenderedCode
-- | Common pretty-printing utility functions
module Language.PureScript.Pretty.Common
-- | Wrap a string in parentheses
parens :: String -> String
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
-- | Make a monoid where append consists of concatenating the string part,
-- adding the lengths appropriately and advancing source mappings on the
-- right hand side to account for the length of the left.
newtype PlainString
PlainString :: 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
emptyPrinterState :: PrinterState
-- | Number of characters per identation 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
-- | Print many lines
prettyPrintMany :: (Emit gen) => (a -> StateT PrinterState Maybe gen) -> [a] -> 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.Monoid Language.PureScript.Pretty.Common.StrPos
instance Language.PureScript.Pretty.Common.Emit Language.PureScript.Pretty.Common.StrPos
instance Language.PureScript.Pretty.Common.Emit Language.PureScript.Pretty.Common.PlainString
-- | Pretty printer for the JavaScript AST
module Language.PureScript.CodeGen.JS.Printer
prettyPrintJS :: [AST] -> Text
-- | Generate a pretty-printed string representing a collection of
-- JavaScript expressions at the same indentation level
prettyPrintJSWithSourceMaps :: [AST] -> (Text, [SMap])
-- | Pretty printer for kinds
module Language.PureScript.Pretty.Kinds
-- | Generate a pretty-printed string representing a Kind
prettyPrintKind :: Kind -> Text
-- | 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
module Language.PureScript.Sugar.Operators.Common
type Chain a = [Either a a]
toAssoc :: Associativity -> Assoc
token :: (Stream s Identity t) => (t -> Maybe a) -> Parsec s u a
parseValue :: Parsec (Chain a) () a
parseOp :: (a -> Maybe (Qualified (OpName nameType))) -> Parsec (Chain a) () (Qualified (OpName nameType))
matchOp :: (a -> Maybe (Qualified (OpName nameType))) -> Qualified (OpName nameType) -> Parsec (Chain a) () ()
opTable :: [[(Qualified (OpName nameType), Associativity)]] -> (a -> Maybe (Qualified (OpName nameType))) -> (Qualified (OpName nameType) -> a -> a -> a) -> [[Operator (Chain a) () Identity a]]
matchOperators :: forall a nameType. Show a => (a -> Bool) -> (a -> Maybe (a, a, a)) -> (a -> Maybe (Qualified (OpName nameType))) -> (Qualified (OpName nameType) -> a -> a -> a) -> ([[Operator (Chain a) () Identity a]] -> OperatorTable (Chain a) () Identity a) -> [[(Qualified (OpName nameType), Associativity)]] -> a -> a
module Language.PureScript.Sugar.Operators.Binders
matchBinderOperators :: [[(Qualified (OpName ValueOpName), Associativity)]] -> Binder -> Binder
module Language.PureScript.Sugar.Operators.Expr
matchExprOperators :: [[(Qualified (OpName ValueOpName), Associativity)]] -> Expr -> Expr
module Language.PureScript.Sugar.Operators.Types
matchTypeOperators :: [[(Qualified (OpName TypeOpName), Associativity)]] -> Type -> Type
module Language.PureScript.Parser.Types
-- | Parse a monotype
parseType :: TokenParser Type
-- | Parse a polytype
parsePolyType :: TokenParser Type
-- | Parse an atomic type with no forall
noForAll :: TokenParser Type -> TokenParser Type
-- | Parse an atomic type with no wildcards
noWildcards :: TokenParser Type -> TokenParser Type
-- | Parse a type as it appears in e.g. a data constructor
parseTypeAtom :: TokenParser Type
-- | Pretty printer for Types
module Language.PureScript.Pretty.Types
typeAsBox :: Type -> Box
suggestedTypeAsBox :: Type -> Box
-- | Generate a pretty-printed string representing a Type
prettyPrintType :: Type -> String
-- | Generate a pretty-printed string representing a Type using
-- unicode symbols where applicable
prettyPrintTypeWithUnicode :: Type -> String
-- | Generate a pretty-printed string representing a suggested Type
prettyPrintSuggestedType :: Type -> String
typeAtomAsBox :: Type -> Box
-- | Generate a pretty-printed string representing a Type, as it should
-- appear inside parentheses
prettyPrintTypeAtom :: Type -> String
prettyPrintRow :: Type -> String
prettyPrintLabel :: Label -> Text
prettyPrintObjectKey :: PSString -> Text
-- | Functions for producing RenderedCode values from PureScript Type
-- values.
module Language.PureScript.Docs.RenderedCode.RenderType
-- | Render code representing a Type
renderType :: Type -> RenderedCode
-- | Render code representing a Type, as it should appear inside
-- parentheses
renderTypeAtom :: Type -> RenderedCode
-- | Render code representing a Row
renderRow :: Type -> RenderedCode
data RenderTypeOptions
RenderTypeOptions :: Bool -> Maybe ModuleName -> RenderTypeOptions
[prettyPrintObjects] :: RenderTypeOptions -> Bool
[currentModule] :: RenderTypeOptions -> Maybe ModuleName
defaultRenderTypeOptions :: RenderTypeOptions
renderTypeWithOptions :: RenderTypeOptions -> Type -> RenderedCode
renderTypeAtomWithOptions :: RenderTypeOptions -> Type -> RenderedCode
-- | Data types and functions for representing a simplified form of
-- PureScript code, intended for use in e.g. HTML documentation.
module Language.PureScript.Docs.RenderedCode
-- | 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:
--
--
-- - [Language.PureScript.Pretty.Kinds] Pretty printer for
-- kinds
-- - [Language.PureScript.Pretty.Values] Pretty printer for
-- values
-- - [Language.PureScript.Pretty.Types] Pretty printer for
-- types
--
module Language.PureScript.Pretty
module Language.PureScript.Errors
newtype ErrorSuggestion
ErrorSuggestion :: Text -> ErrorSuggestion
-- | Get the source span for an error
errorSpan :: ErrorMessage -> Maybe SourceSpan
-- | Get the module name for an error
errorModule :: ErrorMessage -> Maybe ModuleName
findHint :: (ErrorMessageHint -> Maybe a) -> ErrorMessage -> Maybe a
-- | Remove the module name and span hints from an error
stripModuleAndSpan :: ErrorMessage -> ErrorMessage
-- | Get the error code for a particular error type
errorCode :: ErrorMessage -> Text
-- | A stack trace for an error
newtype MultipleErrors
MultipleErrors :: [ErrorMessage] -> MultipleErrors
[runMultipleErrors] :: MultipleErrors -> [ErrorMessage]
-- | Check whether a collection of errors is empty or not.
nonEmpty :: MultipleErrors -> Bool
-- | Create an error set from a single simple error message
errorMessage :: SimpleErrorMessage -> MultipleErrors
-- | Create an error set from a single error message
singleError :: ErrorMessage -> MultipleErrors
-- | Lift a function on ErrorMessage to a function on MultipleErrors
onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors
-- | Add a hint to an error message
addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors
-- | Add hints to an error message
addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors
-- | A map from rigid type variable name/unknown variable pairs to new
-- variables.
data TypeMap
TypeMap :: Map Int (String, Int, Maybe SourceSpan) -> 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
defaultUnknownMap :: TypeMap
-- | How critical the issue is
data Level
Error :: Level
Warning :: Level
-- | Extract nested error messages from wrapper errors
unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage
replaceUnknowns :: Type -> State TypeMap Type
onTypesInErrorMessage :: (Type -> Type) -> ErrorMessage -> ErrorMessage
onTypesInErrorMessageM :: Applicative m => (Type -> m Type) -> 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
-- | Default color intesity and color for code
defaultCodeColor :: (ColorIntensity, Color)
-- | prettyPrintSingleError Options
data PPEOptions
PPEOptions :: Maybe (ColorIntensity, Color) -> Bool -> Level -> Bool -> FilePath -> 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
-- | 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
-- | 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]
-- | Pretty print a Parsec ParseError as a Box
prettyPrintParseError :: ParseError -> Box
-- | Pretty print ParseError detail messages.
--
-- Adapted from showErrorMessages. See
-- https://github.com/aslatter/parsec/blob/v3.1.9/Text/Parsec/Error.hs#L173.
prettyPrintParseErrorMessages :: String -> String -> String -> String -> String -> [Message] -> Box
-- | Indent to the right, and pad on top and bottom.
indent :: Box -> Box
line :: Text -> Box
lineS :: String -> Box
renderBox :: Box -> String
toTypelevelString :: Type -> 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
reifyErrors :: (MonadError e m) => m a -> m (Either e a)
reflectErrors :: (MonadError e m) => m (Either e a) -> m a
warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a
-- | Rethrow an error with source position information
rethrowWithPosition :: (MonadError MultipleErrors m) => SourceSpan -> m a -> m a
warnWithPosition :: (MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a
warnAndRethrowWithPosition :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a
withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage
-- | Runs a computation listening for warnings and then escalating any
-- warnings that match the predicate to error status.
escalateWarningWhen :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (ErrorMessage -> Bool) -> m a -> m a
-- | Collect errors in in parallel
parU :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b]
instance GHC.Show.Show Language.PureScript.Errors.Level
instance GHC.Show.Show Language.PureScript.Errors.TypeMap
instance GHC.Base.Monoid Language.PureScript.Errors.MultipleErrors
instance GHC.Show.Show Language.PureScript.Errors.MultipleErrors
-- | 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, MonadSupply m) => Environment -> ModuleName -> Expr -> m Expr
-- | Provides the ability to sort modules based on module dependencies
module Language.PureScript.ModuleDependencies
-- | Sort a collection of modules based on module dependencies.
--
-- Reports an error if the module graph contains a cycle.
sortModules :: forall m. MonadError MultipleErrors m => [Module] -> m ([Module], ModuleGraph)
-- | A list of modules with their transitive dependencies
type ModuleGraph = [(ModuleName, [ModuleName])]
-- | Parsers for module definitions and declarations
module Language.PureScript.Parser.Declarations
-- | Parse a single declaration
parseDeclaration :: TokenParser Declaration
parseDeclarationRef :: TokenParser DeclarationRef
-- | Parse a module header and a collection of declarations
parseModule :: TokenParser Module
-- | Parse a module declaration and its export declarations
parseModuleDeclaration :: TokenParser (ModuleName, Maybe [DeclarationRef])
-- | Parse a collection of modules in parallel
parseModulesFromFiles :: forall m k. MonadError MultipleErrors m => (k -> FilePath) -> [(k, Text)] -> m [(k, Module)]
-- | Parses a single module with FilePath for eventual parsing errors
parseModuleFromFile :: (k -> FilePath) -> (k, Text) -> Either ParseError (k, Module)
-- | Parse an expression
parseValue :: TokenParser Expr
-- | Parse a guard
parseGuard :: TokenParser [Guard]
-- | Parse a binder
parseBinder :: TokenParser Binder
-- | Parse a binder as it would appear in a top level declaration
parseBinderNoParens :: TokenParser Binder
parseImportDeclaration' :: TokenParser (ModuleName, ImportDeclarationType, Maybe ModuleName)
parseLocalDeclaration :: TokenParser Declaration
-- | Converts a ParseError into a PositionedError
toPositionedError :: ParseError -> ErrorMessage
-- | A collection of parsers for core data types:
--
--
-- - Language.PureScript.Parser.Kinds Parser for
-- kinds
-- - Language.PureScript.Parser.Values Parser for
-- values
-- - Language.PureScript.Parser.Types Parser for
-- types
-- - Language.PureScript.Parser.Declaration Parsers for
-- declarations and modules
-- - Language.PureScript.Parser.State Parser state,
-- including indentation
-- - Language.PureScript.Parser.Common Common parsing
-- utility functions
--
module Language.PureScript.Parser
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 ()
-- | 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]
-- | Collapse all binding groups in a module to individual declarations
collapseBindingGroupsModule :: [Module] -> [Module]
module Language.PureScript.Sugar.Names.Env
-- | The details for an import: the name of the thing that is being
-- imported (x if importing from A), the module that the
-- thing was originally defined in (for re-export resolution), and the
-- import provenance (see below).
data ImportRecord a
ImportRecord :: Qualified a -> ModuleName -> ImportProvenance -> ImportRecord a
[importName] :: ImportRecord a -> Qualified a
[importSourceModule] :: ImportRecord a -> ModuleName
[importProvenance] :: ImportRecord a -> ImportProvenance
-- | Used to track how an import was introduced into scope. This allows us
-- to handle the one-open-import special case that allows a name conflict
-- to become a warning rather than being an unresolvable situation.
data ImportProvenance
FromImplicit :: ImportProvenance
FromExplicit :: ImportProvenance
Local :: ImportProvenance
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 KindName) -> 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 KindName)
-- | An Imports value with imports for the Prim module.
primImports :: Imports
-- | The exported declarations from a module.
data Exports
Exports :: Map (ProperName TypeName) ([ProperName ConstructorName], ModuleName) -> Map (OpName TypeOpName) ModuleName -> Map (ProperName ClassName) ModuleName -> Map Ident ModuleName -> Map (OpName ValueOpName) ModuleName -> Map (ProperName KindName) ModuleName -> Exports
-- | The exported types along with the module they originally came from.
[exportedTypes] :: Exports -> Map (ProperName TypeName) ([ProperName ConstructorName], ModuleName)
-- | The exported type operators along with the module they originally came
-- from.
[exportedTypeOps] :: Exports -> Map (OpName TypeOpName) ModuleName
-- | The exported classes along with the module they originally came from.
[exportedTypeClasses] :: Exports -> Map (ProperName ClassName) ModuleName
-- | The exported values along with the module they originally came from.
[exportedValues] :: Exports -> Map Ident ModuleName
-- | The exported value operators along with the module they originally
-- came from.
[exportedValueOps] :: Exports -> Map (OpName ValueOpName) ModuleName
-- | The exported kinds along with the module they originally came from.
[exportedKinds] :: Exports -> Map (ProperName KindName) ModuleName
-- | An empty Exports value.
nullExports :: Exports
-- | The imports and exports for a collection of modules. The
-- SourceSpan is used to store the source location of the module
-- with a given name, used to provide useful information when there is a
-- duplicate module definition.
type Env = Map ModuleName (SourceSpan, Imports, Exports)
-- | Environment which only contains the Prim module.
primEnv :: Env
-- | Extracts the SourceSpan from an Env value.
envModuleSourceSpan :: (SourceSpan, a, b) -> SourceSpan
-- | Extracts the Imports from an Env value.
envModuleImports :: (a, Imports, b) -> Imports
-- | Extracts the Exports from an Env value.
envModuleExports :: (a, b, Exports) -> Exports
-- | 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 => ExportMode -> Exports -> ProperName TypeName -> [ProperName ConstructorName] -> ModuleName -> m Exports
-- | Safely adds a type operator to some exports, returning an error if a
-- conflict occurs.
exportTypeOp :: MonadError MultipleErrors m => Exports -> OpName TypeOpName -> ModuleName -> m Exports
-- | Safely adds a class to some exports, returning an error if a conflict
-- occurs.
exportTypeClass :: MonadError MultipleErrors m => ExportMode -> Exports -> ProperName ClassName -> ModuleName -> m Exports
-- | Safely adds a value to some exports, returning an error if a conflict
-- occurs.
exportValue :: MonadError MultipleErrors m => Exports -> Ident -> ModuleName -> m Exports
-- | Safely adds a value operator to some exports, returning an error if a
-- conflict occurs.
exportValueOp :: MonadError MultipleErrors m => Exports -> OpName ValueOpName -> ModuleName -> m Exports
-- | Safely adds a kind to some exports, returning an error if a conflict
-- occurs.
exportKind :: MonadError MultipleErrors m => Exports -> ProperName KindName -> ModuleName -> m Exports
-- | Gets the exports for a module, or raise an error if the module doesn't
-- exist.
getExports :: MonadError MultipleErrors m => Env -> ModuleName -> 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) => ModuleName -> (a -> Name) -> [ImportRecord a] -> m (ModuleName, ModuleName)
instance GHC.Show.Show Language.PureScript.Sugar.Names.Env.ExportMode
instance GHC.Classes.Eq Language.PureScript.Sugar.Names.Env.ExportMode
instance GHC.Show.Show Language.PureScript.Sugar.Names.Env.Exports
instance GHC.Show.Show Language.PureScript.Sugar.Names.Env.Imports
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.ImportProvenance
instance GHC.Classes.Ord Language.PureScript.Sugar.Names.Env.ImportProvenance
instance GHC.Classes.Eq Language.PureScript.Sugar.Names.Env.ImportProvenance
module Language.PureScript.Sugar.Names.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
module Language.PureScript.Sugar.Names.Imports
type ImportDef = (Maybe 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, [(Maybe SourceSpan, Maybe ImportDeclarationType, Maybe ModuleName)]) -> m Imports
-- | Finds the imports within a module, mapping the imported module name to
-- an optional set of explicitly imported declarations.
findImports :: [Declaration] -> Map ModuleName [ImportDef]
module Language.PureScript.Linter.Imports
-- | Find and warn on:
--
--
-- - Unused import statements (qualified or unqualified)
-- - Unused references in an explicit import list
-- - Implicit imports of modules
-- - Implicit imports into a virtual module (unless the virtual module
-- only has members from one module imported)
-- - Imports using hiding (this is another form of implicit
-- importing)
--
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
KiName :: (ProperName KindName) -> Name
-- | Map of module name to list of imported names from that module which
-- have been used.
type UsedImports = Map ModuleName [Qualified Name]
-- | This module implements a simple linting pass on the PureScript AST.
module Language.PureScript.Linter
-- | Lint the PureScript AST. | | Right now, this pass only performs a
-- shadowing check.
lint :: forall m. (MonadWriter MultipleErrors m) => Module -> m ()
-- | 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
-- | 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 -> Kind -> TypeKind -> ExternsDeclaration
[edTypeName] :: ExternsDeclaration -> ProperName TypeName
[edTypeKind] :: ExternsDeclaration -> Kind
[edTypeDeclarationKind] :: ExternsDeclaration -> TypeKind
-- | A type synonym
EDTypeSynonym :: ProperName TypeName -> [(Text, Maybe Kind)] -> Type -> ExternsDeclaration
[edTypeSynonymName] :: ExternsDeclaration -> ProperName TypeName
[edTypeSynonymArguments] :: ExternsDeclaration -> [(Text, Maybe Kind)]
[edTypeSynonymType] :: ExternsDeclaration -> Type
-- | A data construtor
EDDataConstructor :: ProperName ConstructorName -> DataDeclType -> ProperName TypeName -> Type -> [Ident] -> ExternsDeclaration
[edDataCtorName] :: ExternsDeclaration -> ProperName ConstructorName
[edDataCtorOrigin] :: ExternsDeclaration -> DataDeclType
[edDataCtorTypeCtor] :: ExternsDeclaration -> ProperName TypeName
[edDataCtorType] :: ExternsDeclaration -> Type
[edDataCtorFields] :: ExternsDeclaration -> [Ident]
-- | A value declaration
EDValue :: Ident -> Type -> ExternsDeclaration
[edValueName] :: ExternsDeclaration -> Ident
[edValueType] :: ExternsDeclaration -> Type
-- | A type class declaration
EDClass :: ProperName ClassName -> [(Text, Maybe Kind)] -> [(Ident, Type)] -> [Constraint] -> [FunctionalDependency] -> ExternsDeclaration
[edClassName] :: ExternsDeclaration -> ProperName ClassName
[edClassTypeArguments] :: ExternsDeclaration -> [(Text, Maybe Kind)]
[edClassMembers] :: ExternsDeclaration -> [(Ident, Type)]
[edClassConstraints] :: ExternsDeclaration -> [Constraint]
[edFunctionalDependencies] :: ExternsDeclaration -> [FunctionalDependency]
-- | An instance declaration
EDInstance :: Qualified (ProperName ClassName) -> Ident -> [Type] -> Maybe [Constraint] -> ExternsDeclaration
[edInstanceClassName] :: ExternsDeclaration -> Qualified (ProperName ClassName)
[edInstanceName] :: ExternsDeclaration -> Ident
[edInstanceTypes] :: ExternsDeclaration -> [Type]
[edInstanceConstraints] :: ExternsDeclaration -> Maybe [Constraint]
-- | A kind declaration
EDKind :: ProperName KindName -> ExternsDeclaration
[edKindName] :: ExternsDeclaration -> ProperName KindName
-- | Generate an externs file for all declarations in a module
moduleToExternsFile :: Module -> Environment -> ExternsFile
-- | Convert an externs file back into a module
applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Externs.ExternsFile
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Externs.ExternsFile
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Externs.ExternsDeclaration
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Externs.ExternsDeclaration
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Externs.ExternsTypeFixity
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Externs.ExternsTypeFixity
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Externs.ExternsFixity
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Externs.ExternsFixity
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Externs.ExternsImport
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Externs.ExternsImport
instance GHC.Show.Show Language.PureScript.Externs.ExternsFile
instance GHC.Show.Show Language.PureScript.Externs.ExternsDeclaration
instance GHC.Show.Show Language.PureScript.Externs.ExternsTypeFixity
instance GHC.Show.Show Language.PureScript.Externs.ExternsFixity
instance GHC.Show.Show Language.PureScript.Externs.ExternsImport
module Language.PureScript.Sugar.Names
-- | Replaces all local names with qualified names within a list of
-- modules. The modules should be topologically sorted beforehand.
desugarImports :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
desugarImportsWithEnv :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m (Env, [Module])
-- | The imports and exports for a collection of modules. The
-- SourceSpan is used to store the source location of the module
-- with a given name, used to provide useful information when there is a
-- duplicate module definition.
type Env = Map ModuleName (SourceSpan, Imports, Exports)
-- | The details for an import: the name of the thing that is being
-- imported (x if importing from A), the module that the
-- thing was originally defined in (for re-export resolution), and the
-- import provenance (see below).
data ImportRecord a
ImportRecord :: Qualified a -> ModuleName -> ImportProvenance -> ImportRecord a
[importName] :: ImportRecord a -> Qualified a
[importSourceModule] :: ImportRecord a -> ModuleName
[importProvenance] :: ImportRecord a -> ImportProvenance
-- | Used to track how an import was introduced into scope. This allows us
-- to handle the one-open-import special case that allows a name conflict
-- to become a warning rather than being an unresolvable situation.
data ImportProvenance
FromImplicit :: ImportProvenance
FromExplicit :: ImportProvenance
Local :: ImportProvenance
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 KindName) -> 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 KindName)
-- | The exported declarations from a module.
data Exports
Exports :: Map (ProperName TypeName) ([ProperName ConstructorName], ModuleName) -> Map (OpName TypeOpName) ModuleName -> Map (ProperName ClassName) ModuleName -> Map Ident ModuleName -> Map (OpName ValueOpName) ModuleName -> Map (ProperName KindName) ModuleName -> Exports
-- | The exported types along with the module they originally came from.
[exportedTypes] :: Exports -> Map (ProperName TypeName) ([ProperName ConstructorName], ModuleName)
-- | The exported type operators along with the module they originally came
-- from.
[exportedTypeOps] :: Exports -> Map (OpName TypeOpName) ModuleName
-- | The exported classes along with the module they originally came from.
[exportedTypeClasses] :: Exports -> Map (ProperName ClassName) ModuleName
-- | The exported values along with the module they originally came from.
[exportedValues] :: Exports -> Map Ident ModuleName
-- | The exported value operators along with the module they originally
-- came from.
[exportedValueOps] :: Exports -> Map (OpName ValueOpName) ModuleName
-- | The exported kinds along with the module they originally came from.
[exportedKinds] :: Exports -> Map (ProperName KindName) ModuleName
-- | 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
-- | 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 => [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
-- | Monads for type checking and type inference and associated data types
module Language.PureScript.TypeChecker.Monad
-- | A substitution of unification variables for types or kinds
data Substitution
Substitution :: Map Int Type -> Map Int Kind -> Substitution
-- | Type substitution
[substType] :: Substitution -> Map Int Type
-- | Kind substitution
[substKind] :: Substitution -> Map Int Kind
-- | An empty substitution
emptySubstitution :: Substitution
-- | State required for type checking
data CheckState
CheckState :: Environment -> Int -> Int -> Int -> Int -> Maybe ModuleName -> Substitution -> [ErrorMessageHint] -> CheckState
-- | The current Environment
[checkEnv] :: CheckState -> Environment
-- | The next type unification variable
[checkNextType] :: CheckState -> Int
-- | The next kind unification variable
[checkNextKind] :: CheckState -> Int
-- | The next skolem variable
[checkNextSkolem] :: CheckState -> Int
-- | The next skolem scope constant
[checkNextSkolemScope] :: CheckState -> Int
-- | The current module
[checkCurrentModule] :: CheckState -> Maybe ModuleName
-- | The current substitution
[checkSubstitution] :: CheckState -> Substitution
-- | 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]
-- | 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) (Type, NameKind, NameVisibility) -> m a -> m a
-- | Temporarily bind a collection of names to types
bindTypes :: MonadState CheckState m => Map (Qualified (ProperName TypeName)) (Kind, TypeKind) -> m a -> m a
-- | Temporarily bind a collection of names to types
withScopedTypeVars :: (MonadState CheckState m, MonadWriter MultipleErrors m) => ModuleName -> [(Text, Kind)] -> 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 (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) NamedDict)))
-- | Lookup type class dictionaries in a module.
lookupTypeClassDictionaries :: (MonadState CheckState m) => Maybe ModuleName -> m (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) NamedDict))
-- | Temporarily bind a collection of names to local variables
bindLocalVariables :: (MonadState CheckState m) => [(Ident, Type, NameVisibility)] -> m a -> m a
-- | Temporarily bind a collection of names to local type variables
bindLocalTypeVariables :: (MonadState CheckState m) => ModuleName -> [(ProperName TypeName, Kind)] -> m a -> m a
-- | Update the visibility of all names to Defined
makeBindingGroupVisible :: (MonadState CheckState m) => m ()
-- | Update the visibility of all names to Defined in the scope of the
-- provided action
withBindingGroupVisible :: (MonadState CheckState m) => m a -> m a
-- | Perform an action while preserving the names from the
-- Environment.
preservingNames :: (MonadState CheckState m) => m a -> m a
-- | Lookup the type of a value by name in the Environment
lookupVariable :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m Type
-- | 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 Kind
-- | 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, starting with an empty
-- Environment
runCheck :: (Functor m) => StateT CheckState m a -> m (a, Environment)
-- | Run a computation in the typechecking monad, failing with an error, or
-- succeeding with a return value and the final Environment.
runCheck' :: (Functor m) => CheckState -> StateT CheckState m a -> m (a, Environment)
-- | Make an assertion, failing with an error message
guardWith :: (MonadError e m) => e -> Bool -> m ()
-- | Run a computation in the substitution monad, generating a return value
-- and the final substitution.
captureSubstitution :: MonadState CheckState m => m a -> m (a, Substitution)
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)
-- | 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) => Type -> m Kind
-- | Infer the kind of a single type, returning the kinds of any scoped
-- type variables
kindOfWithScopedVars :: (MonadError MultipleErrors m, MonadState CheckState m) => Type -> m (Kind, [(Text, Kind)])
-- | Infer the kind of a type constructor with a collection of arguments
-- and a collection of associated data constructors
kindsOf :: (MonadError MultipleErrors m, MonadState CheckState m) => Bool -> ModuleName -> ProperName TypeName -> [(Text, Maybe Kind)] -> [Type] -> m Kind
-- | Simultaneously infer the kinds of several mutually recursive type
-- constructors
kindsOfAll :: (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> [(ProperName TypeName, [(Text, Maybe Kind)], Type)] -> [(ProperName TypeName, [(Text, Maybe Kind)], [Type])] -> m ([Kind], [Kind])
-- | Functions relating to skolemization used during typechecking
module Language.PureScript.TypeChecker.Skolems
-- | Generate a new skolem constant
newSkolemConstant :: MonadState CheckState m => m Int
-- | Introduce skolem scope at every occurence of a ForAll
introduceSkolemScope :: MonadState CheckState m => Type -> m Type
-- | Generate a new skolem scope
newSkolemScope :: MonadState CheckState m => m SkolemScope
-- | Skolemize a type variable by replacing its instances with fresh skolem
-- constants
skolemize :: Text -> Int -> SkolemScope -> Maybe SourceSpan -> Type -> Type
-- | 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 :: Text -> Int -> SkolemScope -> Maybe SourceSpan -> 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 ()
-- | 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 Kind)], Type)
-- | Replace fully applied type synonyms
replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Type -> m Type
-- | Replace fully applied type synonyms by explicitly providing a
-- SynonymMap.
replaceAllTypeSynonymsM :: MonadError MultipleErrors m => SynonymMap -> Type -> m Type
-- | Functions and instances relating to unification
module Language.PureScript.TypeChecker.Unify
-- | Generate a fresh type variable
freshType :: (MonadState CheckState m) => m Type
-- | Update the substitution to solve a type constraint
solveType :: (MonadError MultipleErrors m, MonadState CheckState m) => Int -> Type -> m ()
-- | Apply a substitution to a type
substituteType :: Substitution -> Type -> Type
-- | Compute a list of all unknowns appearing in a type
unknownsInType :: Type -> [Int]
-- | Unify two types, updating the current substitution
unifyTypes :: (MonadError MultipleErrors m, MonadState CheckState m) => Type -> Type -> m ()
-- | Unify two rows, updating the current substitution
--
-- Common labels are 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) => Type -> Type -> m ()
-- | Align two rows of types, splitting them into three parts:
--
--
-- - Those types which appear in both rows
-- - Those which appear only on the left
-- - Those which appear only on the right
--
--
-- Note: importantly, we preserve the order of the types with a given
-- label.
alignRowsWith :: (Type -> Type -> a) -> Type -> Type -> ([a], (([(Label, Type)], Type), ([(Label, Type)], Type)))
-- | Replace a single type variable with a new unification variable
replaceVarWithUnknown :: (MonadState CheckState m) => Text -> Type -> m Type
-- | Replace type wildcards with unknowns
replaceTypeWildcards :: (MonadWriter MultipleErrors m, MonadState CheckState m) => Type -> m Type
-- | Replace outermost unsolved unification variables with named type
-- variables
varIfUnknown :: Type -> Type
-- | 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) => Type -> Type -> m (Expr -> Expr)
-- | 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 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
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
-- | This module implements the desugaring pass which creates type synonyms
-- for type class dictionaries and dictionary expressions for type class
-- instances.
module Language.PureScript.Sugar.TypeClasses
-- | Add type synonym declarations for type class dictionary types, and
-- value declarations for type class instance dictionary expressions.
desugarTypeClasses :: (MonadSupply m, MonadError MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
typeClassMemberName :: Declaration -> Text
superClassDictionaryNames :: [Constraint] -> [Text]
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
-- | 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. (Monad m, MonadReader Options m, MonadSupply m, MonadError MultipleErrors m) => Module Ann -> Maybe AST -> m [AST]
-- | A collection of modules related to code generation:
--
--
-- - Language.PureScript.CodeGen.JS Code generator for
-- JavaScript
--
module Language.PureScript.CodeGen
-- | Dump the core functional representation in JSON format for consumption
-- by third-party code generators
module Language.PureScript.CoreFn.ToJSON
moduleToJSON :: Version -> Module a -> Value
-- | Renaming pass that prevents shadowing of local identifiers.
module Language.PureScript.Renamer
-- | Renames within each declaration in a module.
renameInModules :: [Module Ann] -> [Module Ann]
-- | Type class entailment
module Language.PureScript.TypeChecker.Entailment
-- | The InstanceContext tracks those constraints which can be
-- satisfied.
type InstanceContext = Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) 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, Constraint)])
-- | 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 -> Constraint -> 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 -> Constraint -> InstanceContext -> [ErrorMessageHint] -> WriterT (Any, [(Ident, InstanceContext, Constraint)]) (StateT InstanceContext m) Expr
instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.TypeChecker.Entailment.EntailsResult a)
instance GHC.Classes.Eq Language.PureScript.TypeChecker.Entailment.Evidence
instance GHC.Show.Show Language.PureScript.TypeChecker.Entailment.Evidence
module Language.PureScript.TypeChecker.TypeSearch
typeSearch :: Maybe [(Ident, InstanceContext, Constraint)] -> Environment -> CheckState -> Type -> ([(Qualified Text, Type)], Maybe [(Label, Type)])
-- | This module implements the type checker
module Language.PureScript.TypeChecker.Types
data BindingGroupType
RecursiveBindingGroup :: BindingGroupType
NonRecursiveBindingGroup :: BindingGroupType
-- | Infer the types of multiple mutually-recursive values, and return
-- elaborated values including type class dictionaries and type
-- annotations.
typesOf :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => BindingGroupType -> ModuleName -> [(Ident, Expr)] -> m [(Ident, (Expr, Type))]
instance GHC.Classes.Ord Language.PureScript.TypeChecker.Types.BindingGroupType
instance GHC.Classes.Eq Language.PureScript.TypeChecker.Types.BindingGroupType
instance GHC.Show.Show Language.PureScript.TypeChecker.Types.BindingGroupType
-- | The top-level type checker, which checks all declarations in a module.
module Language.PureScript.TypeChecker
-- | Type check an entire module and ensure all types and classes defined
-- within the module that are required by exported members are also
-- exported.
typeCheckModule :: forall m. (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Module -> m Module
checkNewtype :: forall m. MonadError MultipleErrors m => ProperName TypeName -> [(ProperName ConstructorName, [Type])] -> m ()
-- | 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, MonadWriter MultipleErrors m, MonadSupply m) => [ExternsFile] -> Module -> m Module
instance GHC.Show.Show Language.PureScript.Sugar.TypeClasses.Deriving.NewtypeDerivedInstances
instance GHC.Base.Monoid Language.PureScript.Sugar.TypeClasses.Deriving.NewtypeDerivedInstances
-- | Desugaring passes
module Language.PureScript.Sugar
-- | The desugaring pipeline proceeds as follows:
--
--
-- - Remove signed literals in favour of negate
-- applications
-- - Desugar object literals with wildcards into lambdas
-- - Desugar operator sections
-- - Desugar do-notation
-- - Desugar top-level case declarations into explicit case
-- expressions
-- - Desugar type declarations into value declarations with explicit
-- type annotations
-- - Qualify any unqualified names and types
-- - Rebracket user-defined binary operators
-- - Introduce type synonyms for type class dictionaries
-- - Group mutually recursive value and data declarations into binding
-- groups.
--
desugar :: (MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
-- | A replacement for WriterT IO which uses mutable references.
module Control.Monad.Logger
-- | A replacement for WriterT IO which uses mutable references.
newtype Logger w a
Logger :: (IORef w -> IO a) -> Logger w a
[runLogger] :: Logger w a -> IORef w -> IO a
-- | Run a Logger computation, starting with an empty log.
runLogger' :: (Monoid w) => Logger w a -> IO (a, w)
instance GHC.Base.Functor (Control.Monad.Logger.Logger w)
instance GHC.Base.Monoid w => GHC.Base.Applicative (Control.Monad.Logger.Logger w)
instance GHC.Base.Monoid w => GHC.Base.Monad (Control.Monad.Logger.Logger w)
instance GHC.Base.Monoid w => Control.Monad.IO.Class.MonadIO (Control.Monad.Logger.Logger w)
instance GHC.Base.Monoid w => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Logger.Logger w)
instance GHC.Base.Monoid w => Control.Monad.Base.MonadBase GHC.Types.IO (Control.Monad.Logger.Logger w)
instance GHC.Base.Monoid w => Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO (Control.Monad.Logger.Logger w)
module Language.PureScript.Make
-- | Determines when to rebuild a module
data RebuildPolicy
-- | Never rebuild this module
RebuildNever :: RebuildPolicy
-- | Always rebuild this module
RebuildAlways :: RebuildPolicy
-- | Progress messages from the make process
data ProgressMessage
-- | Compilation started for the specified module
CompilingModule :: ModuleName -> ProgressMessage
-- | Render a progress message
renderProgressMessage :: ProgressMessage -> String
-- | Actions that require implementations when running in "make" mode.
--
-- This type exists to make two things abstract:
--
--
-- - The particular backend being used (JavaScript, C++11, etc.)
-- - The details of how files are read/written etc.
--
data MakeActions m
MakeActions :: (ModuleName -> m (Either RebuildPolicy (Maybe UTCTime))) -> (ModuleName -> m (Maybe UTCTime)) -> (ModuleName -> m (FilePath, Externs)) -> (Module Ann -> Environment -> Externs -> SupplyT m ()) -> (ProgressMessage -> m ()) -> MakeActions m
-- | Get the timestamp for the input file(s) for a module. If there are
-- multiple files (.purs and foreign files, for example) the
-- timestamp should be for the most recently modified file.
[getInputTimestamp] :: MakeActions m -> ModuleName -> m (Either RebuildPolicy (Maybe UTCTime))
-- | Get the timestamp for the output files for a module. This should be
-- the timestamp for the oldest modified file, or Nothing if any
-- of the required output files are missing.
[getOutputTimestamp] :: MakeActions m -> ModuleName -> m (Maybe UTCTime)
-- | Read the externs file for a module as a string and also return the
-- actual path for the file.
[readExterns] :: MakeActions m -> ModuleName -> m (FilePath, Externs)
-- | Run the code generator for the module and write any required output
-- files.
[codegen] :: MakeActions m -> Module Ann -> Environment -> Externs -> SupplyT m ()
-- | Respond to a progress update.
[progress] :: MakeActions m -> ProgressMessage -> m ()
-- | Generated code for an externs file.
type Externs = ByteString
-- | Rebuild a single module.
--
-- This function is used for fast-rebuild workflows (PSCi and psc-ide are
-- examples).
rebuildModule :: forall m. (Monad m, MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [ExternsFile] -> Module -> m ExternsFile
-- | Compiles in "make" mode, compiling each module separately to a
-- .js file and an externs.json file.
--
-- If timestamps have not changed, the externs file can be used to
-- provide the module's types without having to typecheck the module
-- again.
make :: forall m. (Monad m, MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [Module] -> m [ExternsFile]
-- | 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, by specifying how IO
-- errors should be rendered as ErrorMessage values.
makeIO :: (IOError -> ErrorMessage) -> IO a -> Make a
-- | Read a text file in the Make monad, capturing any errors using
-- the MonadError instance.
readTextFile :: FilePath -> Make ByteString
-- | 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
-- | 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)
instance Control.Monad.Reader.Class.MonadReader Language.PureScript.Options.Options Language.PureScript.Make.Make
instance Control.Monad.Writer.Class.MonadWriter Language.PureScript.Errors.MultipleErrors Language.PureScript.Make.Make
instance Control.Monad.Error.Class.MonadError Language.PureScript.Errors.MultipleErrors Language.PureScript.Make.Make
instance Control.Monad.IO.Class.MonadIO Language.PureScript.Make.Make
instance GHC.Base.Monad Language.PureScript.Make.Make
instance GHC.Base.Applicative Language.PureScript.Make.Make
instance GHC.Base.Functor Language.PureScript.Make.Make
instance GHC.Classes.Ord Language.PureScript.Make.RebuildPolicy
instance GHC.Classes.Eq Language.PureScript.Make.RebuildPolicy
instance GHC.Show.Show Language.PureScript.Make.RebuildPolicy
instance GHC.Classes.Ord Language.PureScript.Make.ProgressMessage
instance GHC.Classes.Eq Language.PureScript.Make.ProgressMessage
instance GHC.Show.Show Language.PureScript.Make.ProgressMessage
instance Control.Monad.Base.MonadBase GHC.Types.IO Language.PureScript.Make.Make
instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO Language.PureScript.Make.Make
-- | The main compiler module
module Language.PureScript
version :: Version
module Language.PureScript.Docs.Types
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
data NotYetKnown
NotYetKnown :: NotYetKnown
type UploadedPackage = Package NotYetKnown
type VerifiedPackage = Package GithubUser
type ManifestError = BowerError
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
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 Declaration
Declaration :: Text -> Maybe Text -> Maybe SourceSpan -> [ChildDeclaration] -> DeclarationInfo -> Declaration
[declTitle] :: Declaration -> Text
[declComments] :: Declaration -> Maybe Text
[declSourceSpan] :: Declaration -> Maybe SourceSpan
[declChildren] :: Declaration -> [ChildDeclaration]
[declInfo] :: Declaration -> DeclarationInfo
-- | A value of this type contains information that is specific to a
-- particular kind of declaration (as opposed to information which exists
-- in all kinds of declarations, which goes into the Declaration
-- type directly).
--
-- Many of the constructors are very similar to their equivalents in the
-- real PureScript AST, except that they have their name elided, since
-- this is already available via the rdTitle field of Declaration.
data DeclarationInfo
-- | A value declaration, with its type.
ValueDeclaration :: Type -> DeclarationInfo
-- | A data/newtype declaration, with the kind of declaration (data or
-- newtype) and its type arguments. Constructors are represented as child
-- declarations.
DataDeclaration :: DataDeclType -> [(Text, Maybe Kind)] -> DeclarationInfo
-- | A data type foreign import, with its kind.
ExternDataDeclaration :: Kind -> DeclarationInfo
-- | A type synonym, with its type arguments and its type.
TypeSynonymDeclaration :: [(Text, Maybe Kind)] -> 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 Kind)] -> [Constraint] -> [([Text], [Text])] -> DeclarationInfo
-- | An operator alias declaration, with the member the alias is for and
-- the operator's fixity.
AliasDeclaration :: Fixity -> FixityAlias -> DeclarationInfo
-- | A kind declaration
ExternKindDeclaration :: DeclarationInfo
convertFundepsToStrings :: [(Text, Maybe Kind)] -> [FunctionalDependency] -> [([Text], [Text])]
declInfoToString :: DeclarationInfo -> Text
declInfoNamespace :: DeclarationInfo -> Namespace
isTypeClass :: Declaration -> Bool
isValue :: Declaration -> Bool
isType :: Declaration -> Bool
isValueAlias :: Declaration -> Bool
isTypeAlias :: Declaration -> Bool
isKind :: Declaration -> Bool
-- | Discard any children which do not satisfy the given predicate.
filterChildren :: (ChildDeclaration -> Bool) -> Declaration -> Declaration
data ChildDeclaration
ChildDeclaration :: Text -> Maybe Text -> Maybe SourceSpan -> ChildDeclarationInfo -> ChildDeclaration
[cdeclTitle] :: ChildDeclaration -> Text
[cdeclComments] :: ChildDeclaration -> Maybe Text
[cdeclSourceSpan] :: ChildDeclaration -> Maybe SourceSpan
[cdeclInfo] :: ChildDeclaration -> ChildDeclarationInfo
data ChildDeclarationInfo
-- | A type instance declaration, with its dependencies and its type.
ChildInstance :: [Constraint] -> Type -> ChildDeclarationInfo
-- | A data constructor, with its type arguments.
ChildDataConstructor :: [Type] -> ChildDeclarationInfo
-- | A type class member, with its type. Note that the type does not
-- include the type class constraint; this may be added manually if
-- desired. For example, pure from Applicative would be
-- `forall a. a -> f a`.
ChildTypeClassMember :: Type -> ChildDeclarationInfo
childDeclInfoToString :: ChildDeclarationInfo -> Text
childDeclInfoNamespace :: ChildDeclarationInfo -> Namespace
isTypeClassMember :: ChildDeclaration -> Bool
isDataConstructor :: ChildDeclaration -> Bool
newtype GithubUser
GithubUser :: Text -> GithubUser
[runGithubUser] :: GithubUser -> Text
newtype GithubRepo
GithubRepo :: Text -> GithubRepo
[runGithubRepo] :: GithubRepo -> Text
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
InvalidTime :: PackageError
data InPackage a
Local :: a -> InPackage a
FromDep :: PackageName -> a -> InPackage a
takeLocal :: InPackage a -> Maybe a
takeLocals :: [InPackage a] -> [a]
ignorePackage :: InPackage a -> a
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 DocLink
DocLink :: LinkLocation -> Text -> Namespace -> DocLink
[linkLocation] :: DocLink -> LinkLocation
[linkTitle] :: DocLink -> Text
[linkNamespace] :: DocLink -> Namespace
data LinkLocation
-- | A link to a declaration in the same module.
SameModule :: LinkLocation
-- | A link to a declaration in a different module, but still in the
-- current package; we need to store the current module and the other
-- declaration's module.
LocalModule :: ModuleName -> ModuleName -> LinkLocation
-- | A link to a declaration in a different package. We store: current
-- module name, name of the other package, version of the other package,
-- and name of the module in the other package that the declaration is
-- in.
DepsModule :: ModuleName -> 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 (at the time of writing, this will only ever be
-- Prim).
BuiltinModule :: ModuleName -> LinkLocation
-- | 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
parseUploadedPackage :: Version -> LByteString -> Either (ParseError PackageError) UploadedPackage
parseVerifiedPackage :: Version -> LByteString -> Either (ParseError PackageError) VerifiedPackage
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
asVerifiedPackage :: Version -> Parse PackageError VerifiedPackage
displayPackageError :: PackageError -> Text
asGithubUser :: Parse e GithubUser
asVersion :: Parse PackageError Version
parseVersion' :: String -> Maybe Version
asModule :: Parse PackageError Module
asDeclaration :: Parse PackageError Declaration
asReExport :: Parse PackageError (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
asTypeArguments :: Parse PackageError [(Text, Maybe Kind)]
asKind :: Parse PackageError Kind
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))
asQualifiedIdent :: Parse e (Qualified Ident)
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
-- | Given a function for turning association list keys into JSON object
-- keys, and a function for turning association list values to JSON
-- string values, turns an association list into a JSON object.
--
-- For example: assocListToJSON T.pack T.pack [("a", "b")] will
-- give {"a": "b"}.
assocListToJSON :: (a -> Text) -> (b -> Text) -> [(a, b)] -> Value
instance GHC.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 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.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.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.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.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.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.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.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.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.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.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.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.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 Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Docs.Types.Package a)
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.NotYetKnown
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.Module
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.Declaration
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.DeclarationInfo
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.ChildDeclaration
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.ChildDeclarationInfo
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.GithubUser
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.GithubRepo
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.PackageError
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Docs.Types.InPackage a)
instance GHC.Base.Functor Language.PureScript.Docs.Types.InPackage
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.LinksContext
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.DocLink
instance Control.DeepSeq.NFData Language.PureScript.Docs.Types.LinkLocation
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Docs.Types.NotYetKnown
instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Docs.Types.Package a)
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Docs.Types.GithubUser
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Docs.Types.Package a)
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.NotYetKnown
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.Module
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.Declaration
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.ChildDeclaration
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.DeclarationInfo
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.ChildDeclarationInfo
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.GithubUser
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Docs.Types.GithubRepo
instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Docs.Types.InPackage a)
module Language.PureScript.Docs.Convert.ReExports
-- | Given:
--
--
-- - The Imports/Exports Env
-- - An order to traverse the modules (which must be topological)
-- - A map of modules, indexed by their names, which are assumed to not
-- have their re-exports listed yet
--
--
-- This function adds all the missing re-exports.
updateReExports :: Env -> [ModuleName] -> (ModuleName -> InPackage ModuleName) -> Map ModuleName Module -> Map ModuleName Module
instance GHC.Show.Show Language.PureScript.Docs.Convert.ReExports.TypeClassEnv
instance GHC.Base.Monoid Language.PureScript.Docs.Convert.ReExports.TypeClassEnv
module Language.PureScript.Docs.Convert.Single
-- | Convert a single Module, but ignore re-exports; any re-exported types
-- or values will not appear in the result.
convertSingleModule :: Module -> Module
-- | Functions for converting PureScript ASTs into values of the data types
-- from Language.PureScript.Docs.
module Language.PureScript.Docs.Convert
-- | Convert a group of modules to the intermediate format, designed for
-- producing documentation from.
--
-- Note that the whole module dependency graph must be included in the
-- list; if some modules import things from other modules, then those
-- modules must also be included.
--
-- For value declarations, if explicit type signatures are omitted, or a
-- wildcard type is used, then we typecheck the modules and use the
-- inferred types.
convertModules :: (MonadError MultipleErrors m) => (ModuleName -> InPackage ModuleName) -> [Module] -> m [Module]
convertModulesWithEnv :: (MonadError MultipleErrors m) => (ModuleName -> InPackage ModuleName) -> [Module] -> m ([Module], Env)
-- | Like convertModules, except that it takes a list of modules, together
-- with their dependency status, and discards dependency modules in the
-- resulting documentation.
convertModulesInPackage :: (MonadError MultipleErrors m) => [Module] -> Map ModuleName PackageName -> m [Module]
convertModulesInPackageWithEnv :: (MonadError MultipleErrors m) => [Module] -> Map ModuleName PackageName -> m ([Module], Env)
module Language.PureScript.Docs.ParseInPackage
-- | Given:
--
--
-- - A list of local source files
-- - A list of source files from external dependencies, together with
-- their package names
--
--
-- This function does the following:
--
--
-- - Parse all of the input and dependency source files
-- - Associate each dependency module with its package name, thereby
-- distinguishing these from local modules
-- - Return the parsed modules and a Map mapping module names to
-- package names for modules which come from dependencies. If a module
-- does not exist in the map, it can safely be assumed to be local.
--
parseFilesInPackages :: (MonadError MultipleErrors m, MonadIO m) => [FilePath] -> [(PackageName, FilePath)] -> m ([Module], Map ModuleName PackageName)
-- | This module provides documentation for the builtin Prim module.
module Language.PureScript.Docs.Prim
primDocsModule :: Module
-- | Functions for creating RenderedCode values from data types in
-- Language.PureScript.Docs.Types.
--
-- These functions are the ones that are used in markdown/html
-- documentation generation, but the intention is that you are able to
-- supply your own instead if necessary. For example, the Hoogle input
-- file generator substitutes some of these
module Language.PureScript.Docs.Render
renderDeclaration :: Declaration -> RenderedCode
renderDeclarationWithOptions :: RenderTypeOptions -> Declaration -> RenderedCode
renderChildDeclaration :: ChildDeclaration -> RenderedCode
renderChildDeclarationWithOptions :: RenderTypeOptions -> ChildDeclaration -> RenderedCode
renderConstraint :: Constraint -> RenderedCode
renderConstraintWithOptions :: RenderTypeOptions -> Constraint -> RenderedCode
renderConstraints :: [Constraint] -> Maybe RenderedCode
renderConstraintsWithOptions :: RenderTypeOptions -> [Constraint] -> Maybe RenderedCode
notQualified :: Text -> Qualified (ProperName a)
ident' :: Text -> RenderedCode
dataCtor' :: Text -> RenderedCode
typeApp :: Text -> [(Text, Maybe Kind)] -> Type
toTypeVar :: (Text, Maybe Kind) -> Type
-- | Data types and functions for rendering generated documentation from
-- PureScript code, in a variety of formats.
module Language.PureScript.Docs
-- | 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 :: ModuleName -> (Namespace -> Text -> ContainingModule -> Maybe DocLink) -> (DocLink -> Text) -> (SourceSpan -> Maybe Text) -> HtmlRenderContext
[currentModuleName] :: HtmlRenderContext -> ModuleName
[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 :: ModuleName -> HtmlRenderContext
declNamespace :: Declaration -> Namespace
packageAsHtml :: (ModuleName -> HtmlRenderContext) -> Package a -> HtmlOutput Html
moduleAsHtml :: 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.HtmlOutput
instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Docs.AsHtml.HtmlOutput a)
instance GHC.Base.Functor Language.PureScript.Docs.AsHtml.HtmlOutputModule
instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Docs.AsHtml.HtmlOutputModule a)
module Language.PureScript.Docs.AsMarkdown
-- | Take a list of modules and render them all in order, returning a
-- single Markdown-formatted Text.
renderModulesAsMarkdown :: (MonadError MultipleErrors m) => [Module] -> m Text
type Docs = Writer [Text] ()
runDocs :: Docs -> Text
modulesAsMarkdown :: [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
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 -> 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
data JSONResult
JSONResult :: [JSONError] -> [JSONError] -> JSONResult
[warnings] :: JSONResult -> [JSONError]
[errors] :: JSONResult -> [JSONError]
toJSONErrors :: Bool -> Level -> MultipleErrors -> [JSONError]
toJSONError :: Bool -> Level -> ErrorMessage -> JSONError
instance Data.Aeson.Types.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.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.ErrorPosition
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Errors.JSON.ErrorPosition
instance GHC.Classes.Eq Language.PureScript.Errors.JSON.JSONResult
instance GHC.Show.Show Language.PureScript.Errors.JSON.JSONResult
instance GHC.Classes.Eq Language.PureScript.Errors.JSON.JSONError
instance GHC.Show.Show Language.PureScript.Errors.JSON.JSONError
instance GHC.Classes.Eq Language.PureScript.Errors.JSON.ErrorSuggestion
instance GHC.Show.Show Language.PureScript.Errors.JSON.ErrorSuggestion
instance GHC.Classes.Ord Language.PureScript.Errors.JSON.ErrorPosition
instance GHC.Classes.Eq Language.PureScript.Errors.JSON.ErrorPosition
instance GHC.Show.Show Language.PureScript.Errors.JSON.ErrorPosition
-- | 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
IdeDeclKind :: (ProperName KindName) -> IdeDeclaration
data IdeValue
IdeValue :: Ident -> Type -> IdeValue
[_ideValueIdent] :: IdeValue -> Ident
[_ideValueType] :: IdeValue -> Type
data IdeType
IdeType :: ProperName TypeName -> Kind -> IdeType
[_ideTypeName] :: IdeType -> ProperName TypeName
[_ideTypeKind] :: IdeType -> Kind
data IdeTypeSynonym
IdeTypeSynonym :: ProperName TypeName -> Type -> Kind -> IdeTypeSynonym
[_ideSynonymName] :: IdeTypeSynonym -> ProperName TypeName
[_ideSynonymType] :: IdeTypeSynonym -> Type
[_ideSynonymKind] :: IdeTypeSynonym -> Kind
data IdeDataConstructor
IdeDataConstructor :: ProperName ConstructorName -> ProperName TypeName -> Type -> IdeDataConstructor
[_ideDtorName] :: IdeDataConstructor -> ProperName ConstructorName
[_ideDtorTypeName] :: IdeDataConstructor -> ProperName TypeName
[_ideDtorType] :: IdeDataConstructor -> Type
data IdeTypeClass
IdeTypeClass :: ProperName ClassName -> Kind -> [IdeInstance] -> IdeTypeClass
[_ideTCName] :: IdeTypeClass -> ProperName ClassName
[_ideTCKind] :: IdeTypeClass -> Kind
[_ideTCInstances] :: IdeTypeClass -> [IdeInstance]
data IdeInstance
IdeInstance :: ModuleName -> Ident -> [Type] -> Maybe [Constraint] -> IdeInstance
[_ideInstanceModule] :: IdeInstance -> ModuleName
[_ideInstanceName] :: IdeInstance -> Ident
[_ideInstanceTypes] :: IdeInstance -> [Type]
[_ideInstanceConstraints] :: IdeInstance -> Maybe [Constraint]
data IdeValueOperator
IdeValueOperator :: OpName ValueOpName -> Qualified (Either Ident (ProperName ConstructorName)) -> Precedence -> Associativity -> Maybe Type -> IdeValueOperator
[_ideValueOpName] :: IdeValueOperator -> OpName ValueOpName
[_ideValueOpAlias] :: IdeValueOperator -> Qualified (Either Ident (ProperName ConstructorName))
[_ideValueOpPrecedence] :: IdeValueOperator -> Precedence
[_ideValueOpAssociativity] :: IdeValueOperator -> Associativity
[_ideValueOpType] :: IdeValueOperator -> Maybe Type
data IdeTypeOperator
IdeTypeOperator :: OpName TypeOpName -> Qualified (ProperName TypeName) -> Precedence -> Associativity -> Maybe Kind -> IdeTypeOperator
[_ideTypeOpName] :: IdeTypeOperator -> OpName TypeOpName
[_ideTypeOpAlias] :: IdeTypeOperator -> Qualified (ProperName TypeName)
[_ideTypeOpPrecedence] :: IdeTypeOperator -> Precedence
[_ideTypeOpAssociativity] :: IdeTypeOperator -> Associativity
[_ideTypeOpKind] :: IdeTypeOperator -> Maybe Kind
_IdeDeclKind :: Prism' IdeDeclaration (ProperName KindName)
_IdeDeclTypeOperator :: Prism' IdeDeclaration IdeTypeOperator
_IdeDeclValueOperator :: Prism' IdeDeclaration IdeValueOperator
_IdeDeclTypeClass :: Prism' IdeDeclaration IdeTypeClass
_IdeDeclDataConstructor :: Prism' IdeDeclaration IdeDataConstructor
_IdeDeclTypeSynonym :: Prism' IdeDeclaration IdeTypeSynonym
_IdeDeclType :: Prism' IdeDeclaration IdeType
_IdeDeclValue :: Prism' IdeDeclaration IdeValue
ideValueType :: Lens' IdeValue Type
ideValueIdent :: Lens' IdeValue Ident
ideTypeName :: Lens' IdeType (ProperName TypeName)
ideTypeKind :: Lens' IdeType Kind
ideSynonymType :: Lens' IdeTypeSynonym Type
ideSynonymName :: Lens' IdeTypeSynonym (ProperName TypeName)
ideSynonymKind :: Lens' IdeTypeSynonym Kind
ideDtorTypeName :: Lens' IdeDataConstructor (ProperName TypeName)
ideDtorType :: Lens' IdeDataConstructor Type
ideDtorName :: Lens' IdeDataConstructor (ProperName ConstructorName)
ideTCName :: Lens' IdeTypeClass (ProperName ClassName)
ideTCKind :: Lens' IdeTypeClass Kind
ideTCInstances :: Lens' IdeTypeClass [IdeInstance]
ideInstanceTypes :: Lens' IdeInstance [Type]
ideInstanceName :: Lens' IdeInstance Ident
ideInstanceModule :: Lens' IdeInstance ModuleName
ideInstanceConstraints :: Lens' IdeInstance (Maybe [Constraint])
ideValueOpType :: Lens' IdeValueOperator (Maybe Type)
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 Kind)
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 Type -> Annotation
[_annLocation] :: Annotation -> Maybe SourceSpan
[_annExportedFrom] :: Annotation -> Maybe ModuleName
[_annTypeAnnotation] :: Annotation -> Maybe Type
annTypeAnnotation :: Lens' Annotation (Maybe Type)
annLocation :: Lens' Annotation (Maybe SourceSpan)
annExportedFrom :: Lens' Annotation (Maybe ModuleName)
idaDeclaration :: Lens' IdeDeclarationAnn IdeDeclaration
idaAnnotation :: Lens' IdeDeclarationAnn Annotation
emptyAnn :: Annotation
type DefinitionSites a = Map IdeNamespaced a
type TypeAnnotations = Map Ident Type
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 -> IdeEnvironment
[ideStateVar] :: IdeEnvironment -> TVar IdeState
[ideConfiguration] :: IdeEnvironment -> IdeConfiguration
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] -> Completion
[complModule] :: Completion -> Text
[complIdentifier] :: Completion -> Text
[complType] :: Completion -> Text
[complExpandedType] :: Completion -> Text
[complLocation] :: Completion -> Maybe SourceSpan
[complDocumentation] :: Completion -> Maybe Text
[complExportedFrom] :: Completion -> [ModuleName]
identifierFromDeclarationRef :: DeclarationRef -> Text
data Success
CompletionResult :: [Completion] -> Success
TextResult :: Text -> Success
MultilineTextResult :: [Text] -> Success
PursuitResult :: [PursuitResponse] -> 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
newtype PursuitQuery
PursuitQuery :: Text -> PursuitQuery
data PursuitSearchType
Package :: PursuitSearchType
Identifier :: PursuitSearchType
data PursuitResponse
-- | A Pursuit Response for a module. Consists of the modules name and the
-- package it belongs to
ModuleResponse :: ModuleIdent -> Text -> PursuitResponse
-- | A Pursuit Response for a declaration. Consist of the declaration's
-- module, name, package, type summary text
DeclarationResponse :: Text -> ModuleIdent -> Text -> (Maybe Text) -> Text -> PursuitResponse
-- | Denotes the different namespaces a name in PureScript can reside in.
data IdeNamespace
IdeNSValue :: IdeNamespace
IdeNSType :: IdeNamespace
IdeNSKind :: IdeNamespace
-- | A name tagged with a namespace
data IdeNamespaced
IdeNamespaced :: IdeNamespace -> Text -> IdeNamespaced
instance GHC.Show.Show Language.PureScript.Ide.Types.IdeState
instance GHC.Show.Show Language.PureScript.Ide.Types.IdeVolatileState
instance Data.Foldable.Foldable Language.PureScript.Ide.Types.AstData
instance GHC.Base.Functor Language.PureScript.Ide.Types.AstData
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.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 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 GHC.Show.Show Language.PureScript.Ide.Types.Success
instance GHC.Classes.Eq Language.PureScript.Ide.Types.PursuitResponse
instance GHC.Show.Show Language.PureScript.Ide.Types.PursuitResponse
instance GHC.Classes.Eq Language.PureScript.Ide.Types.PursuitSearchType
instance GHC.Show.Show Language.PureScript.Ide.Types.PursuitSearchType
instance GHC.Classes.Eq Language.PureScript.Ide.Types.PursuitQuery
instance GHC.Show.Show Language.PureScript.Ide.Types.PursuitQuery
instance GHC.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.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.Show.Show Language.PureScript.Ide.Types.IdeFileState
instance GHC.Classes.Eq Language.PureScript.Ide.Types.IdeLogLevel
instance GHC.Show.Show Language.PureScript.Ide.Types.IdeLogLevel
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Ide.Types.Completion
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Ide.Types.Success
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Types.PursuitSearchType
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Types.PursuitQuery
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Types.PursuitResponse
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Ide.Types.PursuitResponse
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Types.IdeNamespace
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 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 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
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 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 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 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 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 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 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 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
-- | Error types for psc-ide
module Language.PureScript.Ide.Error
data IdeError
GeneralError :: Text -> IdeError
NotFound :: Text -> IdeError
ModuleNotFound :: ModuleIdent -> IdeError
ModuleFileNotFound :: ModuleIdent -> IdeError
ParseError :: ParseError -> Text -> IdeError
RebuildError :: MultipleErrors -> IdeError
prettyPrintTypeSingleLine :: Type -> Text
instance GHC.Show.Show Language.PureScript.Ide.Error.IdeError
instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Ide.Error.IdeError
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
-- | Pursuit client for psc-ide
module Language.PureScript.Ide.Pursuit
searchPursuitForDeclarations :: Text -> IO [PursuitResponse]
findPackagesForModuleIdent :: Text -> IO [PursuitResponse]
-- | Generally useful functions
module Language.PureScript.Ide.Util
identifierFromIdeDeclaration :: IdeDeclaration -> Text
unwrapMatch :: Match a -> a
unwrapPositioned :: Declaration -> Declaration
unwrapPositionedRef :: DeclarationRef -> DeclarationRef
namespaceForDeclaration :: IdeDeclaration -> IdeNamespace
encodeT :: (ToJSON a) => a -> Text
decodeT :: (FromJSON a) => Text -> Maybe a
discardAnn :: IdeDeclarationAnn -> IdeDeclaration
withEmptyAnn :: IdeDeclaration -> IdeDeclarationAnn
valueOperatorAliasT :: Qualified (Either Ident (ProperName ConstructorName)) -> Text
typeOperatorAliasT :: Qualified (ProperName TypeName) -> Text
properNameT :: Iso' (ProperName a) Text
identT :: Iso' Ident Text
opNameT :: Iso' (OpName a) Text
ideReadFile :: (MonadIO m, MonadError IdeError m) => FilePath -> m Text
-- | Handles externs files for psc-ide
module Language.PureScript.Ide.Externs
readExternFile :: (MonadIO m, MonadError IdeError m, MonadLogger m) => FilePath -> m ExternsFile
convertExterns :: ExternsFile -> ([IdeDeclarationAnn], [(ModuleName, DeclarationRef)])
-- | Filters for psc-ide commands
module Language.PureScript.Ide.Filter
data Filter
-- | Only keeps Identifiers in the given Namespaces
namespaceFilter :: NonEmpty IdeNamespace -> Filter
-- | Only keeps the given Modules
moduleFilter :: [ModuleName] -> Filter
-- | Only keeps Identifiers that start with the given prefix
prefixFilter :: Text -> Filter
-- | Only keeps Identifiers that are equal to the search string
equalityFilter :: Text -> Filter
applyFilters :: [Filter] -> [Module] -> [Module]
instance GHC.Base.Monoid Language.PureScript.Ide.Filter.Filter
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Filter.Filter
-- | Matchers for psc-ide commands
module Language.PureScript.Ide.Matcher
data Matcher a
runMatcher :: Matcher a -> [Match a] -> [Match a]
-- | Matches any occurence of the search string with intersections
--
-- The scoring measures how far the matches span the string where closer
-- is better. Examples: flMa matches flexMatcher. Score: 14.28 sons
-- matches sortCompletions. Score: 6.25
flexMatcher :: Text -> Matcher IdeDeclarationAnn
instance GHC.Base.Monoid (Language.PureScript.Ide.Matcher.Matcher a)
instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Ide.Matcher.Matcher Language.PureScript.Ide.Types.IdeDeclarationAnn)
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 -> [Module] -> [Completion]
getExactMatches :: Text -> [Filter] -> [Module] -> [Match IdeDeclarationAnn]
getExactCompletions :: Text -> [Filter] -> [Module] -> [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
-- | 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.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)
-- | Getting declarations from PureScript sourcefiles
module Language.PureScript.Ide.SourceFile
parseModule :: (MonadIO m, MonadError IdeError m) => FilePath -> m (Either FilePath (FilePath, Module))
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 :: SourceSpan -> Declaration -> [(IdeNamespaced, SourceSpan)]
-- | Extracts type annotations for functions from a given Module
extractTypeAnnotations :: [Declaration] -> [(Ident, Type)]
-- | 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)
-- | Resets all State inside psc-ide
resetIdeState :: Ide m => m ()
-- | Sets rebuild cache to the given ExternsFile
cacheRebuild :: Ide m => ExternsFile -> m ()
-- | 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 [(ModuleName, [IdeDeclarationAnn])]
-- | Resolves reexports and populates VolatileState with data to be used in
-- queries.
populateVolatileState :: (Ide m, MonadLogger m) => m ()
-- | STM version of populateVolatileState
populateVolatileStateSTM :: TVar IdeState -> STM (ModuleMap (ReexportResult [IdeDeclarationAnn]))
-- | 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]
-- | 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
Pursuit :: PursuitQuery -> PursuitSearchType -> Command
[pursuitQuery] :: Command -> PursuitQuery
[pursuitSearchType] :: Command -> PursuitSearchType
CaseSplit :: Text -> Int -> Int -> WildcardAnnotations -> Text -> Command
[caseSplitLine] :: Command -> Text
[caseSplitBegin] :: Command -> Int
[caseSplitEnd] :: Command -> Int
[caseSplitAnnotations] :: Command -> WildcardAnnotations
[caseSplitType] :: Command -> Text
AddClause :: Text -> WildcardAnnotations -> Command
[addClauseLine] :: Command -> Text
[addClauseAnnotations] :: Command -> WildcardAnnotations
Import :: FilePath -> (Maybe FilePath) -> [Filter] -> ImportCommand -> Command
List :: ListType -> Command
[listType] :: Command -> ListType
-- | Rebuild the specified file using the loaded externs
Rebuild :: FilePath -> Command
-- | Rebuild the specified file using the loaded externs
RebuildSync :: FilePath -> Command
Cwd :: Command
Reset :: Command
Quit :: Command
commandName :: Command -> Text
data ImportCommand
AddImplicitImport :: ModuleName -> ImportCommand
AddQualifiedImport :: ModuleName -> ModuleName -> ImportCommand
AddImportForIdentifier :: Text -> 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.ImportCommand
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Command.ListType
instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Ide.Command.Command
-- | Provides functionality to manage imports
module Language.PureScript.Ide.Imports
-- | 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.
--
--
-- - Throws an error if the identifier cannot be found.
-- - If exactly one match is found, adds an explicit import to the
-- importsection
-- - If more than one possible imports are found, reports the
-- possibilities as a list of completions.
--
addImportForIdentifier :: (Ide m, MonadError IdeError m) => FilePath -> Text -> [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
-- | Reads a file and returns the parsed modulename 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)])
-- | Test and ghci helper
parseImport :: Text -> Maybe Import
prettyPrintImportSection :: [Import] -> [Text]
addImplicitImport' :: [Import] -> ModuleName -> [Text]
addQualifiedImport' :: [Import] -> ModuleName -> ModuleName -> [Text]
addExplicitImport' :: IdeDeclaration -> ModuleName -> [Import] -> [Import]
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.Rebuild
rebuildFileSync :: forall m. (Ide m, MonadLogger m, MonadError IdeError m) => FilePath -> m Success
rebuildFileAsync :: forall m. (Ide m, MonadLogger m, MonadError IdeError m) => FilePath -> m Success
-- | Given a filepath performs the following steps:
--
--
-- - Reads and parses a PureScript module from the filepath.
-- - Builds a dependency graph for the parsed module from the already
-- loaded ExternsFiles.
-- - Attempts to find an FFI definition file for the module by looking
-- for a file with the same filepath except for a .js extension.
-- - Passes all the created artifacts to rebuildModule.
-- - If the rebuilding succeeds, returns a RebuildSuccess with
-- the generated warnings, and if rebuilding fails, returns a
-- RebuildError with the generated errors.
--
rebuildFile :: (Ide m, MonadLogger m, MonadError IdeError m) => FilePath -> (ReaderT IdeEnvironment (LoggingT IO) () -> m ()) -> m Success
-- | Interface for the psc-ide-server
module Language.PureScript.Ide
-- | Accepts a Commmand 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
-- | File watcher for externs files
module Language.PureScript.Ide.Watcher
-- | Installs filewatchers for the given directory and reloads ExternsFiles
-- when they change on disc
watcher :: Bool -> IdeLogLevel -> TVar IdeState -> FilePath -> IO ()
module Language.PureScript.Interactive.Printer
textT :: Text -> Box
-- | Pretty print a module's signatures
printModuleSignatures :: ModuleName -> Environment -> String
-- | Type declarations and associated basic functions for PSCI.
module Language.PureScript.Interactive.Types
-- | The PSCI configuration.
--
-- These configuration values do not change during execution.
data PSCiConfig
PSCiConfig :: [FilePath] -> Environment -> PSCiConfig
[psciLoadedFiles] :: PSCiConfig -> [FilePath]
[psciEnvironment] :: PSCiConfig -> Environment
-- | The PSCI state.
--
-- Holds a list of imported modules, loaded files, and partial let
-- bindings. The let bindings are partial, because it makes more sense to
-- apply the binding to the final evaluated expression.
data PSCiState
PSCiState :: [ImportedModule] -> [Declaration] -> [(Module, ExternsFile)] -> PSCiState
[psciImportedModules] :: PSCiState -> [ImportedModule]
[psciLetBindings] :: PSCiState -> [Declaration]
[psciLoadedExterns] :: PSCiState -> [(Module, ExternsFile)]
initialPSCiState :: PSCiState
-- | All of the data that is contained by an ImportDeclaration in the AST.
-- That is:
--
--
-- - A module name, the name of the module which is being imported
-- - An ImportDeclarationType which specifies whether there is an
-- explicit import list, a hiding list, or neither.
-- - If the module is imported qualified, its qualified name in the
-- importing module. Otherwise, Nothing.
--
type ImportedModule = (ModuleName, ImportDeclarationType, Maybe ModuleName)
psciImportedModuleNames :: PSCiState -> [ModuleName]
allImportsOf :: Module -> PSCiState -> [ImportedModule]
-- | 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
-- | 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 :: Type -> Command
-- | Shows information about the current state of the REPL
ShowInfo :: ReplQuery -> Command
-- | Paste multiple lines
PasteLines :: Command
data ReplQuery
QueryLoaded :: ReplQuery
QueryImport :: 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
instance GHC.Show.Show Language.PureScript.Interactive.Types.Directive
instance GHC.Classes.Eq Language.PureScript.Interactive.Types.Directive
instance GHC.Show.Show Language.PureScript.Interactive.Types.Command
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.PSCiState
instance GHC.Show.Show Language.PureScript.Interactive.Types.PSCiConfig
-- | Directives for PSCI.
module Language.PureScript.Interactive.Directive
-- | List of all avaliable directives.
directives :: [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)]
-- | List of all directive strings.
strings :: [String]
-- | 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]
parseDirective :: String -> Maybe Directive
-- | True if the given directive takes an argument, false otherwise.
hasArgument :: Directive -> Bool
-- | The help menu.
help :: [(Directive, String, String)]
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
instance GHC.Show.Show Language.PureScript.Interactive.Completion.CompletionContext
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.Module
-- | The name of the PSCI support module
supportModuleName :: ModuleName
-- | Checks if the Console module is defined
supportModuleIsDefined :: [Module] -> Bool
-- | Loads a file for use with imports.
loadModule :: FilePath -> IO (Either String [Module])
-- | 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 -> Type -> Module
-- | Makes a volatile module to execute the current imports.
createTemporaryModuleForImports :: PSCiState -> Module
importDecl :: ImportedModule -> Declaration
indexFile :: FilePath
modulesDir :: FilePath
-- | Parser for PSCI.
module Language.PureScript.Interactive.Parser
-- | Parses PSCI metacommands or expressions input from the user.
parseCommand :: String -> Either String Command
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, 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)
module Language.PureScript.Publish.ErrorsWarnings
-- | An error which meant that it was not possible to retrieve metadata for
-- a package.
data PackageError
UserError :: UserError -> PackageError
InternalError :: InternalError -> PackageError
OtherError :: OtherError -> PackageError
data PackageWarning
NoResolvedVersion :: PackageName -> PackageWarning
UndeclaredDependency :: PackageName -> PackageWarning
UnacceptableVersion :: (PackageName, Text) -> PackageWarning
DirtyWorkingTree_Warn :: PackageWarning
MissingPath :: PackageName -> PackageWarning
-- | An error that should be fixed by the user.
data UserError
PackageManifestNotFound :: UserError
ResolutionsFileNotFound :: 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
-- | An error that probably indicates a bug in this module.
data InternalError
JSONError :: JSONSource -> (ParseError ManifestError) -> InternalError
CouldntParseGitTagDate :: Text -> InternalError
data OtherError
ProcessFailed :: String -> [String] -> IOException -> OtherError
IOExceptionThrown :: IOException -> OtherError
data RepositoryFieldError
RepositoryFieldMissing :: RepositoryFieldError
BadRepositoryType :: Text -> RepositoryFieldError
NotOnGithub :: RepositoryFieldError
data JSONSource
FromFile :: FilePath -> JSONSource
FromResolutions :: JSONSource
printError :: PackageError -> IO ()
printErrorToStdout :: PackageError -> IO ()
renderError :: PackageError -> Box
printWarnings :: [PackageWarning] -> IO ()
renderWarnings :: [PackageWarning] -> Box
instance GHC.Classes.Ord Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings
instance GHC.Classes.Eq Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings
instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings
instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.PackageError
instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.OtherError
instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.InternalError
instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.JSONSource
instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.UserError
instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.RepositoryFieldError
instance GHC.Show.Show Language.PureScript.Publish.ErrorsWarnings.PackageWarning
instance GHC.Base.Monoid Language.PureScript.Publish.ErrorsWarnings.CollectedWarnings
module Language.PureScript.Publish
-- | Attempt to retrieve package metadata from the current directory.
-- Returns a PackageError on failure
preparePackage :: FilePath -> FilePath -> PublishOptions -> IO (Either PackageError UploadedPackage)
preparePackage' :: FilePath -> FilePath -> PublishOptions -> PrepareM UploadedPackage
-- | Attempt to retrieve package metadata from the current directory. Calls
-- exitFailure if no package metadata could be retrieved.
unsafePreparePackage :: FilePath -> FilePath -> 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 () -> PublishOptions
-- | How to obtain the version tag and version that the data being
-- generated will refer to.
[publishGetVersion] :: PublishOptions -> PrepareM (Text, Version)
[publishGetTagTime] :: PublishOptions -> Text -> PrepareM UTCTime
-- | What to do when the working tree is dirty
[publishWorkingTreeDirty] :: PublishOptions -> PrepareM ()
defaultPublishOptions :: PublishOptions
getGitWorkingTreeStatus :: PrepareM TreeStatus
checkCleanWorkingTree :: PublishOptions -> PrepareM ()
getVersionFromGitTag :: PrepareM (Text, Version)
getManifestRepositoryInfo :: PackageMeta -> PrepareM (GithubUser, GithubRepo)
getModules :: [(PackageName, FilePath)] -> PrepareM ([Module], Map ModuleName PackageName)
getResolvedDependencies :: FilePath -> [PackageName] -> PrepareM [(PackageName, (FilePath, Version))]
instance GHC.Classes.Eq Language.PureScript.Publish.DependencyStatus
instance GHC.Show.Show Language.PureScript.Publish.DependencyStatus
instance GHC.Enum.Enum Language.PureScript.Publish.TreeStatus
instance GHC.Classes.Ord Language.PureScript.Publish.TreeStatus
instance GHC.Classes.Eq Language.PureScript.Publish.TreeStatus
instance GHC.Show.Show Language.PureScript.Publish.TreeStatus
instance Control.Monad.Error.Class.MonadError Language.PureScript.Publish.ErrorsWarnings.PackageError Language.PureScript.Publish.PrepareM
instance Control.Monad.Writer.Class.MonadWriter [Language.PureScript.Publish.ErrorsWarnings.PackageWarning] Language.PureScript.Publish.PrepareM
instance GHC.Base.Monad Language.PureScript.Publish.PrepareM
instance GHC.Base.Applicative Language.PureScript.Publish.PrepareM
instance GHC.Base.Functor Language.PureScript.Publish.PrepareM
instance Control.Monad.IO.Class.MonadIO Language.PureScript.Publish.PrepareM