| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Optic.Iso
Contents
Description
The iso: the bottom of the subtyping lattice, usable as every other flavor. IsoFl is
the conjunction of the five maximal flavors (LensFl,
PrismFl, PowerGrateFl,
MonLensFl and TracerFl). Build with
iso, and eliminate to the two legs with withIso via the Yo carrier. That carrier also
eliminates re-versed isos, a conversion the subtyping lattice itself cannot
express. fromPIso/toPIso mediate with the profunctor-class-flavored PIso.
Synopsis
- class (LensFl p q, PrismFl p q, PowerGrateFl p q, MonLensFl p q, TracerFl p q) => IsoFl (p :: k +-> k) (q :: k +-> k)
- type Iso (s :: k) (t :: k) (a :: k) (b :: k) = Optic (Prostrong (IsoFl :: (k +-> k) -> (k +-> k) -> Constraint)) s t a b
- type Iso' (s :: k) (a :: k) = Iso s s a a
- withIso :: forall {k} (c :: (k -> k -> Type) -> Constraint) (s :: k) (t :: k) (a :: k) (b :: k) r. (CategoryOf k, (Ob a, Ob b) => c (Yo a ('OP b))) => Optic c s t a b -> ((s ~> a) -> (b ~> t) -> r) -> r
- class CategoryOf k => DecidableIso k where
- isoFromEquality :: forall {k} (c :: (k +-> k) -> Constraint) (a :: k) (b :: k). (CategoryOf k, Ob a) => Maybe (a :~: b) -> Maybe (Optic c a a b b)
- fromPIso :: forall {k} (s :: k) (t :: k) (a :: k) (b :: k). CategoryOf k => PIso s t a b -> Iso s t a b
- toPIso :: forall {k} (s :: k) (t :: k) (a :: k) (b :: k). CategoryOf k => Iso s t a b -> PIso s t a b
Documentation
class (LensFl p q, PrismFl p q, PowerGrateFl p q, MonLensFl p q, TracerFl p q) => IsoFl (p :: k +-> k) (q :: k +-> k) Source Github #
type Iso (s :: k) (t :: k) (a :: k) (b :: k) = Optic (Prostrong (IsoFl :: (k +-> k) -> (k +-> k) -> Constraint)) s t a b Source Github #
withIso :: forall {k} (c :: (k -> k -> Type) -> Constraint) (s :: k) (t :: k) (a :: k) (b :: k) r. (CategoryOf k, (Ob a, Ob b) => c (Yo a ('OP b))) => Optic c s t a b -> ((s ~> a) -> (b ~> t) -> r) -> r Source Github #
class CategoryOf k => DecidableIso k where Source Github #
Categories where it can be decided whether two objects are isomorphic, with an isomorphism
when they are. The iso is an optic of any flavor c, so it can be used as a
PIso, an Iso or anything those convert to, and taken apart with withIso.
Methods
isoOf :: forall (c :: (k +-> k) -> Constraint) (a :: k) (b :: k). (Ob a, Ob b) => Maybe (Optic c a a b b) Source Github #
Instances
| DecidableIso FINREL Source Github # |
|
| DecidableIso DOT Source Github # | Two objects are isomorphic when they have the same wires. |
| DecidableIso SVG Source Github # | Two objects are isomorphic when they have the same wires. |
| Num a => DecidableIso (MatK a) Source Github # |
|
| Scalar e => DecidableIso (TNET e) Source Github # | Two objects are isomorphic when they have the same dimensions. |
isoFromEquality :: forall {k} (c :: (k +-> k) -> Constraint) (a :: k) (b :: k). (CategoryOf k, Ob a) => Maybe (a :~: b) -> Maybe (Optic c a a b b) Source Github #
The identity iso when two objects are equal.
fromPIso :: forall {k} (s :: k) (t :: k) (a :: k) (b :: k). CategoryOf k => PIso s t a b -> Iso s t a b Source Github #
The two iso encodings are equivalent: this direction instantiates the
profunctor-class-flavored iso at the free IsoFl-strong profunctor ExOptic ,
which needs nothing beyond its IsoFl a bProfunctor instance.
toPIso :: forall {k} (s :: k) (t :: k) (a :: k) (b :: k). CategoryOf k => Iso s t a b -> PIso s t a b Source Github #
The other direction of the equivalence, by eliminating to legs and rebuilding.