A better type signature for `forM_`
davean
davean at xkcd.com
Fri Apr 1 14:23:24 UTC 2016
On Fri, Apr 1, 2016 at 1:13 AM, Erik de Castro Lopo <mle+hs at mega-nerd.com>
wrote:
> Which is the exact problem. I suspect that most people use `forM_` as
> "assume
> the action returns unit" rather than "assume the return value of the
> action is
> ignored".
>
A review of my code shows I mostly use it as "assume the return value of
the action is ignored".
Many things return data that is sometimes useful, but not always. Rarely do
they have an '_' variant or the like to allow you to be more specific.
I wouldn't find it to be overly onerous to throw "void" in in those cases
though.
I will point out that "void" isn't exported from the Prelude, while "mapM_"
is.
-davean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160401/79914160/attachment.html>
More information about the Libraries
mailing list