first some refactoring:
> transformLogMsg : LogMsg -> TaskMsg
transformLogMsg logMsg =
TaskLog logMsg
transformLogList : Html LogMsg -> Html TaskMsg
transformLogList log =
App.map transformLogMsg log
can due to currying also be written as
transformLogMsg : LogMsg -> TaskMsg
transformLogMsg =
TaskLog
transformLogList : Html LogMsg -> Html TaskMsg
transformLogList =
App.map transformLogMsg
when you apply this rule once again and inline stuff you may end up with
viewTask task =
div []
[ h1 [] [ text task.title ]
, Markdown.toHtml [] task.description
, App.map TaskLog (div [] (List.map viewLog task.logs))
]
which does not read all that bad. with the cons-operator (::) or
List.concat you might again get rid of the extra div.
the <| operator is just the inverse of |>. the following expressions are
identical:
piping (some "stuff")
piping <| some "stuff"
some "stuff" |> piping
For the confusion regarding the update-part i'd recommend
reading https://www.elm-tutorial.org/en/02-elm-arch/07-composing-2.html,
which should be clarifying about how to isolate child-modules. Properly
integrated your Task-Module should not need to know about LogMsg.
--
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.