> 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_

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to