opvasger/enumerable/1.0.0

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/opvasger/enumerable is gone (deleted or private); Software Heritage not asked yet (this run's --swh-calls were used up); no fork with tag 1.0.0 found (57 same-name repos checked); no cached copy. Use another version.

Details

Elm Enumerable

This package is intended to reward you with some functions, should you decide to implement an enumeration over the values of a given type.

Custom types have limited semantics in Elm. You can't, for example, get a list of each value without implementing it yourself.

module Example exposing (N, everyN)

import Enumerable exposing (Enumerable)

type N = One | Two | Three

-- [ One, Two, Three ]
everyN : List N
everyN = Enumerable.toList enumerable One

-- this one forms a loop using a pattern-match, which is usually what you want.
enumerable : Enumerable N
enumerable n =
    case n of
        One ->   Two
        Two ->   Three
        Three -> One