f0i / statistics

Statistic functions for elm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accept List.Nonempty inputs so you don't have to return Maybes everywhere

Erudition opened this issue · comments

Thank you for the suggestion 🙏.

I like the idea, but have to think a bit how to implement this because List.Nonempty is not in Core.
In about a month I will continue working with this, and will likely make some updates then.

That's true! The dependency-free way to do nonempty lists is:
(Type, List Type) where the first item is in the tuple and the list can be empty as usual.

Lots of us prefer the syntax sugar in the Nonempty package though (look at the code and you'll see it's just a wrapper over exactly that - not much to the "library"), and with Elm 0.19's forced semantic versioning, tree shaking and inlining, there's not much point in "avoiding dependencies". (None of the wrappers make it into the compiled production code)

I finally got around to this one.
In tag 3.0.0 there is a separate module for nonempty lists: List.Nonempty.Statistics.
Functions for normal lists are now in List.Statistics.