idris-1.3.4: Functional Programming Language with Dependent Types

License | BSD3
Maintainer | The Idris Community.
Safe Haskell | None
Language | Haskell2010

Idris.Core.Elaborate

Description

This is our interface to proof construction, rather than ProofState, because this gives us a language to build derived tactics out of the primitives.

Synopsis

- apply :: Raw -> [(Bool, Int)] -> Elab' aux [(Name, Name)]
- forAll :: Name -> RigCount -> Maybe ImplicitInfo -> Raw -> Elab' aux ()
- fill :: Raw -> Elab' aux ()
- tryAll :: [(Elab' aux a, Name)] -> Elab' aux a
- try :: Elab' aux a -> Elab' aux a -> Elab' aux a
- defer :: [Name] -> [Name] -> Name -> Elab' aux Name
- simplify :: Elab' aux ()
- arg :: Name -> RigCount -> Maybe ImplicitInfo -> Name -> Elab' aux ()
- handleError :: (Err -> Bool) -> Elab' aux a -> Elab' aux a -> Elab' aux a
- rewrite :: Raw -> Elab' aux ()
- data ElabState aux = ES (ProofState, aux) String (Maybe (ElabState aux))
- goal :: Elab' aux Type
- claim :: Name -> Raw -> Elab' aux ()
- focus :: Name -> Elab' aux ()
- getNameFrom :: Name -> Elab' aux Name
- initElaborator :: Name -> String -> Context -> Ctxt TypeInfo -> Int -> Type -> ProofState
- movelast :: Name -> Elab' aux ()
- runElab :: aux -> Elab' aux a -> ProofState -> TC (a, ElabState aux)
- solve :: Elab' aux ()
- exact :: Raw -> Elab' aux ()
- qshow :: Fails -> String
- computeLet :: Name -> Elab' aux ()
- attack :: Elab' aux ()
- claimFn :: Name -> Name -> Raw -> Elab' aux ()
- reorder_claims :: Name -> Elab' aux ()
- implementationArg :: Name -> Elab' aux ()
- autoArg :: Name -> Elab' aux ()
- setinj :: Name -> Elab' aux ()
- deferType :: Name -> Raw -> [Name] -> Elab' aux ()
- unifyGoal :: Raw -> Elab' aux ()
- unifyTerms :: Raw -> Raw -> Elab' aux ()
- match_fill :: Raw -> Elab' aux ()
- prep_fill :: Name -> [Name] -> Elab' aux ()
- complete_fill :: Elab' aux ()
- introTy :: Raw -> Maybe Name -> Elab' aux ()
- intro :: Maybe Name -> Elab' aux ()
- patvar :: Name -> Elab' aux ()
- letbind :: Name -> RigCount -> Raw -> Raw -> Elab' aux ()
- expandLet :: Name -> Term -> Elab' aux ()
- equiv :: Raw -> Elab' aux ()
- patbind :: Name -> RigCount -> Elab' aux ()
- compute :: Elab' aux ()
- whnf_compute :: Elab' aux ()
- whnf_compute_args :: Elab' aux ()
- check_in :: Raw -> Elab' aux ()
- eval_in :: Raw -> Elab' aux ()
- start_unify :: Name -> Elab' aux ()
- matchProblems :: Bool -> Elab' aux ()
- type Elab' aux a = StateT (ElabState aux) TC a
- type Elab a = Elab' () a
- proof :: ElabState aux -> ProofState
- proofFail :: Elab' aux a -> Elab' aux a
- explicit :: Name -> Elab' aux ()
- addPSname :: Name -> Elab' aux ()
- getPSnames :: Elab' aux [Name]
- saveState :: Elab' aux ()
- loadState :: Elab' aux ()
- setNextName :: Elab' aux ()
- get_env :: Elab' aux Env
- initNextNameFrom :: [Name] -> Elab' aux ()
- transformErr :: (Err -> Err) -> Elab' aux a -> Elab' aux a
- errAt :: String -> Name -> Maybe Type -> Elab' aux a -> Elab' aux a
- erunAux :: FC -> Elab' aux a -> Elab' aux (a, aux)
- getAux :: Elab' aux aux
- erun :: FC -> Elab' aux a -> Elab' aux a
- execElab :: aux -> Elab' aux a -> ProofState -> TC (ElabState aux)
- elaborate :: String -> Context -> Ctxt TypeInfo -> Int -> Name -> Type -> aux -> Elab' aux a -> TC (a, String)
- updateAux :: (aux -> aux) -> Elab' aux ()
- unifyLog :: Bool -> Elab' aux ()
- getUnifyLog :: Elab' aux Bool
- processTactic' :: Tactic -> Elab' aux ()
- updatePS :: (ProofState -> ProofState) -> Elab' aux ()
- now_elaborating :: FC -> Name -> Name -> Elab' aux ()
- done_elaborating_app :: Name -> Elab' aux ()
- done_elaborating_arg :: Name -> Name -> Elab' aux ()
- elaborating_app :: Elab' aux [(FC, Name, Name)]
- get_context :: Elab' aux Context
- set_context :: Context -> Elab' aux ()
- get_datatypes :: Elab' aux (Ctxt TypeInfo)
- set_datatypes :: Ctxt TypeInfo -> Elab' aux ()
- get_global_nextname :: Elab' aux Int
- set_global_nextname :: Int -> Elab' aux ()
- get_term :: Elab' aux Term
- update_term :: (Term -> Term) -> Elab' aux ()
- get_inj :: Elab' aux [Name]
- get_holes :: Elab' aux [Name]
- get_usedns :: Elab' aux [Name]
- get_probs :: Elab' aux Fails
- get_recents :: Elab' aux [Name]
- is_guess :: Elab' aux Bool
- get_guess :: Elab' aux Term
- get_type :: Raw -> Elab' aux Type
- get_type_val :: Raw -> Elab' aux (Term, Type)
- get_deferred :: Elab' aux [Name]
- checkInjective :: (Term, Term, Term) -> Elab' aux ()
- get_implementations :: Elab' aux [Name]
- get_autos :: Elab' aux [(Name, ([FailContext], [Name]))]
- unique_hole :: Name -> Elab' aux Name
- unique_hole' :: Bool -> Name -> Elab' aux Name
- elog :: String -> Elab' aux ()
- getLog :: Elab' aux String
- end_unify :: Elab' aux ()
- unify_all :: Elab' aux ()
- regret :: Elab' aux ()
- patvar' :: Name -> Elab' aux ()
- dotterm :: Elab' aux ()
- get_dotterm :: Elab' aux [(Name, [Name])]
- zipHere :: Elab' aux ()
- unifyProblems :: Elab' aux ()
- proofstate :: Elab' aux ()
- qed :: Elab' aux Term
- undo :: Elab' aux ()
- prepare_apply :: Raw -> [Bool] -> Elab' aux [(Name, Name)]
- match_apply :: Raw -> [(Bool, Int)] -> Elab' aux [(Name, Name)]
- apply' :: (Raw -> Elab' aux ()) -> Raw -> [(Bool, Int)] -> Elab' aux [(Name, Name)]
- apply2 :: Raw -> [Maybe (Elab' aux ())] -> Elab' aux ()
- apply_elab :: Name -> [Maybe (Int, Elab' aux ())] -> Elab' aux ()
- checkPiGoal :: Name -> Elab' aux ()
- simple_app :: Bool -> Elab' aux () -> Elab' aux () -> String -> Elab' aux ()
- dep_app :: Elab' aux () -> Elab' aux () -> String -> Elab' aux ()
- infer_app :: Bool -> Elab' aux () -> Elab' aux () -> String -> Elab' aux ()
- no_errors :: Elab' aux () -> Maybe Err -> Elab' aux ()
- try' :: Elab' aux a -> Elab' aux a -> Bool -> Elab' aux a
- prunStateT :: Int -> Bool -> [a] -> Maybe [b] -> StateT (ElabState t) TC t1 -> ElabState t -> TC ((t1, Int, Fails), ElabState t)
- tryCatch :: Elab' aux a -> (Err -> Elab' aux a) -> Elab' aux a
- tryWhen :: Bool -> Elab' aux a -> Elab' aux a -> Elab' aux a
- tryAll' :: Bool -> [(Elab' aux a, Name)] -> Elab' aux a
- debugElaborator :: [ErrorReportPart] -> Elab' aux a
- dumpprobs :: Show a1 => [(a2, b, c, a1)] -> [Char]
- module Idris.Core.ProofState

# Documentation

apply #

Arguments

:: Raw | The operator to apply
-> [(Bool, Int)] | For each argument, whether to attempt to solve it and the priority in which to do so
-> Elab' aux [(Name, Name)] |

Apply an operator, solving some arguments by unification or matching.

forAll :: Name -> RigCount -> Maybe ImplicitInfo -> Raw -> Elab' aux () #

fill :: Raw -> Elab' aux () #

tryAll :: [(Elab' aux a, Name)] -> Elab' aux a #

try :: Elab' aux a -> Elab' aux a -> Elab' aux a #

defer :: [Name] -> [Name] -> Name -> Elab' aux Name #

simplify :: Elab' aux () #

arg :: Name -> RigCount -> Maybe ImplicitInfo -> Name -> Elab' aux () #

handleError :: (Err -> Bool) -> Elab' aux a -> Elab' aux a -> Elab' aux a #

rewrite :: Raw -> Elab' aux () #

data ElabState aux #

Constructors

ES (ProofState, aux) String (Maybe (ElabState aux)) |

#### Instances

Instances details

Show aux => Show (ElabState aux) # |
Instance details Defined in Idris.Core.Elaborate Methods showsPrec :: Int -> ElabState aux -> ShowS # show :: ElabState aux -> String # showList :: [ElabState aux] -> ShowS #

goal :: Elab' aux Type #

get the current goal type

claim :: Name -> Raw -> Elab' aux () #

focus :: Name -> Elab' aux () #

getNameFrom :: Name -> Elab' aux Name #

initElaborator #

Arguments

:: Name | the name of what's to be elaborated
-> String | the current source file
-> Context | the current global context
-> Ctxt TypeInfo | the value of the idris_datatypes field of IState
-> Int | the value of the idris_name field of IState
-> Type | the goal type
-> ProofState |

movelast :: Name -> Elab' aux () #

runElab :: aux -> Elab' aux a -> ProofState -> TC (a, ElabState aux) #

solve :: Elab' aux () #

exact :: Raw -> Elab' aux () #

qshow :: Fails -> String #

computeLet :: Name -> Elab' aux () #

attack :: Elab' aux () #

claimFn :: Name -> Name -> Raw -> Elab' aux () #

reorder_claims :: Name -> Elab' aux () #

implementationArg :: Name -> Elab' aux () #

autoArg :: Name -> Elab' aux () #

setinj :: Name -> Elab' aux () #

deferType :: Name -> Raw -> [Name] -> Elab' aux () #

unifyGoal :: Raw -> Elab' aux () #

unifyTerms :: Raw -> Raw -> Elab' aux () #

match_fill :: Raw -> Elab' aux () #

prep_fill :: Name -> [Name] -> Elab' aux () #

complete_fill :: Elab' aux () #

introTy :: Raw -> Maybe Name -> Elab' aux () #

intro :: Maybe Name -> Elab' aux () #

patvar :: Name -> Elab' aux () #

Turn the current hole into a pattern variable with the provided name, made unique if not the same as the head of the hole queue

letbind :: Name -> RigCount -> Raw -> Raw -> Elab' aux () #

expandLet :: Name -> Term -> Elab' aux () #

equiv :: Raw -> Elab' aux () #

patbind :: Name -> RigCount -> Elab' aux () #

compute :: Elab' aux () #

whnf_compute :: Elab' aux () #

whnf_compute_args :: Elab' aux () #

check_in :: Raw -> Elab' aux () #

eval_in :: Raw -> Elab' aux () #

start_unify :: Name -> Elab' aux () #

matchProblems :: Bool -> Elab' aux () #

type Elab' aux a = StateT (ElabState aux) TC a #

type Elab a = Elab' () a #

proof :: ElabState aux -> ProofState #

proofFail :: Elab' aux a -> Elab' aux a #

explicit :: Name -> Elab' aux () #

addPSname :: Name -> Elab' aux () #

getPSnames :: Elab' aux [Name] #

saveState :: Elab' aux () #

loadState :: Elab' aux () #

setNextName :: Elab' aux () #

get_env :: Elab' aux Env #

get the local context at the currently in focus hole

initNextNameFrom :: [Name] -> Elab' aux () #

transformErr :: (Err -> Err) -> Elab' aux a -> Elab' aux a #

Transform the error returned by an elaboration script, preserving location information and proof search failure messages.

errAt :: String -> Name -> Maybe Type -> Elab' aux a -> Elab' aux a #

erunAux :: FC -> Elab' aux a -> Elab' aux (a, aux) #

getAux :: Elab' aux aux #

Get the auxiliary state

erun :: FC -> Elab' aux a -> Elab' aux a #

execElab :: aux -> Elab' aux a -> ProofState -> TC (ElabState aux) #

elaborate :: String -> Context -> Ctxt TypeInfo -> Int -> Name -> Type -> aux -> Elab' aux a -> TC (a, String) #

updateAux :: (aux -> aux) -> Elab' aux () #

Modify the auxiliary state

unifyLog :: Bool -> Elab' aux () #

Set whether to show the unifier log

getUnifyLog :: Elab' aux Bool #

processTactic' :: Tactic -> Elab' aux () #

Process a tactic within the current elaborator state

updatePS :: (ProofState -> ProofState) -> Elab' aux () #

now_elaborating :: FC -> Name -> Name -> Elab' aux () #

done_elaborating_app :: Name -> Elab' aux () #

done_elaborating_arg :: Name -> Name -> Elab' aux () #

elaborating_app :: Elab' aux [(FC, Name, Name)] #

get_context :: Elab' aux Context #

Get the global context

set_context :: Context -> Elab' aux () #

Update the context. (should only be used for adding temporary definitions or all sorts of stuff could go wrong)

get_datatypes :: Elab' aux (Ctxt TypeInfo) #

set_datatypes :: Ctxt TypeInfo -> Elab' aux () #

get_global_nextname :: Elab' aux Int #

set_global_nextname :: Int -> Elab' aux () #

get_term :: Elab' aux Term #

get the proof term

update_term :: (Term -> Term) -> Elab' aux () #

modify the proof term

get_inj :: Elab' aux [Name] #

get_holes :: Elab' aux [Name] #

get_usedns :: Elab' aux [Name] #

get_probs :: Elab' aux Fails #

get_recents :: Elab' aux [Name] #

Return recently solved names (that is, the names solved since the last call to get_recents)

is_guess :: Elab' aux Bool #

get_guess :: Elab' aux Term #

Get the guess at the current hole, if there is one

get_type :: Raw -> Elab' aux Type #

Typecheck locally

get_type_val :: Raw -> Elab' aux (Term, Type) #

get_deferred :: Elab' aux [Name] #

get holes we've deferred for later definition

checkInjective :: (Term, Term, Term) -> Elab' aux () #

get_implementations :: Elab' aux [Name] #

get implementation argument names

get_autos :: Elab' aux [(Name, ([FailContext], [Name]))] #

get auto argument names

unique_hole :: Name -> Elab' aux Name #

given a desired hole name, return a unique hole name

unique_hole' :: Bool -> Name -> Elab' aux Name #

elog :: String -> Elab' aux () #

getLog :: Elab' aux String #

end_unify :: Elab' aux () #

unify_all :: Elab' aux () #

regret :: Elab' aux () #

patvar' :: Name -> Elab' aux () #

Turn the current hole into a pattern variable with the provided name, but don't make MNs unique.

dotterm :: Elab' aux () #

get_dotterm :: Elab' aux [(Name, [Name])] #

zipHere :: Elab' aux () #

Set the zipper in the proof state to point at the current sub term (This currently happens automatically, so this will have no effect...)

unifyProblems :: Elab' aux () #

proofstate :: Elab' aux () #

qed :: Elab' aux Term #

undo :: Elab' aux () #

prepare_apply #

Arguments

:: Raw | The operation being applied
-> [Bool] | Whether arguments are implicit
-> Elab' aux [(Name, Name)] | The names of the arguments and their holes to be filled with elaborated argument values

Prepare to apply a function by creating holes to be filled by the arguments

match_apply #

Arguments

:: Raw | The operator to apply
-> [(Bool, Int)] | For each argument, whether to attempt to solve it and the priority in which to do so
-> Elab' aux [(Name, Name)] |

Apply an operator, solving some arguments by unification or matching.

apply' :: (Raw -> Elab' aux ()) -> Raw -> [(Bool, Int)] -> Elab' aux [(Name, Name)] #

apply2 :: Raw -> [Maybe (Elab' aux ())] -> Elab' aux () #

apply_elab :: Name -> [Maybe (Int, Elab' aux ())] -> Elab' aux () #

checkPiGoal :: Name -> Elab' aux () #

simple_app :: Bool -> Elab' aux () -> Elab' aux () -> String -> Elab' aux () #

dep_app :: Elab' aux () -> Elab' aux () -> String -> Elab' aux () #

infer_app :: Bool -> Elab' aux () -> Elab' aux () -> String -> Elab' aux () #

no_errors :: Elab' aux () -> Maybe Err -> Elab' aux () #

try' :: Elab' aux a -> Elab' aux a -> Bool -> Elab' aux a #

prunStateT :: Int -> Bool -> [a] -> Maybe [b] -> StateT (ElabState t) TC t1 -> ElabState t -> TC ((t1, Int, Fails), ElabState t) #

tryCatch :: Elab' aux a -> (Err -> Elab' aux a) -> Elab' aux a #

tryWhen :: Bool -> Elab' aux a -> Elab' aux a -> Elab' aux a #

tryAll' :: Bool -> [(Elab' aux a, Name)] -> Elab' aux a #

debugElaborator :: [ErrorReportPart] -> Elab' aux a #

dumpprobs :: Show a1 => [(a2, b, c, a1)] -> [Char] #

module Idris.Core.ProofState