concise-0.1.0.0: Utilities for Control.Lens.Cons

Safe HaskellNone
LanguageHaskell2010

Control.Lens.Cons.Extras

Synopsis

Documentation

recons :: (Cons s1 s1 a a, Cons s2 s2 a a, AsEmpty s2) => Getter s1 s2 Source #

Convert one type with a Cons instance into the other.

Rewrite rules are provided for efficient conversion between String and Text, [Word8] and ByteString, and lazy and strict Text and ByteString. Programs must be compiled with -O to use them.

Although the type does not prove it, if (recons . recons) exists it should obey:

recons . recons ≡ id

unfoldr :: (Cons s2 s2 a a, AsEmpty s2) => (s1 -> Maybe (a, s1)) -> s1 -> s2 Source #

unfoldr f = foldrOf (unfolded f) cons (_Empty # ())