Haskell Platform proposal: Add case-insensitive and Haskell 98/2010 compliance

Henning Thielemann lemming at henning-thielemann.de
Sun Jan 13 17:48:04 CET 2013


On Sat, 12 Jan 2013, Roman Cheplyaka wrote:

> * Henning Thielemann <lemming at henning-thielemann.de> [2013-01-12 13:42:56+0100]
>>
>> If you can easily avoid using an extension, like in the case of the
>> TypeSynonymInstances and FlexibleInstances in case-insensitive then
>> this seems better to me, than adding FlexibleInstances to all Haskell
>> compilers and Haskell tools (haddock, hlint, etc.), going through a
>> Haskell Prime proposal procedure, etc.
>
> I am not so sure here. That helper method or type class is just an ugly
> hack to work around a limitation of the type class system.
> Using it does not improve the code itself.

It improves because the code becomes more generic - you get a reasonable 
instance for all list types with a character like element. So to speak, 
avoiding FlexibleInstances is more flexible here.


> GHC shows that there's a way to lift this limitation (and it's been
> known for many years). Is that extension controversial in the type
> systems community? Why?

In my opinion if String needs special treatment and there is no
reasonable generic list instance then String should be avoided and a 
custom type should be used. (This also applies to showList.)

FlexibleInstances are dangerous because they can yield conflicting 
instances that are not orphan. Although I think that can only happen with 
multiple parameter type classes.



More information about the Libraries mailing list