
It is. -- https://hackage.haskell.org/package/base-4.12.0.0/docs/src/Control.Monad.Fai... instance MonadFail IO where fail = failIO -- https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.html#failI... failIO :: String -> IO a failIO s = IO (raiseIO# (toException (userError s))) Compare to -- https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Exception.... ioException :: IOException -> IO a ioException err = throwIO err -- https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Exception.... ioError :: IOError -> IO a ioError = ioException -- https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.html#throw... throwIO :: Exception e => e -> IO a throwIO e = IO (raiseIO# (toException e)) - Oleg On 25.11.2019 13.37, Henning Thielemann wrote:
On Mon, 25 Nov 2019, Bertram Felgenhauer via Libraries wrote:
Oleg Grenrus wrote:
I cannot see any justification for that instance
-- | @since 4.11.0.0 instance Fail.MonadFail (ST s) where fail s = errorWithoutStackTrace s
It's certainly not in the spirit of the MonadFail proposal. Arguably, *all* implementations of `fail` in terms of `error*` are wrong, even the one for IO. (I suspect dropping the instance for IO would cause a lot of pain though...)
Isn't fail in IO a synonym for (ioError . userError) ?
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries