This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
We were not able to find the expected elm-package.json file at this tag.
version 3.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 3.0.0
Committed At 2018-09-19 03:26:36 UTC
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1




This library provides a type for non-empty lists, called Cons.

Being able to encode non-emptiness in the type system can lead to simpler, clearer code.

For example, to find the largest element in a List, you have to account for the empty list, which complicates things:

maximum : List comparable -> Maybe comparable
maximum l =
  case l of
    [] -> Nothing
    first::rest -> Just <| List.foldl max first rest

Using Cons, on the other hand, the type system knows the list will never be empty, leading to much simpler code:

maximum : Cons comparable -> comparable
maximum = foldl1 max

See the full documentation for more.


Thanks to Sam Gwilym for adding Elm 0.18 support.