default instance for IsString

Yitzchak Gale gale at
Tue Apr 24 08:10:19 CEST 2012

I wrote:
>> In addition, OverloadedStrings is unsound.

J. Garrett Morris wrote:
> fromString can throw errors, just like fromInteger

This is true; the use of polymorphism
for numeric literals is also unsound.

However, in practice, it is rare for there to be
dangerous instances of the numeric type classes.

> this is no less sound than any Haskell function
> throwing an exception.

No. Usually, operations that can throw an exception
are in the IO monad, where the specter of a
potential exception is more obvious, and where the
operation can be wrapped in try or catch.

Whereas a string literal that might throw an exception
at run time is bizarre, to say the least. And it is
extremely difficult to deal with potential exceptions
thrown by fundamental language syntax that is
sprinkled throughout nearly every Haskell module
in existence.


More information about the Glasgow-haskell-users mailing list