The Elm Architecture Tutorial recommends reading the first two sections of the complete guide as a prerequisite, but neither section quite prepared me for this type signature in the architecture tutorial:
update : Action -> Model -> Model
Because the model-the-problem section only presents the type signatures for functions that take a single argument, I interpreted a -> b as meaning "a function that takes an argument of type a and returns a value of type b". So the above example broke my brain. :disappointed:
It wasn't until I found the Pragmatic Studio's Getting Started With Elm blog post that I learned how I should really be reading ->:
Notice that each parameter is separated with -> and there's nothing special indicating that the last item is the return type.
So I think that briefly explaining this in model-the-problem could help ease the hiccups between moving from it to the Elm Architecture Tutorial (or reading other existing Elm code/documentation in general).
Update: I actually ended up buying the Pragmatic Studio's Elm: Building Reactive Web Apps video series, and in an early video the author mentions this issue was confusing for him at first as well.
The Elm Architecture Tutorial recommends reading the first two sections of the complete guide as a prerequisite, but neither section quite prepared me for this type signature in the architecture tutorial:
Because the model-the-problem section only presents the type signatures for functions that take a single argument, I interpreted
a -> b
as meaning "a function that takes an argument of typea
and returns a value of typeb
". So the above example broke my brain. :disappointed:It wasn't until I found the Pragmatic Studio's Getting Started With Elm blog post that I learned how I should really be reading
->
:So I think that briefly explaining this in model-the-problem could help ease the hiccups between moving from it to the Elm Architecture Tutorial (or reading other existing Elm code/documentation in general).
Update: I actually ended up buying the Pragmatic Studio's Elm: Building Reactive Web Apps video series, and in an early video the author mentions this issue was confusing for him at first as well.