Firing Actions from outside the View

Almost certain this is possible, it’s just been a while since I used Elm.

I am thinking about parsing a file into a list of various actions, which then update the Model.

Shouldn’t be a problem right? Just slightly off the beaten track perhaps…

update is just a function. Or it could be an update-like function just for this. Once you parse it into a list, you can loop though threading the model through. Collecting the commands might make it a bit awkward. If you don’t need commands, then a separate function could could be passed directly to List.foldl without a helper function.

great, that’s what I expected, just wasn’t sure…

At my company we normally use this function.
{-| A function that takes a msg and returns a Cmd msg. -} mkCmd : msg -> Cmd msg mkCmd msg = Task.perform (always msg) (Task.succeed msg)

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.