darcs-2.18.5: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.UI.Options.Iso

Contents

- Isomorphisms

Synopsis

- data Iso a b = Iso (a -> b) (b -> a)
- class IsoFunctor (f :: Type -> Type) where
  - imap :: Iso a b -> f a -> f b
- under :: Functor f => Iso a b -> Iso (f a) (f b)
- cps :: Iso a b -> Iso (a -> c) (b -> c)

# Isomorphisms

data Iso a b #

Lightweight type ismomorphisms (a.k.a. invertible functions). If

    Iso fw bw :: Iso a b

then `fw` and `bw` are supposed to satisfy

    fw . bw = id = bw . fw

Constructors

Iso (a -> b) (b -> a) |

class IsoFunctor (f :: Type -> Type) where #

Lift an isomorphism between `a` and `b` to one between `f a` and `f b`. Like `Functor`, except we can only map invertible functions (i.e. an Isomorphisms).

Methods

imap :: Iso a b -> f a -> f b #

#### Instances

Instances details

IsoFunctor (RawOptSpec f) # |
Instance details Defined in Darcs.UI.Options.Util Methods imap :: Iso a b -> RawOptSpec f a -> RawOptSpec f b #
IsoFunctor (OptSpec d f a) # |
Instance details Defined in Darcs.UI.Options.Core Methods imap :: Iso a0 b -> OptSpec d f a a0 -> OptSpec d f a b #

under :: Functor f => Iso a b -> Iso (f a) (f b) #

Apply an iso under a functor.

cps :: Iso a b -> Iso (a -> c) (b -> c) #

Apply an iso under cps (which is a cofunctor).