
28 Mar
2012
28 Mar
'12
4:19 p.m.
On 28 March 2012 22:05, Matthew Steele
Doesn't for already exist, in Data.Traversable? Except that for = flip traverse.
Traverse doesn't fit the type of fmap, it demands an extra type constructor: traverse :: (Traversable t,Applicative f) => (a -> f b) -> t a -> f (t b) fmap :: Functor f => (a -> b) -> f a -> f b Note the (a -> f b) instead of (a -> b). E.g. fmap :: (a -> b) -> [a] -> [b] can't be expressed with traverse, you can only get this far: traverse :: (a -> [b]) -> [a] -> [[b]] Unless I'm missing something.