Proposal: Improving the IsString String instance

Edward Kmett ekmett at gmail.com
Sun Aug 25 14:51:24 CEST 2013


Sold.

Now all everyone has to do is bikeshed the names. ;)

-Edward


On Sun, Aug 25, 2013 at 5:48 AM, Henning Thielemann <
schlepptop at henning-thielemann.de> wrote:

> Am 24.08.2013 19:52, schrieb Edward Kmett:
>
>
>  I would like to replace this instance with
>>
>> instance a ~ Char => IsString [a] where
>>    fromString = id
>>
>
>
> Your complaint proves my concerns about those FlexibleInstances. The best
> instance is a Haskell 98 instance:
>
>
> class IsCharList a where
>    fromCharList :: [a] -> String
>
> instance IsCharList Char where
>    fromCharList = id
>
> instance IsCharList a => IsString [a] where
>    fromString = fromCharList
>
>
> This is both the most flexible solution and it is portable.
>
> http://www.haskell.org/**haskellwiki/List_instance<http://www.haskell.org/haskellwiki/List_instance>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130825/1e185d35/attachment.htm>


More information about the Libraries mailing list