Copyright | License : BSD3 |
---|---|
Maintainer | The Idris Community. |
Safe Haskell | None |
Language | Haskell2010 |
- partial_eval :: Context -> [(Name, Maybe Int)] -> [Either Term (Term, Term)] -> Maybe [Either Term (Term, Term)]
- getSpecApps :: IState -> [Name] -> Term -> [(Name, [(PEArgType, Term)])]
- specType :: [(PEArgType, Term)] -> Type -> (Type, [(PEArgType, Term)])
- mkPE_TyDecl :: IState -> [(PEArgType, Term)] -> Type -> PTerm
- mkPE_TermDecl :: IState -> Name -> Name -> PTerm -> [(PEArgType, Term)] -> PEDecl
- data PEArgType
- pe_app :: PEDecl -> PTerm
- pe_def :: PEDecl -> PTerm
- pe_clauses :: PEDecl -> [(PTerm, PTerm)]
- pe_simple :: PEDecl -> Bool
Documentation
partial_eval :: Context -> [(Name, Maybe Int)] -> [Either Term (Term, Term)] -> Maybe [Either Term (Term, Term)] Source #
Partially evaluates given terms under the given context. It is an error if partial evaluation fails to make any progress. Making progress is defined as: all of the names given with explicit reduction limits (in practice, the function being specialised) must have reduced at least once. If we don't do this, we might end up making an infinite function after applying the transformation.
getSpecApps :: IState -> [Name] -> Term -> [(Name, [(PEArgType, Term)])] Source #
Get specialised applications for a given function
specType :: [(PEArgType, Term)] -> Type -> (Type, [(PEArgType, Term)]) Source #
Specialises the type of a partially evaluated TT function returning a pair of the specialised type and the types of expected arguments.
mkPE_TyDecl :: IState -> [(PEArgType, Term)] -> Type -> PTerm Source #
Creates an Idris type declaration given current state and a
specialised TT function application type.
Can be used in combination with the output of specType
.
This should: specialise any static argument position, then generalise over any function applications in the result.
Creates a new declaration for a specialised function application. Simple version at the moment: just create a version which is a direct application of the function to be specialised. More complex version to do: specialise the definition clause by clause
Data type representing binding-time annotations for partial evaluation of arguments
ImplicitS Name | Implicit static argument |
ImplicitD Name | Implicit dynamic argument |
ConstraintS | Implementation constraint |
ConstraintD | Implementation constraint |
ExplicitS | Explicit static argument |
ExplicitD | Explicit dynamic argument |
UnifiedD | Erasable dynamic argument (found under unification) |
pe_clauses :: PEDecl -> [(PTerm, PTerm)] Source #