This module is an attempt to simplify the use of arrow combinators.
If I have
f :: arrow a b,
then subsequent arrows can only access the
but often I also want to access the
Thus I often write
f &&& arr id :: arrow a (b,a) .
If I repeat this, it yields
g &&& arr id <<< f &&& arr id :: arrow a (c,(b,a)) h &&& arr id <<< g &&& arr id <<< f &&& arr id :: arrow a (d,(c,(b,a))) .
However accessing the particular inputs of type
g is cumbersome.
Thus I wrote a little support for this style of arrow programming.
First I use
HList instead of nested pairs.
Using type level Peano numbers and reverse
HList index access
I can use the same expression (say
listen x) in both
although in both contexts they refer to different
g expects the
b input at the
h gets it one position later.
- (>>>=) :: (Arrow arrow, HLength list n) => arrow list a -> (n -> arrow (HCons a list) b) -> arrow list b
- (=<<<) :: (Arrow arrow, HLength list n) => (n -> arrow (HCons a list) b) -> arrow list a -> arrow list b
- class (HNat x, HNat y, HNat z) => HAdd x y z | x y -> z, x z -> y
- listen :: (Arrow arrow, HLength list len, HAdd n m len, HLookupByHNat m list a) => n -> arrow list a
bind-like operator allows you to a share an interim arrow result
between various following arrow inputs.
mix <<< id &&& delay <<< lowpass
you can write
(\x -> HL.hCons x HL.hNil) ^>> ((HL.hHead ^>> lowpass) >>>= \x -> mix <<< listen x &&& (delay <<< listen x))