Idris2Doc : Language.Reflection.Derive

Language.Reflection.Derive

(source)
Utility types and functions for automatically deriving
interface instances. So far, this module does not provide
deriving functions for existing interfaces. See
Doc.Generic4 for examples, how this could be done
using the functionality provided here.

Definitions

interfaceElaborateable : Type->Type
  Interface for named things that can be looked up by name using
elaborator reflection.

Parameters: a
Constraints: Named a
Methods:
find_ : Elaborationm=>Name->ma

Implementation: 
ElaborateableTypeInfo
find_ : Elaborateablea=>Elaborationm=>Name->ma
Totality: total
Visibility: public export
find : (0a : Type) ->Elaborateablea=>Elaborationm=>Name->ma
  Utility version of `find_` taking an explicit type argument.

Totality: total
Visibility: public export
funName : Nameda=>a->String->Name
  Generates the name of a function implementing some functionality
for the given type.

Totality: total
Visibility: export
implName : Nameda=>a->String->Name
  Generates the name of an interface's implementation function

Totality: total
Visibility: export
recordBoundArg : Nat-> (Arg->Type) ->Type
  A single constructor argument, for which we have `n` bound
variables on the left hand side of a pattern match clause, and
which is refined by predicate `p`.

Totality: total
Visibility: public export
Constructor: 
BA : (arg : Arg) ->VectnName->parg->BoundArgnp

Projections:
.arg : BoundArgnp->Arg
.prf : ({rec:0} : BoundArgnp) ->p (arg{rec:0})
.vars : BoundArgnp->VectnName
.arg : BoundArgnp->Arg
Totality: total
Visibility: public export
arg : BoundArgnp->Arg
Totality: total
Visibility: public export
.vars : BoundArgnp->VectnName
Totality: total
Visibility: public export
vars : BoundArgnp->VectnName
Totality: total
Visibility: public export
.prf : ({rec:0} : BoundArgnp) ->p (arg{rec:0})
Totality: total
Visibility: public export
prf : ({rec:0} : BoundArgnp) ->p (arg{rec:0})
Totality: total
Visibility: public export
split : Vectk (Vect (Sn) a) -> (Vectka, Vectk (Vectna))
Totality: total
Visibility: public export
boundArgs : ((a : Arg) ->Maybe (pa)) ->VectnArg->Vectk (VectnName) ->SnocList (BoundArgkp)
  Refine a list of constructor arguments with the given predicate
and pair them with a number of bound variable names.

Totality: total
Visibility: export
dataExplicit : Arg->Type
Totality: total
Visibility: public export
Constructor: 
IsExplicit : Explicit (MkArgcExplicitArgnt)
explicit : (a : Arg) ->Maybe (Explicita)
Totality: total
Visibility: public export
dataNamedArg : Arg->Type
Totality: total
Visibility: public export
Constructor: 
IsNamed : NamedArg (MkArgcp (Just (UN (Basicn))) t)
named : (a : Arg) ->Maybe (NamedArga)
Totality: total
Visibility: public export
argName : (a : Arg) -> {auto0_ : NamedArga} ->Name
Totality: total
Visibility: public export
dataUnerased : Arg->Type
Totality: total
Visibility: public export
Constructors:
U1 : Unerased (MkArgM1pnt)
UW : Unerased (MkArgMWpnt)
unerased : (a : Arg) ->Maybe (Uneraseda)
Totality: total
Visibility: public export
dataErased : Arg->Type
Totality: total
Visibility: public export
Constructor: 
IsErased : Erased (MkArgM0pnt)
erased : (a : Arg) ->Maybe (Eraseda)
Totality: total
Visibility: public export
0Regular : Arg->Type
Totality: total
Visibility: public export
regular : (a : Arg) ->Maybe (Regulara)
Totality: total
Visibility: public export
0RegularNamed : Arg->Type
Totality: total
Visibility: public export
regularNamed : (a : Arg) ->Maybe (RegularNameda)
Totality: total
Visibility: public export
0NamedExplicit : Arg->Type
Totality: total
Visibility: public export
namedExplicit : (a : Arg) ->Maybe (NamedExplicita)
Totality: total
Visibility: public export
toNamed : BoundArgnp->Maybe (BoundArgn (\a=> (NamedArga, pa)))
Totality: total
Visibility: public export
failRecord : String->Resa
Totality: total
Visibility: export
accumArgs : ((a : Arg) ->Maybe (pa)) -> (TTImp->TTImp) -> (SnocListTTImp->TTImp) -> (BoundArg1p->TTImp) ->Connvs->Clause
  Generates a pattern clause for accumulating the arguments
of a singled data constructor.

This is used, for instance, to implement `showPrec`, when
deriving `Show` implementations.

@ p : The predicate used to refine the constructor's arguments

@ f : Refining function.

@ lhs : Adjusts the left-hand side of the clause.
The argument corresponds to the constructor with
all explicit arguments bound to variables named
`x0`, `x1` etc.

@ rhs : Adjusts the right-hand side of the clause.
The `SnocList` contains the arguments, as transformed
by `arg`.

@ arg : Processes a single argument

@ con : The constructor to process.

Totality: total
Visibility: export
accumArgs2 : ((a : Arg) ->Maybe (pa)) -> (TTImp->TTImp->TTImp) -> (SnocListTTImp->TTImp) -> (BoundArg2p->TTImp) ->Connvs->Clause
  Generates a pattern clause for accumulating the arguments
of two equivalent data constructors.

This is used, for instance, to implement `(==)`, when
deriving `Eq` implementations.

@ p : The predicate used to refine the constructor's arguments

@ f : Refining function.

@ lhs : Adjusts the left-hand side of the clause.
The first argument corresponds to the constructor with
all explicit arguments bound to variables named
`x0`, `x1` etc., the second to the constructor
with bound explicit arguments namd `y0`, `y1` etc.

@ rhs : Adjusts the right-hand side of the clause.
The `SnocList` contains the arguments, as transformed
by `arg`.

@ arg : Processes a single pair of arguments

@ con : The constructor to process.

Totality: total
Visibility: export
mapArgs : ((a : Arg) ->Maybe (pa)) -> (TTImp->TTImp) -> (BoundArg1p->TTImp) ->Connvs->Clause
  Generates a pattern clause for mapping the arguments
of a data constructors over a unary function.

This is used, for instance, to implement `abs`, when
deriving `Abs` implementations.

@ p : The predicate used to refine the constructor's arguments

@ f : Refining function.

@ lhs : Adjusts the left-hand side of the clause.
The argument corresponds to the constructor with
all explicit arguments bound to variables named
`x0`, `x1` etc.

@ arg : Processes a single argument

@ con : The constructor to process.

Totality: total
Visibility: export
mapArgs2 : ((a : Arg) ->Maybe (pa)) -> (TTImp->TTImp->TTImp) -> (BoundArg2p->TTImp) ->Connvs->Clause
  Generates a pattern clause for mapping the arguments
of two data constructors over a binary function.

This is used, for instance, to implement `(+)`, when
deriving `Num` implementations.

@ p : The predicate used to refine the constructor's arguments

@ f : Refining function.

@ lhs : Adjusts the left-hand side of the clause.
The first argument corresponds to the constructor with
all explicit arguments bound to variables named
`x0`, `x1` etc., the second to the constructor
with bound explicit arguments namd `y0`, `y1` etc.

@ arg : Processes a pair of arguments

@ con : The constructor to process.

Totality: total
Visibility: export
injArgs : ((a : Arg) ->Maybe (pa)) -> (BoundArg0p->TTImp) ->Connvs->TTImp
  Generates a pattern clause for creating and applying
constructor arguments.

This is used, for instance, to implement `fromInteger`, when
deriving `Num` implementations for record types.

@ p : The predicate used to refine the constructor's arguments

@ f : Refining function.

@ arg : Processes a single argument

@ con : The constructor to process.

Totality: total
Visibility: export
recordTopLevel : Type
  A top-level declaration plus its definition.

Totality: total
Visibility: public export
Constructor: 
TL : Decl->Decl->TopLevel

Projections:
.claim : TopLevel->Decl
.defn : TopLevel->Decl
.claim : TopLevel->Decl
Totality: total
Visibility: public export
claim : TopLevel->Decl
Totality: total
Visibility: public export
.defn : TopLevel->Decl
Totality: total
Visibility: public export
defn : TopLevel->Decl
Totality: total
Visibility: public export
implClaimVis : Visibility->Name->TTImp->Decl
  Creates a function declaration with a `%hint` and `%inline`
annotation.

This is what you want if you use separate top-level function
for the interface's implementation and the actual implementation
just adds those functions to the interface constructor.

Totality: total
Visibility: public export
implClaim : Name->TTImp->Decl
  Creates a function declaration with a `%hint` and `%inline`
annotation.

This is what you want if you use separate top-level function
for the interface's implementation and the actual implementation
just adds those functions to the interface constructor.

Totality: total
Visibility: public export
implType : Name->ParamTypeInfo->TTImp
  Creates the function type for an interface implementation including
the required implicit and auto-implicit arguments.

For instance, if `Name` is `"Eq"` and the data type in question is
`Either` with parameter names `a` and `b`, the `TTImp` returned
corresponds to

```idris
{0 a : _} -> {0 b : _} -> Eq a => Eq b => Eq (Either a b)`
```

Totality: total
Visibility: export
unAppAny : TTImp->TTImp
  Extracts the innermost target of a function application.
For instance, for `Foo @{bar} baz {n = 12}`, this will extract `Foo`.

Totality: total
Visibility: export
extractResult : TTImp->Maybe (TTImp, Name)
  Tries to extract the result type from the current goal when
deriving custom interface implementations.

For instance, if the goal type is `Eq (Either a b)`, this
returns a `TTImp` corresponding to `Either a b` plus the
name of the data constructor `Either`.

Totality: total
Visibility: export
sequenceJoin : Applicativef=>List (f (Lista)) ->f (Lista)
Totality: total
Visibility: export
recordParamInfo : Type
Totality: total
Visibility: public export
Constructor: 
PI : Name-> ((n : Nat) ->Maybe (ExistsNat (ParamPatternn))) ->List (ListName->ParamTypeInfo->Res (ListTopLevel)) ->ParamInfo

Projections:
.goals : ParamInfo->List (ListName->ParamTypeInfo->Res (ListTopLevel))
.name : ParamInfo->Name
.strategy : ParamInfo-> (n : Nat) ->Maybe (ExistsNat (ParamPatternn))
.name : ParamInfo->Name
Totality: total
Visibility: public export
name : ParamInfo->Name
Totality: total
Visibility: public export
.strategy : ParamInfo-> (n : Nat) ->Maybe (ExistsNat (ParamPatternn))
Totality: total
Visibility: public export
strategy : ParamInfo-> (n : Nat) ->Maybe (ExistsNat (ParamPatternn))
Totality: total
Visibility: public export
.goals : ParamInfo->List (ListName->ParamTypeInfo->Res (ListTopLevel))
Totality: total
Visibility: public export
goals : ParamInfo->List (ListName->ParamTypeInfo->Res (ListTopLevel))
Totality: total
Visibility: public export
deriveParam : Elaborationm=>ListParamInfo->m ()
Totality: total
Visibility: export
allParams : (n : Nat) ->Maybe (ExistsNat (ParamPatternn))
Totality: total
Visibility: export
allIndices : (n : Nat) ->Maybe (ExistsNat (ParamPatternn))
Totality: total
Visibility: export
match : ParamPatternmk-> (n : Nat) ->Maybe (ExistsNat (ParamPatternn))
Totality: total
Visibility: export
deriveMutual : Elaborationm=>ListName->List (ListName->ParamTypeInfo->Res (ListTopLevel)) ->m ()
Totality: total
Visibility: export
derive : Elaborationm=>Name->List (ListName->ParamTypeInfo->Res (ListTopLevel)) ->m ()
  Given a name of a parameterized data type plus a list of
interface generation functions, tries
to implement these interfaces automatically using
elaborator reflection.

Again, see Doc.Generic4 for a tutorial and examples how
to use this.

Totality: total
Visibility: export
deriveIndexed : Elaborationm=>Name->List (ListName->ParamTypeInfo->Res (ListTopLevel)) ->m ()
Totality: total
Visibility: export
derivePattern : Elaborationm=>Name->ParamPatternnk->List (ListName->ParamTypeInfo->Res (ListTopLevel)) ->m ()
Totality: total
Visibility: export
mkEq : (a->a->Bool) ->Eqa
  Like `MkEq` but generates (/=) from the passed `eq` function.

Totality: total
Visibility: public export
mkOrd : Eqa=> (a->a->Ordering) ->Orda
  Creates an `Ord` value from the passed comparison function
using default implementations based on `comp` for all
other function.

Totality: total
Visibility: public export
mkShow : (a->String) ->Showa
  Creates a `Show` value from the passed `show` functions.

Totality: total
Visibility: public export
mkShowPrec : (Prec->a->String) ->Showa
  Creates a `Show` value from the passed `showPrec` functions.

Totality: total
Visibility: public export
mkDecEq : ((x1 : a) -> (x2 : a) ->Dec (x1=x2)) ->DecEqa
  Creates a `DecEq` value from the passed implementation function
for `decEq`

Totality: total
Visibility: public export