idris-1.3.1: Functional Programming Language with Dependent Types

LicenseBSD3
MaintainerThe Idris Community.
Safe HaskellNone
LanguageHaskell2010

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 # 
Instance details

Defined in Idris.Core.Evaluate

Methods

showsPrec :: Int -> Def -> ShowS #

show :: Def -> String #

showList :: [Def] -> ShowS #

Generic Def # 
Instance details

Defined in Idris.Core.Evaluate

Associated Types

type Rep Def :: Type -> Type #

Methods

from :: Def -> Rep Def x #

to :: Rep Def x -> Def #

ToJSON Def # 
Instance details

Defined in IRTS.Portable

Binary Def # 
Instance details

Defined in Idris.IBC

Methods

put :: Def -> Put #

get :: Get Def #

putList :: [Def] -> Put #

NFData Def # 
Instance details

Defined in Idris.Core.DeepSeq

Methods

rnf :: Def -> () #

type Rep Def # 
Instance details

Defined in Idris.Core.Evaluate

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

data CaseInfo #

Instances
Generic CaseInfo # 
Instance details

Defined in Idris.Core.Evaluate

Associated Types

type Rep CaseInfo :: Type -> Type #

Methods

from :: CaseInfo -> Rep CaseInfo x #

to :: Rep CaseInfo x -> CaseInfo #

ToJSON CaseInfo # 
Instance details

Defined in IRTS.Portable

Binary CaseInfo # 
Instance details

Defined in Idris.IBC

Methods

put :: CaseInfo -> Put #

get :: Get CaseInfo #

putList :: [CaseInfo] -> Put #

NFData CaseInfo # 
Instance details

Defined in Idris.Core.DeepSeq

Methods

rnf :: CaseInfo -> () #

type Rep CaseInfo # 
Instance details

Defined in Idris.Core.Evaluate

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

data CaseDefs #

Constructors

CaseDefs 

Fields

Instances
Generic CaseDefs # 
Instance details

Defined in Idris.Core.Evaluate

Associated Types

type Rep CaseDefs :: Type -> Type #

Methods

from :: CaseDefs -> Rep CaseDefs x #

to :: Rep CaseDefs x -> CaseDefs #

ToJSON CaseDefs # 
Instance details

Defined in IRTS.Portable

Binary CaseDefs # 
Instance details

Defined in Idris.IBC

Methods

put :: CaseDefs -> Put #

get :: Get CaseDefs #

putList :: [CaseDefs] -> Put #

NFData CaseDefs # 
Instance details

Defined in Idris.Core.DeepSeq

Methods

rnf :: CaseDefs -> () #

type Rep CaseDefs # 
Instance details

Defined in Idris.Core.Evaluate

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

data Accessibility #

Constructors

Hidden 
Public 
Frozen 
Private 
Instances
Eq Accessibility # 
Instance details

Defined in Idris.Core.Evaluate

Ord Accessibility # 
Instance details

Defined in Idris.Core.Evaluate

Show Accessibility # 
Instance details

Defined in Idris.Core.Evaluate

Generic Accessibility # 
Instance details

Defined in Idris.Core.Evaluate

Associated Types

type Rep Accessibility :: Type -> Type #

ToJSON Accessibility # 
Instance details

Defined in IRTS.Portable

Binary Accessibility # 
Instance details

Defined in Idris.IBC

NFData Accessibility # 
Instance details

Defined in Idris.Core.DeepSeq

Methods

rnf :: Accessibility -> () #

type Rep Accessibility # 
Instance details

Defined in Idris.Core.Evaluate

type Rep Accessibility = D1 (MetaData "Accessibility" "Idris.Core.Evaluate" "idris-1.3.1-Hk913zkfwqA51fXeD68Meb" False) ((C1 (MetaCons "Hidden" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Public" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "Frozen" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Private" PrefixI False) (U1 :: Type -> Type)))

data Totality #

The result of totality checking

Constructors

Total [Int]

well-founded arguments

Productive

productive

Partial PReason 
Unchecked 
Generated 
Instances
Eq Totality # 
Instance details

Defined in Idris.Core.Evaluate

Show Totality # 
Instance details

Defined in Idris.Core.Evaluate

Generic Totality # 
Instance details

Defined in Idris.Core.Evaluate

Associated Types

type Rep Totality :: Type -> Type #

Methods

from :: Totality -> Rep Totality x #

to :: Rep Totality x -> Totality #

ToJSON Totality # 
Instance details

Defined in IRTS.Portable

Binary Totality # 
Instance details

Defined in Idris.IBC

Methods

put :: Totality -> Put #

get :: Get Totality #

putList :: [Totality] -> Put #

NFData Totality # 
Instance details

Defined in Idris.Core.DeepSeq

Methods

rnf :: Totality -> () #

type Rep Totality # 
Instance details

Defined in Idris.Core.Evaluate

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

data PReason #

Reasons why a function may not be total

Instances
Eq PReason # 
Instance details

Defined in Idris.Core.Evaluate

Methods

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

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

Show PReason # 
Instance details

Defined in Idris.Core.Evaluate

Generic PReason # 
Instance details

Defined in Idris.Core.Evaluate

Associated Types

type Rep PReason :: Type -> Type #

Methods

from :: PReason -> Rep PReason x #

to :: Rep PReason x -> PReason #

Binary PReason # 
Instance details

Defined in Idris.IBC

Methods

put :: PReason -> Put #

get :: Get PReason #

putList :: [PReason] -> Put #

NFData PReason # 
Instance details

Defined in Idris.Core.DeepSeq

Methods

rnf :: PReason -> () #

type Rep PReason # 
Instance details

Defined in Idris.Core.Evaluate

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

data MetaInformation #

Constructors

EmptyMI

No meta-information

DataMI [Int]

Meta information for a data declaration with position of parameters

Instances
Eq MetaInformation # 
Instance details

Defined in Idris.Core.Evaluate

Show MetaInformation # 
Instance details

Defined in Idris.Core.Evaluate

Generic MetaInformation # 
Instance details

Defined in Idris.Core.Evaluate

Associated Types

type Rep MetaInformation :: Type -> Type #

ToJSON MetaInformation # 
Instance details

Defined in IRTS.Portable

Binary MetaInformation # 
Instance details

Defined in Idris.IBC

NFData MetaInformation # 
Instance details

Defined in Idris.Core.DeepSeq

Methods

rnf :: MetaInformation -> () #

type Rep MetaInformation # 
Instance details

Defined in Idris.Core.Evaluate

type Rep MetaInformation = D1 (MetaData "MetaInformation" "Idris.Core.Evaluate" "idris-1.3.1-Hk913zkfwqA51fXeD68Meb" False) (C1 (MetaCons "EmptyMI" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "DataMI" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Int])))

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 # 
Instance details

Defined in Idris.Core.Evaluate

Generic Context # 
Instance details

Defined in Idris.Core.Evaluate

Associated Types

type Rep Context :: Type -> Type #

Methods

from :: Context -> Rep Context x #

to :: Rep Context x -> Context #

NFData Context # 
Instance details

Defined in Idris.Core.DeepSeq

Methods

rnf :: Context -> () #

type Rep Context # 
Instance details

Defined in Idris.Core.Evaluate

type Rep Context = D1 (MetaData "Context" "Idris.Core.Evaluate" "idris-1.3.1-Hk913zkfwqA51fXeD68Meb" False) (C1 (MetaCons "MkContext" PrefixI True) (S1 (MetaSel (Just "next_tvar") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int) :*: S1 (MetaSel (Just "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 # 
Instance details

Defined in Idris.Core.Evaluate

Methods

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

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

Show Value # 
Instance details

Defined in Idris.Core.Evaluate

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

Quote Value # 
Instance details

Defined in Idris.Core.Evaluate

Methods

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

class Quote a where #

Methods

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

Instances
Quote Value # 
Instance details

Defined in Idris.Core.Evaluate

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) # 
Instance details

Methods

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

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

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