Haskell 98 (Library) Report: contradiction about fail :: Stri
ng -> IO a
Simon Peyton-Jones
simonpj@microsoft.com
Fri, 12 Jan 2001 01:31:22 -0800
Marcin writes:
| The Haskell 98 Report says that fail in instance Monad IO invokes error.
| The Library Report says that fail in instance Monad IO raises a user
error.
|
| I would let it raise a user error, to be able to use fail in exception
| monads where strings suffice as the error type.
He's right. The instance declaration in the Prelude (p101) should say
instance Monad IO where
...
fail s = ioError (userError s)
This was always intended (see Library report p55, 11.1).
Other clarifications should be
* Index the reference to userError in Sec 7.3 of the Report
and give a type signature for userError
* In that same section, specify that fail s = ioError (userError s)
I'll do these as part of the (long-postponed) H98 report revision.
Any objections? I don't think this is controversial. Implementors take
note,
though.
Simon