[Haskell-cafe] Overloaded Strings as default

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Tue Nov 29 11:01:44 CET 2011


Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> writes:

> On 29 November 2011 07:28, Daniel Díaz Casanueva <dhelta.diaz at gmail.com> wrote:
>> Hi Cafe,
>>
>> I only feel curious about what would be the consequences of becoming the
>> Overloaded Strings feature (currently, an extension) to be default in
>> Haskell. This is not a proposal. I just want to know what pros and
>> cons there are.
>
> One cons would be that you may need some more explicit type signatures
> being used: I have the situation in my graphviz library where both
> Text and String have instances of some classes (e.g. Labellable, which
> has a method toLabel :: (Labellable a) => a -> Label) which result in
> explicit "String" values in the source code result in the compiler not
> knowing which instance to use (e.g. toLabel "hi").

Though that could be ameliorated by allowing defaulting with a
default default (if you will) of String.

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list