every-bit-counts-0.1: A functional pearl on encoding and decoding using question-and-answer strategies



data ISO t s Source




to :: t -> s
from :: s -> t

type Nat = IntSource

splitIso :: (a -> Bool) -> ISO a (Either a a)Source

listIso :: ISO [t] (Either () (t, [t]))Source

depListIso :: ISO [t] (Nat, [t])Source

idI :: ISO a aSource

seqI :: ISO a b -> ISO b c -> ISO a cSource

sumI :: ISO a b -> ISO c d -> ISO (Either a c) (Either b d)Source

prodI :: ISO a b -> ISO c d -> ISO (a, c) (b, d)Source

invI :: ISO a b -> ISO b aSource

swapProdI :: ISO (a, b) (b, a)Source

assocProdI :: ISO (a, (b, c)) ((a, b), c)Source

assocSumI :: ISO (Either a (Either b c)) (Either (Either a b) c)Source

prodRSumI :: ISO (a, Either b c) (Either (a, b) (a, c))Source

prodLSumI :: ISO (Either b c, a) (Either (b, a) (c, a))Source