[Haskell-cafe] workarounds for Codec.Compression.Zlib errors in darcs

Neil Mitchell ndmitchell at gmail.com
Mon Dec 1 10:08:54 EST 2008

> While that's true, Haskell also makes it easy to make the same sort of
> error with IO (or any other Monad) values, whether created with the FFI
> or not. If you say
>    f = do x
>           y
>           z
> and y has type IO CInt then you won't get an error (and I don't think
> you can even ask for a warning with the current implementations).
> Should we have
>    (>>) :: (Monad m) => m () -> m a -> m a
> and force you to write
>    _ <- y

It's intersting to note that F# follows exactly your proposal. If x
has a return type other than () then you do:

y |> ignore

where ignore :: a -> (), and |> = flip ($)

In practice, I found this quite reasonable to use. You also eliminate
"errors" such as:

do mapM deleteFile files ; return 1

Where mapM requires more memory than the equivalent mapM_



More information about the Haskell-Cafe mailing list