No subject

Sun Oct 23 10:51:38 CEST 2011

believe fromString will tempt misuse (i.e. using *easily* partial
functions, like XML validation), while others don't think it's that
likely.  Indeed misusing IsString is worse than your average partial
function because of the global nature of typeclasses and fromString
being implicit.  If that is indeed the core of the disagreement, then
can we at least agree that writing a partial fromString is a bad idea?
 I'd say *easily* partial since someone pointed out the UTF8
fromString is partial, but it's pretty hard to type bad UTF8
accidentally so it doesn't seem so bad to me.

If we agree that 'fromString :: String -> XML' is a bad idea, then can
we just say "so don't do that then"?  Safety is good but there's a
point where you have to trust people with the sharp tools.  Suppose a
library author adding a fromString for regexes that crashes on
unbalanced parens.  If it's a problem in practice I imagine people
would complain to them to change their library, or use another

On Tue, Apr 24, 2012 at 9:10 AM, Henrik Nilsson <nhn at> wrote:
> Hi,
> 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
> one.
> 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.
> Best,
> /Henrik
> --
> Henrik Nilsson
> School of Computer Science
> The University of Nottingham
> nhn at
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list