An IsString (NonEmpty Char) instance
Artyom
yom at artyom.me
Sat Sep 2 13:23:07 UTC 2017
> If we accept partial constructors for NonEmpty then we can return to
lists, can't we?
I can't be 100% sure about this, but I believe that the world with
convenient `NonEmpty Char` would be safer than the world where people
had to use `fromString` with any `NonEmpty Char`, even in the presence
of a partial constructor for `NonEmpty`.
Moreover, I also think that `fromInteger` and `fromIntegral` are *much*
bigger threats to safety than `fromString` - so, either you figure out a
way to disallow `fromInteger` in your code (and then you can also easily
disallow `fromString` and `fromList`), or you let `fromInteger` remain
and then `fromString` becomes the least of your problems. (In the former
case you only need to spend a tiny additional amount of effort to stay
safe, while in the latter case you gain convenience *and* make other
parts of your code safer.)
More information about the Libraries
mailing list