Copyright | (C) 2013-2016 Edward Kmett 2018 Monadfix |
---|---|
License | BSD-style (see the file LICENSE) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t)
- type Iso' s a = Iso s s a a
- type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t)
- type Prism' s a = Prism s s a a
Documentation
type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t) Source #
The type signature of iso
provides a nice interpretation of
Iso
. If you want to apply a function a -> b
to a type s
, you'd have to
convert with s -> a
, apply your function a -> b
, and convert back with
b -> t
.
iso
:: (s -> a) -> (b -> t) -> Iso s t a b -- or, put monomorphicallyiso
:: (s -> a) -> (a -> s) -> Iso' s a
type Iso' s a = Iso s s a a Source #
The type of monomorphic isomorphisms, i.e. isos that change neither the outer type
s
nor the inner type a
.
type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t) Source #
s
is the type of the whole structuret
is the type of the reconstructed structurea
is the type of the targetb
is the type of the value used for reconstruction