Ben Millwood wrote: > No-one's yet argued against OverloadedStrings. I think there /is/ an > argument to be made, that it introduces ambiguity and could break > existing programs (probably we can extend defaulting to take care of > this, but I think there are people who'd be happier if we killed > defaulting too).
For the record, I have a more fundamental objection to OverloadedStrings. When library authors write partial functions for the fromString method - and we see in practice that they do so - it creates the shocking situation in which invalid syntax of a literal is only caught at run time. Instead, Haskell' should provide a pragma, or other syntactic mechanism, by which compilers can allow specific types other than String for string literals at *compile* time in a monomorphic context. The implementation of that syntax would be compiler dependent, of course. For GHC, Template Haskell could help. Another approach would be for a compiler to have a built-in way of embedding, say, Text literals directly in object code. For people who like OverloadedStrings despite this problem, it could be available via a pragma. But never by default - it should be possible to get fundamental string types like Text and ByteString for string literals without having to turn on OverloadedStrings. In GHC, quasi-quoters are the right way to provide convenient user-defined syntax for string-like types other than the canonical string types. Theoretically, polymorphism for numeric literals is just as bad. But in practice, it seems to be much more rare for people to implement fromIntegral and fromRational with dangerous functions. -Yitz _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime