Hi Antoine, just to let you know that you could write:
( { model | mode =
case model.mode of
Drawing (Just shape) ->
Drawing <| Just <| Shapes.setID id shape
_ ->
model.mode
}
, Cmd.none
)
Nested pattern matching is allowed for many constructions. Though I usually
prefer having a clear return value, and define intermediate values like:
let
newMode =
case model.mode of
Drawing (Just shape) ->
Drawing <| Just <| Shapes.setID id shape
_ ->
model.mode
in
( { model | mode = newMode }
, Cmd.none
)
Which is still verbose but because of code logic, not record syntax IMHO.
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.