TLDR
I want to write:
import List.Nonempty exposing (NonEmptyList)
things : NonEmptyList Thing
Long explanation
Hey! Thanks for this useful package. I hope you won't find this too much of nitpicking. If you do, feel free to ignore the issue.
Maybe I'm missing something, but when I use this package I import it like this:
Then if I want to annotate something I have to type:
things : List.Nonempty.Nonempty Thing
That's long and cumbersome. Alternatively I could expose the type:
import List.Nonempty exposing (Nonempty)
things : Nonempty Thing
But that's confusing. Now this annotation doesn't tell me what kind of collection is non-empty.
The current name of the type would only make sense if I would "merge" the import with the core List module, like this:
import List.Nonempty as List
things : List.Nonempty Thing
But that's not even possible because of clashing names (map, filter etc.). Also I wouldn't really want that, as non-empty list has different semantics.
So what I end up doing every time is:
import List.Nonempty
type alias NonEmptyList a =
List.Nonempty.Nonempty a
things : NonEmptyList Thing
So why shouldn't I be able to write it like below?
import List.Nonempty exposing (NonEmptyList)
things : NonEmptyList Thing
I can make a PR if you want. To avoid a breaking change we could start with aliasing the type, so old code would still work.
Does it make sense? Am I missing something?