A generalization of 'map' to arrows
root
--------------------------------------------------------------------------------
A generalization of 'map' to arrows.
--------------------------------------------------------------------------------
Examples of “mapA”:
ghci> mapA (^2) [1..5] -- or:
ghci> mapA `frun` (fid (^2)) `frun` [1..5]
[1,4,9,16,25]
ghci> mapA Just [1..5] -- or:
ghci> mapA (fid Just) `frun` [1..5]
[Just 1,Just 2,Just 3,Just 4,Just 5]
ghci> mapA (kid Just) `krun` [1..5]
Just [1,2,3,4,5]
ghci> mapA (kid print) `krun` [1..5]
1
2
3
4
5
[(),(),(),(),()]
--------------------------------------------------------------------------------
Examples for “mapA'”:
ghci> mapA' Just [1..5] -- or:
ghci> mapA' `frun` (fid Just) `frun` [1..5]
[Just 1,Just 2,Just 3,Just 4,Just 5]