serokell / universum

:milky_way: Prelude written in @Serokell
MIT License
174 stars 26 forks source link

Consider removing `FromList` instance for `NonEmpty` #264

Open Martoon-00 opened 2 years ago

Martoon-00 commented 2 years ago

In #238 I have added FromList typeclass with fromList that behaves very similar to GHC.Exts.IsList.fromList.

And it is defined for NonEmpty too. This means that the following code:

a = fromList [] :: NonEmpty a

as well as the following code:

{-# LANGUAGE OverloadedLists #-}

a = [] :: NonEmpty a

will fail. However, unlike in IsList, currently we will have a callstack attached to the error.

We should consider pros and cons of removing this instance.

treeowl commented 2 years ago

I'm not really a fan of such an instance myself. It's not hard to just use the constructor properly instead.

Martoon-00 commented 2 years ago

I also agree that removing the instance would be better.