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.
Tag 1.3.1
Committed At 2018-08-30 20:13:03 UTC



    Selection List Build Status

    Create a list which may have one (but no more than one) item selected. You can never select an item that isn't in the list. Selections are optional, so this is slightly different than a zipper.


    Create a Selection list from a regular list by using fromList. Let's use this to choose what we'd like for lunch.

    import List.Selection exposing (Selection)
    type Lunch
        = Burrito
        | ChickenWrap
        | TacoSalad
        | DonerKebab
    todaysMenu : Selection Lunch
    todaysMenu =
        [ Burrito, ChickenWrap, TacoSalad ]
            |> List.Selection.fromList       -- create a new Selection list
            |> Burrito -- now let's see, I think I'd like a burrito (yum, monads!)

    Since I already chose what I want for lunch, I can get it with selected:

    List.Selection.selected todaysMenu -- `Just Burrito`

    But what if you try and select something that doesn't exist in the list? The shop was out of doner kebab today, but what if we ask for it?

        |> DonerKebab -- this doesn't exist in our menu, so...
        |> List.Selection.selected          -- `Just Burrito` (selection unchanged)

    And if I change my mind, I can remove my choice with deselect:

        |> List.Selection.deselect -- deselect any current selection
        |> List.Selection.selected -- `Nothing`


    Install Elm and elm-test and elm-verify-examples from NPM, then run make to run tests and generate documentation.


    Licensed under a BSD 3-Clause license