License | BSD3 |
---|---|
Maintainer | The Idris Community. |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Idris.AbsSyntax
Description
Synopsis
- data EitherErr a b
- verbose :: Idris Int
- getContext :: Idris Context
- colourise :: Idris Bool
- getIState :: Idris IState
- runIO :: IO a -> Idris a
- type1Doc :: Doc OutputAnnotation
- typeDescription :: String
- addUsingConstraints :: SyntaxInfo -> FC -> PTerm -> Idris PTerm
- implicit :: ElabInfo -> SyntaxInfo -> Name -> PTerm -> Idris PTerm
- putIState :: IState -> Idris ()
- targetTriple :: Idris String
- targetCPU :: Idris String
- getName :: Idris Int
- forCodegen :: Codegen -> [(Codegen, a)] -> [a]
- getObjectFiles :: Codegen -> Idris [FilePath]
- addObjectFile :: Codegen -> FilePath -> Idris ()
- getLibs :: Codegen -> Idris [String]
- addLib :: Codegen -> String -> Idris ()
- getFlags :: Codegen -> Idris [String]
- addFlag :: Codegen -> String -> Idris ()
- addDyLib :: [String] -> Idris (Either DynamicLib String)
- getAutoImports :: Idris [FilePath]
- addAutoImport :: FilePath -> Idris ()
- addDefinedName :: Name -> Idris ()
- getDefinedNames :: Idris [Name]
- addTT :: Term -> Idris (Maybe Term)
- dumpTT :: Idris ()
- addHdr :: Codegen -> String -> Idris ()
- addImported :: Bool -> FilePath -> Idris ()
- addLangExt :: LanguageExt -> Idris ()
- dropLangExt :: LanguageExt -> Idris ()
- addTrans :: Name -> (Term, Term) -> Idris ()
- addErrRev :: (Term, Term) -> Idris ()
- addErrReduce :: Name -> Idris ()
- addErasureUsage :: Name -> Int -> Idris ()
- addExport :: Name -> Idris ()
- addUsedName :: FC -> Name -> Name -> Idris ()
- addIBC :: IBCWrite -> Idris ()
- getErasureUsage :: Idris [(Name, Int)]
- getExports :: Idris [Name]
- totcheck :: (FC, Name) -> Idris ()
- defer_totcheck :: (FC, Name) -> Idris ()
- clear_totcheck :: Idris ()
- setFlags :: Name -> [FnOpt] -> Idris ()
- addFnOpt :: Name -> FnOpt -> Idris ()
- setFnInfo :: Name -> FnInfo -> Idris ()
- setAccessibility :: Name -> Accessibility -> Idris ()
- getFromHideList :: Name -> Idris (Maybe Accessibility)
- setTotality :: Name -> Totality -> Idris ()
- setInjectivity :: Name -> Injectivity -> Idris ()
- getTotality :: Name -> Idris Totality
- getCoercionsTo :: IState -> Type -> [Name]
- addToCG :: Name -> CGInfo -> Idris ()
- addCalls :: Name -> [Name] -> Idris ()
- addTyInferred :: Name -> Idris ()
- addTyInfConstraints :: FC -> [(Term, Term)] -> Idris ()
- logLvl :: Int -> String -> Idris ()
- isTyInferred :: Name -> Idris Bool
- addFunctionErrorHandlers :: Name -> Name -> [Name] -> Idris ()
- getAllNames :: Name -> Idris [Name]
- getCGAllNames :: IState -> Name -> Maybe [Name]
- allNames :: [Name] -> Name -> Idris [Name]
- addCGAllNames :: IState -> Name -> [Name] -> Idris ()
- addCoercion :: Name -> Idris ()
- addDocStr :: Name -> Docstring DocTerm -> [(Name, Docstring DocTerm)] -> Idris ()
- addNameHint :: Name -> Name -> Idris ()
- getNameHints :: IState -> Name -> [Name]
- addDeprecated :: Name -> String -> Idris ()
- getDeprecated :: Name -> Idris (Maybe String)
- addFragile :: Name -> String -> Idris ()
- getFragile :: Name -> Idris (Maybe String)
- push_estack :: Name -> Bool -> Idris ()
- pop_estack :: Idris ()
- addImplementation :: Bool -> Bool -> Name -> Name -> Idris ()
- addOpenImpl :: [Name] -> Idris [Name]
- setOpenImpl :: [Name] -> Idris ()
- getOpenImpl :: Idris [Name]
- addInterface :: Name -> InterfaceInfo -> Idris ()
- updateIMethods :: Name -> [(Name, PTerm)] -> Idris ()
- addRecord :: Name -> RecordInfo -> Idris ()
- addAutoHint :: Name -> Name -> Idris ()
- getAutoHints :: Name -> Idris [Name]
- clearIBC :: Idris ()
- resetNameIdx :: Idris ()
- addNameIdx :: Name -> Idris (Int, Name)
- addNameIdx' :: IState -> Name -> (IState, (Int, Name))
- getSymbol :: Name -> Idris Name
- getHdrs :: Codegen -> Idris [String]
- getImported :: Idris [(FilePath, Bool)]
- setErrSpan :: FC -> Idris ()
- clearErr :: Idris ()
- getSO :: Idris (Maybe String)
- setSO :: Maybe String -> Idris ()
- updateIState :: (IState -> IState) -> Idris ()
- withContext :: (IState -> Ctxt a) -> Name -> b -> (a -> Idris b) -> Idris b
- withContext_ :: (IState -> Ctxt a) -> Name -> (a -> Idris ()) -> Idris ()
- addInternalApp :: FilePath -> Int -> PTerm -> Idris ()
- getInternalApp :: FilePath -> Int -> Idris PTerm
- clearOrigPats :: Idris ()
- clearPTypes :: Idris ()
- checkUndefined :: FC -> Name -> Idris ()
- isUndefined :: FC -> Name -> Idris Bool
- setContext :: Context -> Idris ()
- updateContext :: (Context -> Context) -> Idris ()
- addConstraints :: FC -> (Int, [UConstraint]) -> Idris ()
- typeInType :: Idris Bool
- addDeferred :: [(Name, (Int, Maybe Name, Type, [Name], Bool, Bool))] -> Idris ()
- addDeferred' :: NameType -> [(Name, (Int, Maybe Name, Type, [Name], Bool, Bool))] -> Idris ()
- addDeferredTyCon :: [(Name, (Int, Maybe Name, Type, [Name], Bool, Bool))] -> Idris ()
- solveDeferred :: FC -> Name -> Idris ()
- getUndefined :: Idris [Name]
- isMetavarName :: Name -> IState -> Bool
- getWidth :: Idris ConsoleWidth
- setWidth :: ConsoleWidth -> Idris ()
- setDepth :: Maybe Int -> Idris ()
- isetPrompt :: String -> Idris ()
- isetLoadedRegion :: Idris ()
- setLogLevel :: Int -> Idris ()
- setLogCats :: [LogCat] -> Idris ()
- setCmdLine :: [Opt] -> Idris ()
- getCmdLine :: Idris [Opt]
- getDumpHighlighting :: Idris Bool
- getDumpDefun :: Idris (Maybe FilePath)
- getDumpCases :: Idris (Maybe FilePath)
- logLevel :: Idris Int
- setAutoImpls :: Bool -> Idris ()
- getAutoImpls :: Idris Bool
- setErrContext :: Bool -> Idris ()
- errContext :: Idris Bool
- getOptimise :: Idris [Optimisation]
- setOptimise :: [Optimisation] -> Idris ()
- addOptimise :: Optimisation -> Idris ()
- removeOptimise :: Optimisation -> Idris ()
- setOptLevel :: Int -> Idris ()
- useREPL :: Idris Bool
- setREPL :: Bool -> Idris ()
- showOrigErr :: Idris Bool
- setShowOrigErr :: Bool -> Idris ()
- setAutoSolve :: Bool -> Idris ()
- setNoBanner :: Bool -> Idris ()
- getNoBanner :: Idris Bool
- setEvalTypes :: Bool -> Idris ()
- getDesugarNats :: Idris Bool
- setDesugarNats :: Bool -> Idris ()
- setQuiet :: Bool -> Idris ()
- getQuiet :: Idris Bool
- setCodegen :: Codegen -> Idris ()
- codegen :: Idris Codegen
- setOutputTy :: OutputType -> Idris ()
- outputTy :: Idris OutputType
- setIdeMode :: Bool -> Handle -> Idris ()
- setTargetTriple :: String -> Idris ()
- setTargetCPU :: String -> Idris ()
- setVerbose :: Int -> Idris ()
- iReport :: Int -> String -> Idris ()
- setTypeInType :: Bool -> Idris ()
- coverage :: Idris Bool
- setCoverage :: Bool -> Idris ()
- setIBCSubDir :: FilePath -> Idris ()
- valIBCSubDir :: IState -> Idris FilePath
- addImportDir :: FilePath -> Idris ()
- setImportDirs :: [FilePath] -> Idris ()
- allImportDirs :: Idris [FilePath]
- rankedImportDirs :: FilePath -> Idris [FilePath]
- addSourceDir :: FilePath -> Idris ()
- setSourceDirs :: [FilePath] -> Idris ()
- allSourceDirs :: Idris [FilePath]
- setColourise :: Bool -> Idris ()
- impShow :: Idris Bool
- setImpShow :: Bool -> Idris ()
- setColour :: ColourType -> IdrisColour -> Idris ()
- logLvlCats :: [LogCat] -> Int -> String -> Idris ()
- logCoverage :: Int -> String -> Idris ()
- logErasure :: Int -> String -> Idris ()
- logParser :: Int -> String -> Idris ()
- logElab :: Int -> String -> Idris ()
- logCodeGen :: Int -> String -> Idris ()
- logIBC :: Int -> String -> Idris ()
- cmdOptType :: Opt -> Idris Bool
- noErrors :: Idris Bool
- setTypeCase :: Bool -> Idris ()
- getIndentWith :: Idris Int
- setIndentWith :: Int -> Idris ()
- getIndentClause :: Idris Int
- setIndentClause :: Int -> Idris ()
- expandParams :: (Name -> Name) -> [(Name, PTerm)] -> [Name] -> [Name] -> PTerm -> PTerm
- shadow :: Name -> Name -> PTerm -> PTerm
- expandParamsD :: Bool -> IState -> (Name -> Name) -> [(Name, PTerm)] -> [Name] -> PDecl -> PDecl
- mapsnd :: (t -> b) -> (a, t) -> (a, b)
- expandImplementationScope :: p -> p -> [(Name, t)] -> p -> PDecl' t -> PDecl' t
- getPriority :: IState -> PTerm -> Int
- addStatics :: Name -> Term -> PTerm -> Idris ()
- addToUsing :: [Using] -> [(Name, PTerm)] -> [Using]
- addUsingImpls :: SyntaxInfo -> Name -> FC -> PTerm -> Idris PTerm
- getUnboundImplicits :: IState -> Type -> PTerm -> [(Bool, PArg)]
- implicit' :: ElabInfo -> SyntaxInfo -> [Name] -> Name -> PTerm -> Idris PTerm
- implicitise :: Bool -> SyntaxInfo -> [Name] -> IState -> PTerm -> (PTerm, [PArg])
- addImplPat :: IState -> PTerm -> PTerm
- addImpl' :: Bool -> [Name] -> [Name] -> [Name] -> IState -> PTerm -> PTerm
- addImplBound :: IState -> [Name] -> PTerm -> PTerm
- addImplBoundInf :: IState -> [Name] -> [Name] -> PTerm -> PTerm
- addImpl :: [Name] -> IState -> PTerm -> PTerm
- mkUniqueNames :: [Name] -> [(Name, Name)] -> PTerm -> PTerm
- aiFn :: Name -> Bool -> Bool -> Bool -> Bool -> [Name] -> IState -> FC -> Name -> FC -> [[Text]] -> [PArg] -> Either Err PTerm
- mkPApp :: FC -> Int -> PTerm -> [PArg] -> PTerm
- impIn :: [PArg] -> PArg -> Bool
- expArg :: PArg' t -> Bool
- substMatches :: [(Name, PTerm)] -> PTerm -> PTerm
- stripLinear :: IState -> PTerm -> PTerm
- stripUnmatchable :: IState -> PTerm -> PTerm
- findStatics :: IState -> PTerm -> (PTerm, [Bool])
- toEither :: EitherErr a b -> Either a b
- matchClause :: IState -> PTerm -> PTerm -> Either (PTerm, PTerm) [(Name, PTerm)]
- matchClause' :: Bool -> IState -> PTerm -> PTerm -> Either (PTerm, PTerm) [(Name, PTerm)]
- substMatchesShadow :: [(Name, PTerm)] -> [Name] -> PTerm -> PTerm
- substMatch :: Name -> PTerm -> PTerm -> PTerm
- substMatchShadow :: Name -> [Name] -> PTerm -> PTerm -> PTerm
- module Idris.AbsSyntaxTree
Documentation
getContext :: Idris Context #
A version of liftIO that puts errors into the exception type of the Idris monad
typeDescription :: String #
addUsingConstraints :: SyntaxInfo -> FC -> PTerm -> Idris PTerm #
targetTriple :: Idris String #
forCodegen :: Codegen -> [(Codegen, a)] -> [a] #
getObjectFiles :: Codegen -> Idris [FilePath] #
addObjectFile :: Codegen -> FilePath -> Idris () #
addDyLib :: [String] -> Idris (Either DynamicLib String) #
getAutoImports :: Idris [FilePath] #
addAutoImport :: FilePath -> Idris () #
addDefinedName :: Name -> Idris () #
getDefinedNames :: Idris [Name] #
addImported :: Bool -> FilePath -> Idris () #
addLangExt :: LanguageExt -> Idris () #
dropLangExt :: LanguageExt -> Idris () #
addTrans :: Name -> (Term, Term) -> Idris () #
Transforms are organised by the function being applied on the lhs of the transform, to make looking up appropriate transforms quicker
addErrRev :: (Term, Term) -> Idris () #
Add transformation rules from a definition, which will reverse the definition for an error to make it more readable
addErrReduce :: Name -> Idris () #
Say that the name should always be reduced in error messages, to help readability/error reflection
addErasureUsage :: Name -> Int -> Idris () #
getErasureUsage :: Idris [(Name, Int)] #
getExports :: Idris [Name] #
defer_totcheck :: (FC, Name) -> Idris () #
clear_totcheck :: Idris () #
setAccessibility :: Name -> Accessibility -> Idris () #
getFromHideList :: Name -> Idris (Maybe Accessibility) #
get the accessibility of a name outside this module
setTotality :: Name -> Totality -> Idris () #
setInjectivity :: Name -> Injectivity -> Idris () #
getTotality :: Name -> Idris Totality #
getCoercionsTo :: IState -> Type -> [Name] #
addTyInferred :: Name -> Idris () #
isTyInferred :: Name -> Idris Bool #
addFunctionErrorHandlers :: Name -> Name -> [Name] -> Idris () #
Adds error handlers for a particular function and argument. If names are ambiguous, all matching handlers are updated.
getAllNames :: Name -> Idris [Name] #
Trace all the names in a call graph starting at the given name
getCGAllNames :: IState -> Name -> Maybe [Name] #
addCoercion :: Name -> Idris () #
addNameHint :: Name -> Name -> Idris () #
getNameHints :: IState -> Name -> [Name] #
addDeprecated :: Name -> String -> Idris () #
getDeprecated :: Name -> Idris (Maybe String) #
addFragile :: Name -> String -> Idris () #
getFragile :: Name -> Idris (Maybe String) #
push_estack :: Name -> Bool -> Idris () #
pop_estack :: Idris () #
Arguments
:: Bool | whether the name is an Integer implementation |
-> Bool | whether to include the implementation in implementation search |
-> Name | the name of the interface |
-> Name | the name of the implementation |
-> Idris () |
Add an interface implementation function.
Precondition: the implementation should have the correct type.
Dodgy hack 1: Put integer implementations first in the list so they are resolved by default.
Dodgy hack 2: put constraint chasers (ParentN) last
addOpenImpl :: [Name] -> Idris [Name] #
Add a privileged implementation - one which implementation search will happily resolve immediately if it is type correct This is used for naming parent implementations when defining an implementation with constraints. Returns the old list, so we can revert easily at the end of a block
setOpenImpl :: [Name] -> Idris () #
getOpenImpl :: Idris [Name] #
addInterface :: Name -> InterfaceInfo -> Idris () #
addRecord :: Name -> RecordInfo -> Idris () #
addAutoHint :: Name -> Name -> Idris () #
getAutoHints :: Name -> Idris [Name] #
resetNameIdx :: Idris () #
addNameIdx :: Name -> Idris (Int, Name) #
Used to preserve sharing of names
getImported :: Idris [(FilePath, Bool)] #
setErrSpan :: FC -> Idris () #
updateIState :: (IState -> IState) -> Idris () #
addInternalApp :: FilePath -> Int -> PTerm -> Idris () #
InternalApp keeps track of the real function application for making case splits from, not the application the programmer wrote, which doesn't have the whole context in any case other than top level definitions
getInternalApp :: FilePath -> Int -> Idris PTerm #
clearOrigPats :: Idris () #
Pattern definitions are only used for coverage checking, so erase them when we're done
clearPTypes :: Idris () #
Erase types from Ps in the context (basically ending up with what's in the .ibc, which is all we need after all the analysis is done)
checkUndefined :: FC -> Name -> Idris () #
isUndefined :: FC -> Name -> Idris Bool #
setContext :: Context -> Idris () #
updateContext :: (Context -> Context) -> Idris () #
addConstraints :: FC -> (Int, [UConstraint]) -> Idris () #
typeInType :: Idris Bool #
Arguments
:: NameType | |
-> [(Name, (Int, Maybe Name, Type, [Name], Bool, Bool))] | The Name is the name being made into a metavar, the Int is the number of vars that are part of a putative proof context, the Maybe Name is the top-level function containing the new metavariable, the Type is its type, and the Bool is whether :p is allowed |
-> Idris () |
Save information about a name that is not yet defined
solveDeferred :: FC -> Name -> Idris () #
getUndefined :: Idris [Name] #
isMetavarName :: Name -> IState -> Bool #
setWidth :: ConsoleWidth -> Idris () #
isetPrompt :: String -> Idris () #
isetLoadedRegion :: Idris () #
Tell clients how much was parsed and loaded
setLogLevel :: Int -> Idris () #
setLogCats :: [LogCat] -> Idris () #
setCmdLine :: [Opt] -> Idris () #
getCmdLine :: Idris [Opt] #
getDumpHighlighting :: Idris Bool #
getDumpDefun :: Idris (Maybe FilePath) #
getDumpCases :: Idris (Maybe FilePath) #
setAutoImpls :: Bool -> Idris () #
getAutoImpls :: Idris Bool #
setErrContext :: Bool -> Idris () #
errContext :: Idris Bool #
getOptimise :: Idris [Optimisation] #
setOptimise :: [Optimisation] -> Idris () #
addOptimise :: Optimisation -> Idris () #
removeOptimise :: Optimisation -> Idris () #
setOptLevel :: Int -> Idris () #
Set appropriate optimisation set for the given level. We only have one optimisation that is configurable at the moment, however!
showOrigErr :: Idris Bool #
setShowOrigErr :: Bool -> Idris () #
setAutoSolve :: Bool -> Idris () #
setNoBanner :: Bool -> Idris () #
getNoBanner :: Idris Bool #
setEvalTypes :: Bool -> Idris () #
getDesugarNats :: Idris Bool #
setDesugarNats :: Bool -> Idris () #
setCodegen :: Codegen -> Idris () #
setOutputTy :: OutputType -> Idris () #
outputTy :: Idris OutputType #
setIdeMode :: Bool -> Handle -> Idris () #
setTargetTriple :: String -> Idris () #
setTargetCPU :: String -> Idris () #
setVerbose :: Int -> Idris () #
setTypeInType :: Bool -> Idris () #
setCoverage :: Bool -> Idris () #
setIBCSubDir :: FilePath -> Idris () #
valIBCSubDir :: IState -> Idris FilePath #
addImportDir :: FilePath -> Idris () #
setImportDirs :: [FilePath] -> Idris () #
allImportDirs :: Idris [FilePath] #
rankedImportDirs :: FilePath -> Idris [FilePath] #
addSourceDir :: FilePath -> Idris () #
setSourceDirs :: [FilePath] -> Idris () #
allSourceDirs :: Idris [FilePath] #
setColourise :: Bool -> Idris () #
setImpShow :: Bool -> Idris () #
setColour :: ColourType -> IdrisColour -> Idris () #
Arguments
:: [LogCat] | The categories that the message should appear under. |
-> Int | The Logging level the message should appear. |
-> String | The message to show the developer. |
-> Idris () |
Log aspect of Idris execution
An empty set of logging levels is used to denote all categories.
@TODO update IDE protocol
logCoverage :: Int -> String -> Idris () #
logErasure :: Int -> String -> Idris () #
logCodeGen :: Int -> String -> Idris () #
Log an action of the compiler.
cmdOptType :: Opt -> Idris Bool #
setTypeCase :: Bool -> Idris () #
getIndentWith :: Idris Int #
setIndentWith :: Int -> Idris () #
getIndentClause :: Idris Int #
setIndentClause :: Int -> Idris () #
expandImplementationScope :: p -> p -> [(Name, t)] -> p -> PDecl' t -> PDecl' t #
getPriority :: IState -> PTerm -> Int #
Calculate a priority for a type, for deciding elaboration order * if it's just a type variable or concrete type, do it early (0) * if there's only type variables and injective constructors, do it next (1) * if there's a function type, next (2) * finally, everything else (3)
addUsingImpls :: SyntaxInfo -> Name -> FC -> PTerm -> Idris PTerm #
Add implicit bindings from using block, and bind any missing names
implicitise :: Bool -> SyntaxInfo -> [Name] -> IState -> PTerm -> (PTerm, [PArg]) #
Even if auto_implicits is off, we need to call this so we record which arguments are implicit
addImplPat :: IState -> PTerm -> PTerm #
Add implicit arguments in function calls
addImpl :: [Name] -> IState -> PTerm -> PTerm #
Add the implicit arguments to applications in the term [Name] gives the names to always expend, even when under a binder of that name (this is to expand methods with implicit arguments in dependent interfaces).
mkUniqueNames :: [Name] -> [(Name, Name)] -> PTerm -> PTerm #
Rename any binders which are repeated (so that we don't have to mess about with shadowing anywhere else).
impIn :: [PArg] -> PArg -> Bool #
return True if the second argument is an implicit argument which is expected in the implicits, or if it's not an implicit
stripLinear :: IState -> PTerm -> PTerm #
stripUnmatchable :: IState -> PTerm -> PTerm #
Remove functions which aren't applied to anything, which must then be resolved by unification. Assume names resolved and alternatives filled in (so no ambiguity).
findStatics :: IState -> PTerm -> (PTerm, [Bool]) #
Find static
argument positions
(the declared ones, plus any names in argument position in the declared
statics)
FIXME: It's possible that this really has to happen after elaboration
matchClause :: IState -> PTerm -> PTerm -> Either (PTerm, PTerm) [(Name, PTerm)] #
Syntactic match of a against b, returning pair of variables in a and what they match. Returns the pair that failed if not a match.
module Idris.AbsSyntaxTree