getto-systems/getto-elm-command/1.0.1

NOTE: the latest version is 1.0.2

Renamed to getto-systems/elm-command. It is published under that name, and new versions come out there.

Versions published as getto-systems/getto-elm-command still install under that name. 3 versions of 3 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/getto-systems/elm-command.

What we checked: The repo moved to github.com/getto-systems/elm-command. Rebuilt with git archive from commit 46a9cb8477fe of https://github.com/getto-systems/elm-command (zip prefix getto-systems-getto-elm-command-46a9cb8/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 025c57efdc1fd7ad7434a37b2e9a67be539f1471.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/getto-systems/getto-elm-command/zipball/1.0.1/

Getto.Command.Transition

utility fo model -> Cmd msg

Definition

type alias Transition model msg =
model -> Cmd msg

model -> Cmd msg

type Prop big small

set of getter (big -> small) and setter (small -> big -> big)

Construction

none : Transition model msg

create 'Do nothing' Transition

prop : Get big small -> Set big small -> Prop big small

construct Prop from getter and setter

type alias Model =
  { name : String
  }


name_ = Transition.prop .name (\v m -> { m | name = v })

Apply

exec : Transition model msg -> model -> ( model, Cmd msg )

execute Transition

() |> Transition.exec Transition.none
update : Prop big small -> (small -> ( small, msg )) -> big -> ( big, msg )

update small that describe Prop

type alias Model =
  { sub : SubModel
  }
type alias SubModel = ()


sub_ = Transition.prop .sub (\v m -> { m | sub = v })


updateSub model = ( model, Transition.none )


{ sub = () } |> Transition.update sub_ updateSub

Helpers

batch : List (Transition model msg) -> model -> Cmd msg

batch Transition

[ Transition.none ] |> Transition.batch
map :
(msg -> super)
-> ( model, Transition m msg )
-> ( model, Transition m super )

map ( model, Transition ) tuple

type alias Model = ()


type Msg
  = Sub SubMsg


type SubMsg
  = HelloWorld


( (), Transition.none ) |> Transition.map Sub
(a -> model)
-> ( a, Transition m msg )
-> ( model, Transition m msg )

compose ( model, Transition ) tuples

type alias Model =
  { sub : SubModel
  }


type alias SubModel = ()


Transition.compose
  Model
    ( (), Transition.none )
(a -> b -> model)
-> ( a, Transition m msg )
-> ( b, Transition m msg )
-> ( model, Transition m msg )

compose ( model, Transition ) tuples

type alias Model =
  { sub   : SubModel
  , other : OtherModel
  }
type alias SubModel = ()
type alias OtherModel =
  { name : String
  }


Transition.compose
  Model
    ( (),              Transition.none )
    ( { name = "John", Transition.none )
(a -> b -> c -> model)
-> ( a, Transition m msg )
-> ( b, Transition m msg )
-> ( c, Transition m msg )
-> ( model, Transition m msg )

compose with 3 args

(a -> b -> c -> d -> model)
-> ( a, Transition m msg )
-> ( b, Transition m msg )
-> ( c, Transition m msg )
-> ( d, Transition m msg )
-> ( model, Transition m msg )

compose with 4 args

(a -> b -> c -> d -> e -> model)
-> ( a, Transition m msg )
-> ( b, Transition m msg )
-> ( c, Transition m msg )
-> ( d, Transition m msg )
-> ( e, Transition m msg )
-> ( model, Transition m msg )

compose with 5 args

(a -> b -> c -> d -> e -> f -> model)
-> ( a, Transition m msg )
-> ( b, Transition m msg )
-> ( c, Transition m msg )
-> ( d, Transition m msg )
-> ( e, Transition m msg )
-> ( f, Transition m msg )
-> ( model, Transition m msg )

compose with 6 args

(a -> b -> c -> d -> e -> f -> g -> model)
-> ( a, Transition m msg )
-> ( b, Transition m msg )
-> ( c, Transition m msg )
-> ( d, Transition m msg )
-> ( e, Transition m msg )
-> ( f, Transition m msg )
-> ( g, Transition m msg )
-> ( model, Transition m msg )

compose with 7 args

(a -> b -> c -> d -> e -> f -> g -> h -> model)
-> ( a, Transition m msg )
-> ( b, Transition m msg )
-> ( c, Transition m msg )
-> ( d, Transition m msg )
-> ( e, Transition m msg )
-> ( f, Transition m msg )
-> ( g, Transition m msg )
-> ( h, Transition m msg )
-> ( model, Transition m msg )

compose with 8 args