proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Optic.Iso

Description

The iso: the bottom of the subtyping lattice, usable as every other flavor. IsoFl is simply the conjunction of the five maximal flavors (LensFl, PrismFl, PowerGrateFl, MonLensFl and TracerFl). Build with iso, eliminate to the two legs with withIso via the Yo carrier -- which also eliminates re-versed isos, a conversion the subtyping lattice itself cannot express; fromPIso/toPIso mediate with the profunctor-class-flavored PIso.

Synopsis

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 #

The iso flavor. Reversed isos still view/preview/fold (re iso is a getter, and more), through the GetterFl q p superclass of PrismFl.

Instances

Instances details
(LensFl p q, PrismFl p q, PowerGrateFl p q, MonLensFl p q, TracerFl p q) => IsoFl (p :: k +-> k) (q :: k +-> k) Source Github # 
Instance details

Defined in Proarrow.Optic.Iso

type Iso (s :: k) (t :: k) (a :: k) (b :: k) = Optic (Prostrong (IsoFl :: (k +-> k) -> (k +-> k) -> Constraint)) s t a b Source Github #

The Prostrong-flavored iso; for the profunctor-class-flavored encoding see PIso.

type Iso' (s :: k) (a :: k) = Iso s s a a 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 #

Eliminate any iso-flavored optic to its two legs, in either encoding -- including the profunctor-class-flavored PIso and reversed (re) isos.

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 IsoFl a b, which needs nothing beyond its Profunctor 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.

Orphan instances

(CategoryOf k, forall (p :: k +-> k) (q :: k +-> k). w p q => Sub (IsoFl :: (k +-> k) -> (k +-> k) -> Constraint) p q) => Prostrong (w :: FLAVOR k k) (Yo a ('OP b) :: k -> k -> Type) Source Github #

Any flavor whose optics are isos has strength for the Yo profunctor.

Instance details

Methods

proact :: forall (f :: k +-> k) (g :: k +-> k). (w f g, Profunctor f, Profunctor g) => ((f :.: Yo a ('OP b)) :.: g) :~> Yo a ('OP b) Source Github #