idris-1.0: Functional Programming Language with Dependent Types

CopyrightLicense : BSD3
MaintainerThe Idris Community.
Safe HaskellNone
LanguageHaskell98

Idris.Core.Evaluate

Contents

Description

 

Synopsis

Documentation

normaliseC :: Context -> Env -> TT Name -> TT Name #

Normalise fully type checked terms (so, assume all names/let bindings resolved)

normaliseAll :: Context -> Env -> TT Name -> TT Name #

Normalise everything, whether abstract, private or public

normaliseBlocking :: Context -> Env -> [Name] -> TT Name -> TT Name #

As normaliseAll, but with an explicit list of names *not* to reduce

rt_simplify :: Context -> Env -> TT Name -> TT Name #

Simplify for run-time (i.e. basic inlining)

simplify :: Context -> Env -> TT Name -> TT Name #

Like normalise, but we only reduce functions that are marked as okay to inline, and lets

inlineSmall :: Context -> Env -> TT Name -> TT Name #

Like simplify, but we only reduce functions that are marked as okay to inline, and don't reduce lets

specialise :: Context -> Env -> [(Name, Int)] -> TT Name -> (TT Name, [(Name, Int)]) #

unfold :: Context -> Env -> [(Name, Int)] -> TT Name -> TT Name #

Unfold the given names in a term, the given number of times in a stack. Preserves 'let'. This is primarily to support inlining of the given names, and can also help with partial evaluation by allowing a rescursive definition to be unfolded once only. Specifically used to unfold definitions using interfaces before going to the totality checker (otherwise mutually recursive definitions in implementations will not work...)

convEq' :: Context -> [Name] -> TT Name -> TT Name -> TC Bool #

data Def #

A definition is either a simple function (just an expression with a type), a constant, which could be a data or type constructor, an axiom or as an yet undefined function, or an Operator. An Operator is a function which explains how to reduce. A CaseOp is a function defined by a simple case tree

Instances

Show Def # 

Methods

showsPrec :: Int -> Def -> ShowS #

show :: Def -> String #

showList :: [Def] -> ShowS #

Generic Def # 

Associated Types

type Rep Def :: * -> * #

Methods

from :: Def -> Rep Def x #

to :: Rep Def x -> Def #

type Rep Def # 
type Rep Def = D1 (MetaData "Def" "Idris.Core.Evaluate" "idris-1.0-CAoIBvHIKFS3UiIIWlh0dD" False) ((:+:) ((:+:) (C1 (MetaCons "Function" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Term)))) (C1 (MetaCons "TyDecl" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 NameType)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type))))) ((:+:) (C1 (MetaCons "Operator" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Type)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ([Value] -> Maybe Value)))))) (C1 (MetaCons "CaseOp" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 CaseInfo)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Type)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [(Type, Bool)])))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Either Term (Term, Term)])) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [([Name], Term, Term)])) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 CaseDefs))))))))

data CaseInfo #

Instances

Generic CaseInfo # 

Associated Types

type Rep CaseInfo :: * -> * #

Methods

from :: CaseInfo -> Rep CaseInfo x #

to :: Rep CaseInfo x -> CaseInfo #

type Rep CaseInfo # 
type Rep CaseInfo = D1 (MetaData "CaseInfo" "Idris.Core.Evaluate" "idris-1.0-CAoIBvHIKFS3UiIIWlh0dD" False) (C1 (MetaCons "CaseInfo" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "case_inlinable") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) ((:*:) (S1 (MetaSel (Just Symbol "case_alwaysinline") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) (S1 (MetaSel (Just Symbol "tc_dictionary") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))))

data CaseDefs #

Constructors

CaseDefs 

Fields

Instances

Generic CaseDefs # 

Associated Types

type Rep CaseDefs :: * -> * #

Methods

from :: CaseDefs -> Rep CaseDefs x #

to :: Rep CaseDefs x -> CaseDefs #

type Rep CaseDefs # 
type Rep CaseDefs = D1 (MetaData "CaseDefs" "Idris.Core.Evaluate" "idris-1.0-CAoIBvHIKFS3UiIIWlh0dD" False) (C1 (MetaCons "CaseDefs" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "cases_compiletime") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ([Name], SC))) (S1 (MetaSel (Just Symbol "cases_runtime") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ([Name], SC)))))

data Totality #

The result of totality checking

Constructors

Total [Int]

well-founded arguments

Productive

productive

Partial PReason 
Unchecked 
Generated 

Instances

Eq Totality # 
Show Totality # 
Generic Totality # 

Associated Types

type Rep Totality :: * -> * #

Methods

from :: Totality -> Rep Totality x #

to :: Rep Totality x -> Totality #

type Rep Totality # 
type Rep Totality = D1 (MetaData "Totality" "Idris.Core.Evaluate" "idris-1.0-CAoIBvHIKFS3UiIIWlh0dD" False) ((:+:) ((:+:) (C1 (MetaCons "Total" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Int]))) (C1 (MetaCons "Productive" PrefixI False) U1)) ((:+:) (C1 (MetaCons "Partial" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PReason))) ((:+:) (C1 (MetaCons "Unchecked" PrefixI False) U1) (C1 (MetaCons "Generated" PrefixI False) U1))))

data PReason #

Reasons why a function may not be total

Instances

Eq PReason # 

Methods

(==) :: PReason -> PReason -> Bool #

(/=) :: PReason -> PReason -> Bool #

Show PReason # 
Generic PReason # 

Associated Types

type Rep PReason :: * -> * #

Methods

from :: PReason -> Rep PReason x #

to :: Rep PReason x -> PReason #

type Rep PReason # 
type Rep PReason = D1 (MetaData "PReason" "Idris.Core.Evaluate" "idris-1.0-CAoIBvHIKFS3UiIIWlh0dD" False) ((:+:) ((:+:) ((:+:) (C1 (MetaCons "Other" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Name]))) (C1 (MetaCons "Itself" PrefixI False) U1)) ((:+:) (C1 (MetaCons "NotCovering" PrefixI False) U1) (C1 (MetaCons "NotPositive" PrefixI False) U1))) ((:+:) ((:+:) (C1 (MetaCons "UseUndef" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Name))) (C1 (MetaCons "ExternalIO" PrefixI False) U1)) ((:+:) (C1 (MetaCons "BelieveMe" PrefixI False) U1) ((:+:) (C1 (MetaCons "Mutual" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Name]))) (C1 (MetaCons "NotProductive" PrefixI False) U1)))))

data MetaInformation #

Constructors

EmptyMI

No meta-information

DataMI [Int]

Meta information for a data declaration with position of parameters

data Context #

Contexts used for global definitions and for proof state. They contain universe constraints and existing definitions. Also store maximum RigCount of the name (can't bind a name at multiplicity 1 in a RigW, for example)

Instances

Show Context # 
Generic Context # 

Associated Types

type Rep Context :: * -> * #

Methods

from :: Context -> Rep Context x #

to :: Rep Context x -> Context #

type Rep Context # 
type Rep Context = D1 (MetaData "Context" "Idris.Core.Evaluate" "idris-1.0-CAoIBvHIKFS3UiIIWlh0dD" False) (C1 (MetaCons "MkContext" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "next_tvar") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)) (S1 (MetaSel (Just Symbol "definitions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ctxt TTDecl)))))

initContext :: Context #

The initial empty context

ctxtAlist :: Context -> [(Name, Def)] #

Get the definitions from a context

addCasedef :: Name -> ErasureInfo -> CaseInfo -> Bool -> SC -> Bool -> Bool -> [(Type, Bool)] -> [Int] -> [Either Term (Term, Term)] -> [([Name], Term, Term)] -> [([Name], Term, Term)] -> Type -> Context -> TC Context #

lookupTyName :: Name -> Context -> [(Name, Type)] #

Get the list of pairs of fully-qualified names and their types that match some name

lookupTyNameExact :: Name -> Context -> Maybe (Name, Type) #

Get the pair of a fully-qualified name and its type, if there is a unique one matching the name used as a key.

lookupTy :: Name -> Context -> [Type] #

Get the types that match some name

lookupTyExact :: Name -> Context -> Maybe Type #

Get the single type that matches some name precisely

isCanonical :: Type -> Context -> Bool #

Return true if the given type is a concrete type familyor primitive False it it's a function to compute a type or a variable

isDConName :: Name -> Context -> Bool #

Check whether a resolved name is certainly a data constructor

canBeDConName :: Name -> Context -> Bool #

Check whether any overloading of a name is a data constructor

data Value #

A HOAS representation of values

Instances

Eq Value # 

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

Show Value # 

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

Quote Value # 

Methods

quote :: Int -> Value -> Eval (TT Name) #

class Quote a where #

Minimal complete definition

quote

Methods

quote :: Int -> a -> Eval (TT Name) #

Instances

Quote Value # 

Methods

quote :: Int -> Value -> Eval (TT Name) #

initEval :: EvalState #

uniqueNameCtxt :: Context -> Name -> [Name] -> Name #

Create a unique name given context and other existing names

Orphan instances

Show (a -> b) # 

Methods

showsPrec :: Int -> (a -> b) -> ShowS #

show :: (a -> b) -> String #

showList :: [a -> b] -> ShowS #