An IsString (NonEmpty Char) instance

amindfv at gmail.com amindfv at gmail.com
Sun Sep 3 18:02:37 UTC 2017


I'm +1 on any proposal that disallows or warns on an empty string, and -1 otherwise.

Tom


> El 3 sept 2017, a las 09:24, Artyom Kazak <yom at artyom.me> escribió:
> 
> The IsString1 solution seems okay, though it requires writing an IsString1 instance for all types which have an IsString instance now, and I'm not sure that the breakage is worth it. 
> 
>> On 3 Sep 2017 4:33 p.m., "Henning Thielemann" <lemming at henning-thielemann.de> wrote:
>> 
>> On Sun, 3 Sep 2017, Tony Morris wrote:
>> 
>>> Why not:
>>> 
>>> class isString1 a where fromString1 :: NonEmpty Char -> a
>> 
>> This would be a clean solution. GHC could reject empty string literals. (Though I do not know how difficult or sensible it is to extend GHC this way.)
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170903/178ff17b/attachment.html>


More information about the Libraries mailing list