record Iso : Type -> Type -> Type -> Type -> Type An Iso describes an isomorphism between two types.
Two types are isomorphic, if there is a lossless conversion
from one to the other and vice versa. Examples include the
(monomorphic) isomorphism from `String` to `List Char` and the
(polymorphic) isomorphism from `Either a b` to `Either b a`.
Isomorphisms must obey two identity laws:
`get_ . reverseGet` must be the identity function. The same holds
for `reverseGet . get_`.
Isomorphisms are the most powerful kinds of optics, and they can
be converted to all other optics in this library.
Totality: total
Visibility: public export
Constructor: I : (s -> a) -> (b -> t) -> Iso s t a b
Projections:
.get_ : Iso s t a b -> s -> a .reverseGet : Iso s t a b -> b -> t
Hints:
OSeq Iso Iso Iso OSeq Iso Lens Lens OSeq Iso Prism Prism OSeq Iso Optional Optional OSeq Iso Traversal Traversal OSeq Iso Getter Getter OSeq Iso Setter Setter OSeq Iso Fold Fold OSeq Lens Iso Lens OSeq Prism Iso Prism OSeq Optional Iso Optional OSeq Traversal Iso Traversal OSeq Setter Iso Setter OSeq Getter Iso Getter OSeq Fold Iso Fold ToFold Iso ToGetter Iso ToIso Iso ToLens Iso ToOptional Iso ToPrism Iso ToSetter Iso ToTraversal Iso
.get_ : Iso s t a b -> s -> a- Totality: total
Visibility: public export get_ : Iso s t a b -> s -> a- Totality: total
Visibility: public export .reverseGet : Iso s t a b -> b -> t- Totality: total
Visibility: public export reverseGet : Iso s t a b -> b -> t- Totality: total
Visibility: public export 0 Iso' : Type -> Type -> Type Convenience alias for monomorphic Isos, which do not allow
us to change the value and source types.
Totality: total
Visibility: public exportinterface ToIso : (Type -> Type -> Type -> Type -> Type) -> Type Interface for converting other optics to Isos.
Parameters: o
Methods:
toIso : o s t a b -> Iso s t a b
Implementation: ToIso Iso
toIso : ToIso o => o s t a b -> Iso s t a b- Totality: total
Visibility: public export rev : Iso s t a b -> Iso b a t s Isomorphisms are symmetric: If `x` is isomorphic to `y` then `y` is
isomorphic to `x`. This function describes this symmetry.
Totality: total
Visibility: public export(~>) : Iso s t a b -> Iso a b c d -> Iso s t c d Sequential composition of Isos.
This describes the transitivity of isomorphisms: If `x` is isomorphic to
`y` and `y` is isomorhic to `z`, then `x` is isomorphic to `z`.
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 0identity : Iso' a a Isomorphisms are reflexive: Every type is trivially isomorphic to itself.
Totality: total
Visibility: exportidL : Lens' a a The identity lens, derived from the corresponding isomorphism.
Totality: total
Visibility: exportidP : Prism' a a The identity prism, derived from the corresponding isomorphism.
Totality: total
Visibility: exportidO : Optional' a a The identity optional, derived from the corresponding isomorphism.
Totality: total
Visibility: exportidT : Traversal' a a The identity traversal, derived from the corresponding isomorphism.
Totality: total
Visibility: exportpack : Iso' (List Char) String Isomorphism between `List Char` and `String`.
Totality: total
Visibility: exportunpack : Iso' String (List Char) Isomorphism between `String` and `List Char`.
Totality: total
Visibility: exportchips : Iso (SnocList a) (SnocList b) (List a) (List b) Isomorphism between `SnocList` and `List`.
Totality: total
Visibility: exportfish : Iso (List a) (List b) (SnocList a) (SnocList b) Isomorphism between `List` and `SnocList`.
Totality: total
Visibility: exportswap : Iso (a, b) (c, d) (b, a) (d, c) Isomorphism between pairs with their values swapped.
Totality: total
Visibility: exportflip : Iso (a -> b -> c) (d -> e -> f) (b -> a -> c) (e -> d -> f) Isomorphism between binary functions with their arguments
swapped.
Totality: total
Visibility: exportuncurry : Iso (a -> b -> c) (d -> e -> f) ((a, b) -> c) ((d, e) -> f) Isomorphism between binary functions and functions taking
a pair of values as their argument.
Totality: total
Visibility: exportcurry : Iso ((a, b) -> c) ((d, e) -> f) (a -> b -> c) (d -> e -> f) Isomorphism between functions taking a pair as their argument
and binary functions.
Totality: total
Visibility: exportswapE : Iso (Either a b) (Either c d) (Either b a) (Either d c) Isomorphism between `Either a b` and `Either b a`.
Totality: total
Visibility: exportwithDefault : a -> Iso' (Maybe a) a Given a default value of type `a`, we can create an isomorphism between
`Maybe a` and values of type `a`.
This wraps every value of type `a` in a `Just`. In the other direction,
we use `fromMaybe` with the provided default value to extract a value
from a `Nothing`.
Totality: total
Visibility: exportleftVoid : Iso (Either Void a) (Either Void b) a b Isomorphism between `Either Void a` and `a`: The `Left` case
is impossible because `Void` is uninhabited.
Totality: total
Visibility: exportrightVoid : Iso (Either a Void) (Either b Void) a b Isomorphism between `Either a Void` and `a`: The `Right` case
is impossible because `Void` is uninhabited.
Totality: total
Visibility: exportany1 : Iso (Any f [a]) (Any g [b]) (f a) (g b) Isomorphism between a unary sum type and the wrapped value.
Totality: total
Visibility: export