Copyright | (C) Koz Ross 2020 |
---|---|

License | GPL version 3.0 or later |

Maintainer | koz.ross@retro-freedom.nz |

Stability | Experimental |

Portability | GHC only |

Safe Haskell | Trustworthy |

Language | Haskell2010 |

## Synopsis

- reindexed :: (Finitary a, Finitary b, Cardinality a ~ Cardinality b) => Iso' a b
- tighter :: (Finitary a, Finitary b, Cardinality b <= Cardinality a) => Prism' a b

# Documentation

reindexed :: (Finitary a, Finitary b, Cardinality a ~ Cardinality b) => Iso' a b Source #

Types with identical cardinalities can be freely interconverted by way of their indexes.

This is actually stronger than most `Iso`

s, as it also ensures that order is
preserved; namely, if `x < y`

, then `view reindexed x < view reindexed y`

.

tighter :: (Finitary a, Finitary b, Cardinality b <= Cardinality a) => Prism' a b Source #

We can use indexes to convert a 'larger' type to a smaller one, and (possibly) vice-versa.

This is actually stronger than most `Prism`

s, as it also ensures that order
is preserved in both directions. Specifically, if `x < y`

, then:

`review tighter x < review tighter y`

; and- If
`preview tighter x == Just x'`

and`preview tighter y == Just y'`

, then`x' < y'`

.