idris-1.1.0: Functional Programming Language with Dependent Types

CopyrightLicense : BSD3
MaintainerThe Idris Community.
Safe HaskellNone
LanguageHaskell2010

Idris.PartialEval

Description

 

Synopsis

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.

mkPE_TermDecl Source #

Arguments

:: IState 
-> Name 
-> Name 
-> PTerm

Type of specialised function

-> [(PEArgType, Term)] 
-> PEDecl 

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 PEArgType Source #

Data type representing binding-time annotations for partial evaluation of arguments

Constructors

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_app :: PEDecl -> PTerm Source #

pe_def :: PEDecl -> PTerm Source #

pe_clauses :: PEDecl -> [(PTerm, PTerm)] Source #

pe_simple :: PEDecl -> Bool Source #