Proposal: Improving the IsString String instance

Gabriel Gonzalez gabriel439 at
Mon Aug 26 19:19:51 CEST 2013

I think Henning has a point regarding defining:

    o = fromString

All these libraries that Edward mentions already ask the user to paste a
lot of boilerplate at the top of their module consisting of various
extensions and imports.  Why not simply remove the `OverloadedString`s
pragma from the boilerplate and replace it with `o = fromString` and get
almost the exact same benefits?

On Mon, Aug 26, 2013 at 10:10 AM, Henning Thielemann <
schlepptop at> wrote:

> Am 26.08.2013 19:03, schrieb Gabriel Gonzalez:
>  May I propose an alternative solution?  Why not just add a syntactic way
>> to selectively opt in or out of `OverloadedStrings` for certain string
>> literals?  It could be something as simple as Python's trick for
>> prefixing string literals with a single character to either enable or
>> disable the overloading:
>>      example1 :: Int
>>      example1 = length "Non-overloaded string"
>>      example2 :: Parser Int
>>      example2 = o"Overloaded string" *> pure 4
>> ... but it doesn't have to be that specific solution.  All that really
>> matters is that it is syntactically lightweight.
> This "opting in" already exists: Just put a space between o and the
> quotation mark and define "o = fromString". It's Haskell 98.
> I would prefer that solution to all syntactic extension experiments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list