
19 May
2009
19 May
'09
1:06 a.m.
On Mon, May 18, 2009 at 3:05 PM, Taral
Will this do?
(>>=) :: (NFData sa, NFData b) => LI sa -> (sa -> LI b) -> LI b
No, the problem is that >>= on monads has no constraints, it must have the type
LI a -> (a -> LI b) -> LI b
This is a common problem with trying to use do-notation; there are some cases where you can't make the object an instance of Monad. The same problem holds for Data.Set; you'd can write setBind :: Ord b => Set a -> (a -> Set b) -> Set b setBind m f = unions (map f $ toList m) but there is no way to use setBind for a definition of >>= -- ryan