NoRedInk/elm-debug-controls-without-datepicker/1.0.0

NOTE: the latest version is 1.0.1

Rerouted (retagged, needs approval). The tag now points at a different commit than when this version was published. The Lamdera package server serves a copy recovered from https://github.com/NoRedInk/elm-debug-controls-without-datepicker.

What we checked: Tag 1.0.0 is still on github.com/NoRedInk/elm-debug-controls-without-datepicker; its commit 167efffa0196 is from 2018-11-14 22:25 UTC, after the version was published (2018-11-14 20:24 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one and nothing else confirms its contents.

We could not verify this copy against what was published, so the Lamdera compiler asks before using it (y/n). Without a terminal, as in CI, it stops with an error unless approved:

  • lamdera make --auto-approve-package-rerouting approves rerouted versions for that run,
  • LAMDERA_AUTO_APPROVE_PACKAGE_REROUTING=1 does the same for every run in that environment,
  • LAMDERA_CACHE=off skips the Lamdera package server altogether: packages come from package.elm-lang.org and GitHub only, as with elm, and a rerouted version then fails to download.

Details · package.elm-lang.org's zip: https://github.com/NoRedInk/elm-debug-controls-without-datepicker/zipball/1.0.0/

Debug.Control

Create interactive controls for complex data structures.

type Control a

An interactive control that produces a value a.

value : a -> Control a

A Control that has a static value (and no UI).

bool : Bool -> Control Bool

A Control that toggles a Bool with a checkbox UI.

string : String -> Control String

A Control that allows text input.

values : (a -> String) -> a -> List a -> Control a

A Control that chooses between a list of values with a dropdown UI.

The first value will be the initial value.

maybe : Bool -> Control a -> Control (Maybe a)

A Control that wraps another control in a Maybe, which a checkbox UI.

The Bool parameter is the initial value, where False is Nothing, and True is Just with the value of the nested control.

choice : ( String, Control a ) -> List ( String, Control a ) -> Control a

A Control that chooses between a list of nested controls.

This will crash if you provide an empty list.

The first entry will be the initial value.

list : Control a -> Control (List a)

A Control that provides a list of selected length.

record : a -> Control a

Create a Control representing a record with multiple fields.

This uses an API similar to elm-decode-pipeline.

You will use this with field.

import Debug.Control exposing (field, record, string)


type alias Point =
    { x : String
    , y : String
    }


pointControl : Control Point
pointControl =
    record Point
        |> field "x" (string "initial x value")
        |> field "y" (string "initial y value")
field : String -> Control a -> Control (a -> b) -> Control b

Used with record to create a Control representing a record.

See record.

map : (a -> b) -> Control a -> Control b

Transform the value produced by a Control.

view : (Control a -> msg) -> Control a -> Html msg

Renders the interactive UI for a Control.

Gets the current value of a Control.

allValues : Control a -> List a

TODO: revise API