[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell
Ryan Ingram
ryani.spam at gmail.com
Tue May 19 01:06:39 EDT 2009
On Mon, May 18, 2009 at 3:05 PM, Taral <taralx at gmail.com> wrote:
> 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
More information about the Haskell-Cafe
mailing list