elm-return
elm-return copied to clipboard
Alternative to effect
effect is really nice but It would also be nice to have a helper function similar to effect but not depending on the model state itself and instead on any other value.
For instance the value arriving in a msg (route).
Navigate route ->
Return.singleton { model | navigationMenu = Selection.select route model.navigationMenu }
|> Return.command (Route.modify route)
|> Return.command
(if route == LoginRoute then
Session.store <| Session.session Nothing
else
Cmd.none
)
So maybe a helper function would allow to clean those if statements a bit, something like:
Return.commandWhen : Bool -> Cmd msg -> Return msg mdl
This sounds similar guard from MonadPlus...
@DanielCardonaRojas can you open a PR with a concrete suggestion in code?