Portability | Rank2Types |
---|---|

Stability | provisional |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | Safe-Infered |

- class Category k => Isomorphic k where
- isomorphic :: (a -> b) -> (b -> a) -> k a b
- isomap :: ((a -> b) -> c -> d) -> ((b -> a) -> d -> c) -> k a b -> k c d

- data Isomorphism a b = Isomorphism (a -> b) (b -> a)
- from :: Isomorphic k => Isomorphism a b -> k b a
- via :: Isomorphic k => Isomorphism a b -> k a b

# Documentation

class Category k => Isomorphic k whereSource

Used to provide overloading of isomorphism application

This is a `Category`

with a canonical mapping to it from the
category of isomorphisms over Haskell types.

isomorphic :: (a -> b) -> (b -> a) -> k a bSource

Build this morphism out of an isomorphism

The intention is that by using `isomorphic`

, you can supply both halves of an
isomorphism, but k can be instantiated to `(->)`

, so you can freely use
the resulting isomorphism as a function.

isomap :: ((a -> b) -> c -> d) -> ((b -> a) -> d -> c) -> k a b -> k c dSource

Map a morphism in the target category using an isomorphism between morphisms in Hask.

data Isomorphism a b Source

A concrete data type for isomorphisms.

This lets you place an isomorphism inside a container without using `ImpredicativeTypes`

.

Isomorphism (a -> b) (b -> a) |

from :: Isomorphic k => Isomorphism a b -> k b aSource

via :: Isomorphic k => Isomorphism a b -> k a bSource

Convert from an `Isomorphism`

back to any `Isomorphic`

value.

This is useful when you need to store an isomoprhism as a data type inside a container and later reconstitute it as an overloaded function.