idris

Safe HaskellNone

Idris.AbsSyntaxTree

Synopsis

Documentation

data OutputMode Source

The output mode in use

Constructors

RawOutput 
IdeSlave Integer 

Instances

data IState Source

The global state used in the Idris monad

Constructors

IState 

Fields

tt_ctxt :: Context

All the currently defined names and their terms

idris_constraints :: [(UConstraint, FC)]

A list of universe constraints and their corresponding source locations

idris_infixes :: [FixDecl]

Currently defined infix operators

idris_implicits :: Ctxt [PArg]
 
idris_statics :: Ctxt [Bool]
 
idris_classes :: Ctxt ClassInfo
 
idris_dsls :: Ctxt DSL
 
idris_optimisation :: Ctxt OptInfo
 
idris_datatypes :: Ctxt TypeInfo
 
idris_patdefs :: Ctxt ([([Name], Term, Term)], [PTerm])

list of lhs/rhs, and a list of missing clauses

idris_flags :: Ctxt [FnOpt]
 
idris_callgraph :: Ctxt CGInfo
 
idris_calledgraph :: Ctxt [Name]
 
idris_docstrings :: Ctxt String
 
idris_totcheck :: [(FC, Name)]
 
idris_defertotcheck :: [(FC, Name)]
 
idris_options :: IOption
 
idris_name :: Int
 
idris_lineapps :: [((FilePath, Int), PTerm)]

Full application LHS on source line

idris_metavars :: [(Name, (Maybe Name, Int, Bool))]

The currently defined but not proven metavariables

idris_coercions :: [Name]
 
idris_transforms :: [(Term, Term)]
 
syntax_rules :: [Syntax]
 
syntax_keywords :: [String]
 
imported :: [FilePath]

The imported modules

idris_scprims :: [(Name, (Int, PrimFn))]
 
idris_objs :: [(Codegen, FilePath)]
 
idris_libs :: [(Codegen, String)]
 
idris_cgflags :: [(Codegen, String)]
 
idris_hdrs :: [(Codegen, String)]
 
proof_list :: [(Name, [String])]
 
errLine :: Maybe Int
 
lastParse :: Maybe Name
 
indent_stack :: [Int]
 
brace_stack :: [Maybe Int]
 
hide_list :: [(Name, Maybe Accessibility)]
 
default_access :: Accessibility
 
default_total :: Bool
 
ibc_write :: [IBCWrite]
 
compiled_so :: Maybe String
 
idris_dynamic_libs :: [DynamicLib]
 
idris_language_extensions :: [LanguageExt]
 
idris_outputmode :: OutputMode
 
idris_colourRepl :: Bool
 
idris_colourTheme :: ColourTheme
 
idris_outh :: Handle
 

data CGInfo Source

Constructors

CGInfo 

Fields

argsdef :: [Name]
 
calls :: [(Name, [[Name]])]
 
scg :: [SCGEntry]
 
argsused :: [Name]
 
unusedpos :: [Int]
 

type Idris = StateT IState (ErrorT Err IO)Source

The monad for the main REPL - reading and processing files and updating global state (hence the IO inner monad). type Idris = WriterT [Either String (IO ())] (State IState a))

data Fixity Source

Constructors

Infixl 

Fields

prec :: Int
 
Infixr 

Fields

prec :: Int
 
InfixN 

Fields

prec :: Int
 
PrefixN 

Fields

prec :: Int
 

data PDecl' t Source

Top-level declarations such as compiler directives, definitions, datatypes and typeclasses.

Constructors

PFix FC Fixity [String]

Fixity declaration

PTy String SyntaxInfo FC FnOpts Name t

Type declaration

PPostulate String SyntaxInfo FC FnOpts Name t

Postulate

PClauses FC FnOpts Name [PClause' t]

Pattern clause

PCAF FC Name t

Top level constant

PData String SyntaxInfo FC Bool (PData' t)

Data declaration. The Bool argument is True for codata.

PParams FC [(Name, t)] [PDecl' t]

Params block

PNamespace String [PDecl' t]

New namespace

PRecord String SyntaxInfo FC Name t String Name t

Record declaration

PClass String SyntaxInfo FC [t] Name [(Name, t)] [PDecl' t]

Type class: arguments are documentation, syntax info, source location, constraints, class name, parameters, method declarations

PInstance SyntaxInfo FC [t] Name [t] t (Maybe Name) [PDecl' t]

Instance declaration: arguments are syntax info, source location, constraints, class name, parameters, full instance type, optional explicit name, and definitions

PDSL Name (DSL' t)

DSL declaration

PSyntax FC Syntax

Syntax definition

PMutual FC [PDecl' t]

Mutual block

PDirective (Idris ())

Compiler directive. The parser inserts the corresponding action in the Idris monad.

PProvider SyntaxInfo FC Name t t

Type provider. The first t is the type, the second is the term

PTransform FC Bool t t

Source-to-source transformation rule. If bool is True, lhs and rhs must be convertible

Instances

type ElabD a = Elab' [PDecl] aSource

data PClause' t Source

One clause of a top-level definition. Term arguments to constructors are:

  1. The whole application (missing for PClauseR and PWithR because they're within a with clause)
  2. The list of extra with patterns
  3. The right-hand side
  4. The where block (PDecl' t)

Constructors

PClause FC Name t [t] t [PDecl' t]

A normal top-level definition.

PWith FC Name t [t] t [PDecl' t] 
PClauseR FC [t] t [PDecl' t] 
PWithR FC [t] t [PDecl' t] 

data PData' t Source

Data declaration

Constructors

PDatadecl

Data declaration

Fields

d_name :: Name

The name of the datatype

d_tcon :: t

Type constructor

d_cons :: [(String, Name, t, FC)]

Constructors

PLaterdecl

Placeholder for data whose constructors are defined later

Fields

d_name :: Name

The name of the datatype

d_tcon :: t

Type constructor

Instances

data PTerm Source

High level language terms

Constructors

PQuote Raw 
PRef FC Name 
PInferRef FC Name

A name to be defined later

PPatvar FC Name 
PLam Name PTerm PTerm 
PPi Plicity Name PTerm PTerm 
PLet Name PTerm PTerm PTerm 
PTyped PTerm PTerm

Term with explicit type

PApp FC PTerm [PArg] 
PAppBind FC PTerm [PArg]

implicitly bound application

PMatchApp FC Name

Make an application by type matching

PCase FC PTerm [(PTerm, PTerm)] 
PTrue FC 
PFalse FC 
PRefl FC PTerm 
PResolveTC FC 
PEq FC PTerm PTerm 
PRewrite FC PTerm PTerm (Maybe PTerm) 
PPair FC PTerm PTerm 
PDPair FC PTerm PTerm PTerm 
PAlternative Bool [PTerm] 
PHidden PTerm

Irrelevant or hidden pattern

PType 
PGoal FC PTerm Name PTerm 
PConstant Const 
Placeholder 
PDoBlock [PDo] 
PIdiom FC PTerm 
PReturn FC 
PMetavar Name 
PProof [PTactic]

Proof script

PTactics [PTactic]

As PProof, but no auto solving

PElabError Err

Error to report on elaboration

PImpossible

Special case for declaring when an LHS can't typecheck

PCoerced PTerm

To mark a coerced argument, so as not to coerce twice

PUnifyLog PTerm

dump a trace of unifications when building term

PNoImplicits PTerm

never run implicit converions on the term

data PDo' t Source

Constructors

DoExp FC t 
DoBind FC Name t 
DoBindP FC t t 
DoLet FC Name t t 
DoLetP FC t t 

Instances

Functor PDo' 
Eq t => Eq (PDo' t) 
Binary t => Binary (PDo' t) 
NFData t => NFData (PDo' t) 
Sized a => Sized (PDo' a) 

data PArg' t Source

Constructors

PImp 

Fields

priority :: Int
 
machine_inf :: Bool
 
lazyarg :: Bool
 
pname :: Name
 
getTm :: t
 
pargdoc :: String
 
PExp 

Fields

priority :: Int
 
lazyarg :: Bool
 
getTm :: t
 
pargdoc :: String
 
PConstraint 

Fields

priority :: Int
 
lazyarg :: Bool
 
getTm :: t
 
pargdoc :: String
 
PTacImplicit 

Fields

priority :: Int
 
lazyarg :: Bool
 
pname :: Name
 
getScript :: t
 
getTm :: t
 
pargdoc :: String
 

Instances

Functor PArg' 
Eq t => Eq (PArg' t) 
Show t => Show (PArg' t) 
Binary t => Binary (PArg' t) 
NFData t => NFData (PArg' t) 
Sized a => Sized (PArg' a) 

pimp :: Name -> t -> Bool -> PArg' tSource

pexp :: t -> PArg' tSource

ptacimp :: Name -> t -> t -> PArg' tSource

data TypeInfo Source

Constructors

TI 

Fields

con_names :: [Name]
 
codata :: Bool
 
param_pos :: [Int]
 

data DSL' t Source

Constructors

DSL 

Fields

dsl_bind :: t
 
dsl_return :: t
 
dsl_apply :: t
 
dsl_pure :: t
 
dsl_var :: Maybe t
 
index_first :: Maybe t
 
index_next :: Maybe t
 
dsl_lambda :: Maybe t
 
dsl_let :: Maybe t
 

Instances

Functor DSL' 
Show t => Show (DSL' t) 
Binary t => Binary (DSL' t) 
NFData t => NFData (DSL' t) 

prettyImpSource

Arguments

:: Bool

^ whether to show implicits

-> PTerm

^ the term to pretty-print

-> Doc 

Pretty-print a high-level Idris term

showNameSource

Arguments

:: Maybe IState

^ the Idris state, for information about names and colours

-> [(Name, Bool)]

^ the bound variables and whether they're implicit

-> Bool

^ whether to show implicits

-> Bool

^ whether to colourise

-> Name

^ the term to show

-> String 

Show Idris name

showImpSource

Arguments

:: Maybe IState

^ the Idris state, for information about identifiers and colours

-> Bool

^ whether to show implicits

-> Bool

^ whether to colourise

-> PTerm

^ the term to show

-> String 

Show Idris term