Idris2Doc : Libraries.Data.Record

Libraries.Data.Record

(source)
Modular records based on `All`

Reexports

importpublic Data.List.Quantifiers

Definitions

recordKeyVal : Type
  A type with a string-label for it. Used in `Record`

```idris example
IntLabel : KeyVal
IntLabel = "int" :-: Int
```

Totality: total
Visibility: public export
Constructor: 
(:-:) : String->Type->KeyVal

Projections:
.label : KeyVal->String
.type : KeyVal->Type

Hints:
All (Eq.type) fs=>Eq (Recordfs)
All (Eq.type) fs=>Eqa=>Eq (WithDatafsa)
Functor (WithDatamd)
All (TTC.type) fs=>TTC (Recordfs)
All (TTC.type) fs=>TTCa=>TTC (WithDatafsa)
.label : KeyVal->String
Visibility: public export
label : KeyVal->String
Visibility: public export
.type : KeyVal->Type
Visibility: public export
type : KeyVal->Type
Visibility: public export
recordLabelledValue : KeyVal->Type
  The value-constructor for `KeyVal`, essentially a pair of a label
and a value that match the specification given by `KeyVal`

```idris example
IntLabel : KeyVal
IntLabel = "int" :-: Int

intValue : LabelledValue IntLabel
intValue = "int" :- 3
```

Totality: total
Visibility: public export
Constructor: 
(:-) : (0label : String) -> {auto0_ : kv.label=label} ->kv.type->LabelledValuekv

Projections:
0.check : ({rec:0} : LabelledValuekv) ->kv.label=label{rec:0}
  A proof that the label given matches the label in the specification
0.label : LabelledValuekv->String
  The label matching the `KeyVal` spec, erased for performance reasons
.value : LabelledValuekv->kv.type
  A runtime value of the type given by the specification
0.label : LabelledValuekv->String
  The label matching the `KeyVal` spec, erased for performance reasons

Visibility: public export
0label : LabelledValuekv->String
  The label matching the `KeyVal` spec, erased for performance reasons

Visibility: public export
0.check : ({rec:0} : LabelledValuekv) ->kv.label=label{rec:0}
  A proof that the label given matches the label in the specification

Visibility: public export
0check : ({rec:0} : LabelledValuekv) ->kv.label=label{rec:0}
  A proof that the label given matches the label in the specification

Visibility: public export
.value : LabelledValuekv->kv.type
  A runtime value of the type given by the specification

Visibility: public export
value : LabelledValuekv->kv.type
  A runtime value of the type given by the specification

Visibility: public export
Record : ListKeyVal->Type
  Records are a list of of labelled values, their fields are given by a list of KeyVal
Each element in the list describes a key

```idris example
Spec : List KeyVal
Spec = [ "username" :-: String, "amount" :-: Double ]

recordValue : Record Spec
recordValue = [ "username" :- "Alice", "amount" :- 3.14 ]
```

Visibility: public export
fromElems : Alltypefs->Recordfs
  Build a record from it's element values ignoring the labels

```idris example
Spec : List KeyVal
Spec = [ "username" :-: String, "amount" :-: Double ]

recordValue : Record Spec
recordValue = fromElems [ "Alice", 3.14 ]
```

Visibility: export
tail : Allp (x::xs) ->Allpxs
  Obtain the tail of a list of predicates

Visibility: export
0FindIndex : Nat->ListKeyVal->MaybeType
  A procedue to find the type at the given index

Visibility: public export
0NameInRange : String->ListKeyVal->Maybe (Nat, Type)
  A procedure to find the index and type of a given label

Visibility: public export
add : (0str : String) ->ty->Recordfields->Record ((str:-:ty) ::fields)
  Add a label and a value to a record

Visibility: export
index : Recordfields-> (n : Nat) -> {auto0_ : FindIndexnfields=Justout} ->out
  Obtain the value from a record at given index
@ n The index at which we extract the value.
@ out The type of the value at the index.
@ inRange A proof that the field is in the record at the appropriate index with the appropriate type.

Visibility: export
get : (0label : String) ->Recordfields-> {auto0_ : NameInRangelabelfields=Just (n, out)} ->out
  Obtain the value from a record given its label.
@ field The field for which we extract the value.
@ n The index corresponding to the field given.
@ out The type of the value at the given field.
@ inRange A proof that the field is in the record at the appropriate index with the appropriate type.

Visibility: export
get' : (0label : String) -> (0out : Type) ->Recordfields-> {auto0_ : NameInRangelabelfields=Just (n, out)} ->out
  Obtain the value from a record given its label and type.
@ field The field for which we extract the value.
@ out The type of the value at the given field.
@ n The index corresponding to the field given.
@ inRange A proof that the field is in the record at the appropriate index with the appropriate type.

Visibility: export
ListRemoveAt : (fields : ListKeyVal) -> (n : Nat) ->IsJust (FindIndexnfields) =>ListKeyVal
  Remove a value from the list, used in the type of `removeAt`

Visibility: public export
removeAt : (n : Nat) -> {autoinRange : IsJust (FindIndexnfields)} ->Recordfields->Record (ListRemoveAtfieldsn)
  Remove the value at the given index.
@ n The index we are removing.
@ inRange A proof that the index is in range of the record spec.

Visibility: export
updateAt : (n : Nat) -> {auto0_ : FindIndexnfields=Justout} -> (out->out) ->Recordfields->Recordfields
  Update the value at the given index.
@ n The index we are removing.
@ inRange A proof that the index is in range of the record spec.
@ f The update function.

Visibility: export
update : (0label : String) -> {auto0_ : NameInRangelabelfields=Just (n, out)} -> (out->out) ->Recordfields->Recordfields
  Update the value with the given label.
@ field The label of the value we are updating.
@ inRange A proof that the label is in the record at the appropriate index with the appropriate type.
@ f The update function.

Visibility: export
setAt : (n : Nat) ->FindIndexnfields=Justout=>out->Recordfields->Recordfields
  Override the value found at the given index.
@ n The index we are removing.
@ inRange A proof that the index is in range of the record spec.
@ newVal The value that will replace the existing one.

Visibility: export
set : (0label : String) -> {auto0_ : NameInRangelabelfields=Just (n, out)} ->out->Recordfields->Recordfields
  Override the value found at the given label.
@ label The label of the value we are overriding.
@ inRange A proof that the label is in the record at the appropriate index with the appropriate type.
@ newVal The value that will replace the existing one.

Visibility: export