default instance for IsString

Henrik Nilsson nhn at Cs.Nott.AC.UK
Tue Apr 24 18:10:31 CEST 2012


Yitzhack Gale wrote:

 > Wouldn't it be ironic if the one thing that every language
 > other than Haskell is able to check at compile time,
 > namely the static syntax of string literals, could only be
 > checked at run time in Haskell?

I don't really see the irony, I'm afraid, as nothing really
has changed, and as Simon M. that I don't see what the
fuss is about.

Presumably, the syntax of string literals as such is still going to be
checked by the scanner, as it always was? And the issue, then, is
whether an overloaded "fromString" is total in all its overloadings?
Or did I miss something central, here?

Well, Haskell is not a total language, so the fact that "fromString"
might have non-total overloadings is not surprising. Yes,
"fromString" would be implicitly inserted, just like e.g. "fromInteger"
for overloaded integer literals, to create the effect of overloaded
literals, but this is really just a convenience, albeit an important

The benefit of an approach to overloading of string literals that is
analogous to the existing method for overloading of numeric literals
would seem to me to outweigh the benefits of additional static
checking through an essentially new approach to overloading of literals
for a specific case.



Henrik Nilsson
School of Computer Science
The University of Nottingham
nhn at

More information about the Glasgow-haskell-users mailing list