Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data An_Iso :: OpticKind
- type Iso s t a b = Optic An_Iso '[] s t a b
- type Iso' s a = Optic' An_Iso '[] s a
- toIso :: Is k An_Iso => Optic k is s t a b -> Optic An_Iso is s t a b
- iso :: (s -> a) -> (b -> t) -> Iso s t a b
- withIso :: Is k An_Iso => Optic k is s t a b -> ((s -> a) -> (b -> t) -> r) -> r
- mapping :: (Is k An_Iso, Functor f, Functor g) => Optic k '[] s t a b -> Iso (f s) (g t) (f a) (g b)
- curried :: Iso ((a, b) -> c) ((d, e) -> f) (a -> b -> c) (d -> e -> f)
- uncurried :: Iso (a -> b -> c) (d -> e -> f) ((a, b) -> c) ((d, e) -> f)
- flipped :: Iso (a -> b -> c) (a' -> b' -> c') (b -> a -> c) (b' -> a' -> c')
- class Bifunctor p => Swapped p where
- module Optics.Optic
Documentation
Tag for an iso.
Instances
toIso :: Is k An_Iso => Optic k is s t a b -> Optic An_Iso is s t a b #
Explicitly cast an optic to an iso.
withIso :: Is k An_Iso => Optic k is s t a b -> ((s -> a) -> (b -> t) -> r) -> r #
Extract the two components of an isomorphism.
Isomorphisms
mapping :: (Is k An_Iso, Functor f, Functor g) => Optic k '[] s t a b -> Iso (f s) (g t) (f a) (g b) #
flipped :: Iso (a -> b -> c) (a' -> b' -> c') (b -> a -> c) (b' -> a' -> c') #
The isomorphism for flipping a function.
>>>
(view flipped (,)) 1 2
(2,1)
module Optics.Optic