Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | hpacheco@di.uminho.pt |
Pointless Lenses: bidirectional lenses with point-free programming
This module provides examples, examples and more examples.
- preOrd_lns :: Lens (Tree a) [a]
- postOrd_lns :: Lens (Tree a) [a]
- length_lns :: a -> Lens [a] Nat
- zipWith_lns :: Lens (a, b) c -> Lens ([a], [b]) [c]
- zip_lns :: Lens ([a], [b]) [(a, b)]
- take_lns :: Lens (Nat, [a]) [a]
- filter_left_lns :: Lens [Either a b] [a]
- filter_right_lns :: Lens [Either a b] [b]
- cat_lns :: Lens ([a], [a]) [a]
- transpose_lns :: Lens ([a], [a]) [a]
- plus_lns :: Lens (Nat, Nat) Nat
- suml_lns :: Lens [Nat] Nat
- concatMap_lns :: Lens a [b] -> Lens [a] [b]
- concat_lns :: Lens [[a]] [a]
- partition_lns :: Lens [Either a b] ([a], [b])
- map_lns :: Lens c a -> Lens [c] [a]
- head_lns :: [a] -> Lens [a] (Either One a)
- tail_lns :: a -> Lens [a] (Either One [a])
- snoc_lns :: Lens (a, [a]) (Some a)
- toSome_lns :: Lens [a] (Either One (Some a))
- some_lns :: Eq a => a -> Lens [a] (Some a)
- fromSome_lns :: Lens (Either One (Some a)) [a]
- eitherNilSnoc :: Lens (Either One (a, [a])) [a]
- reverse_lns :: Lens [a] [a]
- len_lns :: Lens ([a], Int) Int
- add_lns :: Lens (Int, Int) Int
- sumInt_lns :: Lens [Int] Int
- isum_lns :: Lens [Int] [Int]
Lenses over trees
preOrd_lns :: Lens (Tree a) [a]Source
Flatten a tree into a list.
postOrd_lns :: Lens (Tree a) [a]Source
Flatten a tree into a list.
Lenses over lists and natural numbers
length_lns :: a -> Lens [a] NatSource
List length lens.
zipWith_lns :: Lens (a, b) c -> Lens ([a], [b]) [c]Source
filter_left_lns :: Lens [Either a b] [a]Source
List filtering lens.
The argument passed to snd_lns
can be undefined because it will never be used
filter_right_lns :: Lens [Either a b] [b]Source
cat_lns :: Lens ([a], [a]) [a]Source
Binary list concatenation. Lens hylomorphisms can be defined as the composition of a catamorphism after an anamorphism.
transpose_lns :: Lens ([a], [a]) [a]Source
Binary list transposition.
Binary version of transpose
.
concatMap_lns :: Lens a [b] -> Lens [a] [b]Source
concat_lns :: Lens [[a]] [a]Source
List concatenation.
partition_lns :: Lens [Either a b] ([a], [b])Source
Partitions a list of options into two lists. Note that this imposes some redefinement of the traditional definition in order to fit our framework.
Reverse
snoc_lns :: Lens (a, [a]) (Some a)Source
Inserts an element at the end of a list, thus making it non-empty.
toSome_lns :: Lens [a] (Either One (Some a))Source
Isomorphism between a list and an optional non-empty list.
fromSome_lns :: Lens (Either One (Some a)) [a]Source
Isomorphism between a list and an optional non-empty list.
eitherNilSnoc :: Lens (Either One (a, [a])) [a]Source
reverse_lns :: Lens [a] [a]Source
The list reversal lens is an isomorphism.
Non-natural lenses
len_lns :: Lens ([a], Int) IntSource
List length using an accumulation (after simplification into an hylomorphism).
Uses Int
instead of Nat
because succ
on Nat
is not a valid lens.
sumInt_lns :: Lens [Int] IntSource
Sum of a list of integers.