finitary-optics-1.0.0.0: Prisms and Isos between finitary types.
Copyright (C) Koz Ross 2020 GPL version 3.0 or later koz.ross@retro-freedom.nz Experimental GHC only Trustworthy Haskell2010

Data.Finitary.Optics

Description

Synopsis

# 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 Isos, 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 Prisms, 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'.