<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>It is.<br>
<br>
-- <a
href="https://hackage.haskell.org/package/base-4.12.0.0/docs/src/Control.Monad.Fail.html#line-80">https://hackage.haskell.org/package/base-4.12.0.0/docs/src/Control.Monad.Fail.html#line-80</a><br>
instance MonadFail IO where<br>
fail = failIO<br>
<br>
-- <a
href="https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.html#failIO">https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.html#failIO</a><br>
failIO :: String -> IO a<br>
failIO s = IO (raiseIO# (toException (userError s)))<br>
<br>
Compare to<br>
</p>
<p>-- <a
href="https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Exception.html#ioException">https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Exception.html#ioException</a><br>
ioException :: IOException -> IO a<br>
ioException err = throwIO err<br>
<br>
-- <a
href="https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Exception.html#ioError">https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Exception.html#ioError</a><br>
ioError :: IOError -> IO a<br>
ioError = ioException<br>
<br>
-- <a
href="https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.html#throwIO">https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.html#throwIO</a><br>
throwIO :: Exception e => e -> IO a<br>
throwIO e = IO (raiseIO# (toException e))</p>
<p>- Oleg<br>
</p>
<div class="moz-cite-prefix">On 25.11.2019 13.37, Henning Thielemann
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:alpine.DEB.2.20.1911251236100.3596@sputnik">
<br>
On Mon, 25 Nov 2019, Bertram Felgenhauer via Libraries wrote:
<br>
<br>
<blockquote type="cite">Oleg Grenrus wrote:
<br>
<blockquote type="cite">I cannot see any justification for that
instance
<br>
<br>
-- | @since 4.11.0.0
<br>
instance Fail.MonadFail (ST s) where
<br>
fail s = errorWithoutStackTrace s
<br>
</blockquote>
<br>
It's certainly not in the spirit of the MonadFail proposal.
Arguably,
<br>
*all* implementations of `fail` in terms of `error*` are wrong,
even
<br>
the one for IO. (I suspect dropping the instance for IO would
cause a
<br>
lot of pain though...)
<br>
</blockquote>
<br>
Isn't fail in IO a synonym for (ioError . userError) ?<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Libraries mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libraries@haskell.org">Libraries@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a>
</pre>
</blockquote>
</body>
</html>