I have two real-world examples. Nothing is modified at all.
1. Update inner structure
canvasPosition : Model -> Position
canvasPosition model =
let
pos =
model.mousePosition
in
{ pos | y = pos.y - headerHeight }
2. Add field to make extended record (cannot use update syntax)
type alias Note =
{ position : Int
, note : Int
, velocity : Int
, length : Int
}
type alias Detailed a =
{ a | track : Int, channel : Int }
addDetails : Int -> Int -> Note -> Detailed Note
addDetails track channel note =
{ position = note.position
, note = note.note
, velocity = note.velocity
, length = note.length
, channel = channel
, track = track
}
2017年3月3日金曜日 15時12分39秒 UTC+9 Richard Feldman:
>
> There have been various discussions of potential ways to improve Elm's
> record update syntax. Evan commented that "(examples > design work) at this
> point" - any potential designs for syntax improvements would need to be run
> through a gauntlet of examples to see how well they'd work, so the first
> step in the process is to gather those examples.
>
> So let's collect a ton of different real-world examples! That will help
> guide the design process.
>
> If you've run into a record update that you felt was painful and could be
> improved in some way, please post it here! (Also, *please keep this
> thread for posting of examples* *only* - it'll be easier to link back
> here during design discussions if we can reference a clean thread of
> examples, as opposed to a mismash of examples interleaved with suggestions.)
>
--
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.