Remove MonadFail (ST s) instance

Oleg Grenrus oleg.grenrus at iki.fi
Mon Nov 25 12:08:04 UTC 2019


It is.

-- 
https://hackage.haskell.org/package/base-4.12.0.0/docs/src/Control.Monad.Fail.html#line-80
instance MonadFail IO where
     fail = failIO

-- 
https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.html#failIO
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.html#ioException
ioException     :: IOException -> IO a
ioException err = throwIO err

-- 
https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Exception.html#ioError
ioError         :: IOError -> IO a
ioError         =  ioException

-- 
https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.html#throwIO
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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20191125/353e977c/attachment.html>


More information about the Libraries mailing list