If this distinction makes sense, you should try it :) It looks useful. Maybe it’ll be useful enough to create an adaption of start-app that works with this.
For now you can fit this into the Elm Architecture too (if I understood the idea correctly):
type Action =
Command Command
| Event Event
stdUpdate : Action -> Model -> (Model, Effects Action)
stdUpdate action model = case action of
Command command ->
let
(event, effects) = updateEvents command model
in
(update event model, Effects.map Event effects)
Event event ->
(update event model, Effects.none)
--
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 elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
That's a nice idea to start with. Thanks.
I'll try both options and see what's most useful
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/yKTd9sETFQk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
You are not seeing ghosts. It is indeed the case that in your code the function
updateEvents : Command -> Model -> (Event, Effects Event)
gets called with an Event as the first argument, and the Elm compiler does not prevent that from happening, despite knowing that Command and Event are non-unifiable types.
But why does the type checker not catch this? It is this known problem.
A worrying thought now is: Does the “official” start-app version also suffer from this? Can one write a program with start-app that subverts type soundness?