Add NonEmptyMap and NonEmptySet to containers

V.Liepelt V.Liepelt at kent.ac.uk
Wed Sep 18 10:48:44 UTC 2019


Hi John,

I saw your thread about non-empty containers today. Why not call them `Set1`, `Map1`, etc. in analogy to `many`/`many1` from parser combinators?

I think most agree that `NonEmpty` is not a great name—I couldn’t summarise it better than Andreas: "NonEmpty what?”. Hence I always do the following:

```
import Data.List.NonEmpty (NonEmpty)
import qualified Data.List.NonEmpty as List1

type List1 = NonEmpty
```

In fact I just hoogled for this and noticed that the rebase package seems to do this too.

More anecdotal precedent: recently a colleague wrote a datatype isomorphic to `(a, a, [a])` and called it something not quite as ridiculous as `ListWithAtLeastTwoElements`, so I suggested `List2` and everybody involved was happy with that.

Vilem


More information about the Libraries mailing list