3 ms·
I'm also assuming transduce and sequence are something like this type RT r a b = Red r a -> Red r b sequence :: RT [a] a b -> [b] -> [a] sequence
by tel 12y ago
I'm also assuming transduce and sequence are something like this
type RT r a b = Red r a -> Red r b
sequence :: RT [a] a b -> [b] -> [a]
sequence xform bs = transduce xform (flip (:)) [] bs
transduce :: RT r a b -> (r -> a -> r) -> r -> [b] -> r
transduce xform cons nil =
let (cons', nil') = xform (cons, nil)
in foldr (flip cons') nil'
but I can't find the actual source yet. Again, there's a weird flipping going on induced by the contravariance. It makes me want to define RT-composition backwards.