interface Generic : Type -> List (List Type) -> Type Interface for converting a data type from and to
its generic representation as a sum of products.
Additional Idris coolness: This comes with proofs
that `from . to = id` and `to . from = id` and
thus, that `t` and `SOP code` are indeed isomorphic.
Parameters: t, code
Constructor: MkGeneric
Methods:
from : t -> SOP I code Converts the data type to its generic representation.
to : SOP I code -> t Converts the generic representation back to the original
value.
fromToId : (v : t) -> to (from v) = v Proof that `to . from = id`.
toFromId : (v : SOP I code) -> from (to v) = v Proof that `from . to = id`.
Implementations:
Generic () [[]] Generic (a, b) [[a, b]] Generic (LPair a b) [[a, b]] Generic Void [] Generic (Stream a) [[a, Inf (Stream a)]]
from : Generic t code => t -> SOP I code Converts the data type to its generic representation.
Totality: total
Visibility: public exportto : Generic t code => SOP I code -> t Converts the generic representation back to the original
value.
Totality: total
Visibility: public exportfromToId : {auto __con : Generic t code} -> (v : t) -> to (from v) = v Proof that `to . from = id`.
Totality: total
Visibility: public exporttoFromId : {auto __con : Generic t code} -> (v : SOP I code) -> from (to v) = v Proof that `from . to = id`.
Totality: total
Visibility: public exportfromInjective : {auto {conArg:13450} : Generic t code} -> (0 x : t) -> (0 y : t) -> from x = from y -> x = y- Totality: total
Visibility: export 0 Code : (t : Type) -> Generic t code => List (List Type)- Totality: total
Visibility: public export Tries to extract the arguments of a single constructor
from a value's generic representation.
Totality: total
Visibility: public export Tries to extract the value of a single one argument
constructor from a value's generic representation.
Totality: total
Visibility: public exportvaluesNP : Generic t code => EnumType code => NP_ (List Type) (K t) code Returns all value from a generic enum type
(all nullary constructors) wrapped in homogeneous n-ary product.
Totality: total
Visibility: public exportvalues : Generic t code => EnumType code => List t Returns all value from a generic enum type
(all nullary constructors) wrapped in a list.
Totality: total
Visibility: public exportvaluesForNP : (0 t : Type) -> Generic t code => EnumType code => NP_ (List Type) (K t) code Like `valuesNP` but takes the erased value type as an
explicit argument to help with type inference.
Totality: total
Visibility: public exportvaluesFor : (0 t : Type) -> Generic t code => EnumType code => List t Like `values` but takes the erased value type as an
explicit argument to help with type inference.
Totality: total
Visibility: public exportgenEq : Generic t code => POP Eq code => t -> t -> Bool Default `(==)` implementation for data types with a `Generic`
instance.
Totality: total
Visibility: public exportgenCompare : Generic t code => POP Ord code => t -> t -> Ordering Default `compare` implementation for data types with a `Generic`
instance.
Totality: total
Visibility: public exportgenDecEq : Generic t code => POP DecEq code => (x : t) -> (y : t) -> Dec (x = y) Default `decEq` implementation for data types with a `Generic`
instance.
Totality: total
Visibility: public exportgenAppend : Generic t [ts] => POP Semigroup [ts] => t -> t -> t Default `(<+>)` implementation for data types with a `Generic`
instance.
Totality: total
Visibility: public exportgenNeutral : Generic t [ts] => POP Monoid [ts] => t Default `neutral` implementation for data types with a `Generic`
instance.
Totality: total
Visibility: public export