pointless-lenses-0.0.5: Pointless Lenses librarySource codeContentsIndex
Generics.Pointless.Lenses.Examples.Examples
Portabilitynon-portable
Stabilityexperimental
Maintainerhpacheco@di.uminho.pt
Description

Pointless Lenses: bidirectional lenses with point-free programming

This module provides examples, examples and more examples.

Synopsis
succ_lns :: Lens Int Int
length_lns :: a -> Lens [a] Nat
len_lns :: Lens ([Char], Int) Int
zip_lns :: Lens ([a], [a]) [(a, a)]
take_lns :: Lens (Nat, [a]) [a]
filter_lns :: Lens [Either a b] [a]
cat_lns :: Lens ([a], [a]) [a]
transpose_lns :: Lens ([a], [a]) [a]
add_lns :: Lens (Int, Int) Int
sumInt_lns :: Lens [Int] Int
plus_lns :: Lens (Nat, Nat) Nat
sumNat_lns :: Lens [Nat] Nat
flatten_lns :: Lens (Tree a) [a]
concat_lns :: Lens [[a]] [a]
map_lns :: Lens c a -> Lens [c] [a]
data T a
= Fst a
| Next (T a)
aux :: T a -> a
Documentation
succ_lns :: Lens Int IntSource
Integer successor lens.
length_lns :: a -> Lens [a] NatSource
List length lens.
len_lns :: Lens ([Char], 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.
zip_lns :: Lens ([a], [a]) [(a, a)]Source
List zipping lens. The aux transformation is merely for simplifying the constant argument
take_lns :: Lens (Nat, [a]) [a]Source
Take the first n elements from a list
filter_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
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.
add_lns :: Lens (Int, Int) IntSource
sumInt_lns :: Lens [Int] IntSource
Sum of a list of integers.
plus_lns :: Lens (Nat, Nat) NatSource
sumNat_lns :: Lens [Nat] NatSource
flatten_lns :: Lens (Tree a) [a]Source
Flatten a tree.
concat_lns :: Lens [[a]] [a]Source
List concatenation.
map_lns :: Lens c a -> Lens [c] [a]Source
List mapping lens.
data T a Source
Generic mapping example using user-defined concrete generators
Constructors
Fst a
Next (T a)
show/hide Instances
Eq a => Eq (T a)
Show a => Show (T a)
Mu (T a)
aux :: T a -> aSource
Produced by Haddock version 2.7.2