An IsString (NonEmpty Char) instance
Henning Thielemann
lemming at henning-thielemann.de
Sat Sep 2 13:11:13 UTC 2017
On Sat, 2 Sep 2017, Artyom wrote:
> Yes, but the same is true for `-XOverloadedLists` and the `IsList`
> instance of `NonEmpty`, and we have the `IsList NonEmpty` instance anyway.
I thought that NonEmpty was intended to increase type safety compared to
the partial list functions in Data.List (head, maximum etc.) If we accept
partial constructors for NonEmpty then we can return to lists, can't we?
> By the way, it'd be nice to have GHC warn about such cases, the same way
> it already warns about integer literals that are guaranteed to overflow:
That would be better, but you can still bypass this warning by calling
fromString directly, without overloaded string literals:
fromString $ map toUpper ""
More information about the Libraries
mailing list