Skip to content

Instantly share code, notes, and snippets.

@TheSeamau5
Created September 2, 2015 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheSeamau5/1fd2fdc66eb85f27abef to your computer and use it in GitHub Desktop.
Save TheSeamau5/1fd2fdc66eb85f27abef to your computer and use it in GitHub Desktop.
type alias Transition state effect = (state, List effect)
pipe : List a -> (a -> state -> Transition state effect) -> state -> Transition state effect
pipe actions update state =
case actions of
[] ->
(state, [])
x :: xs ->
let
(nextState, nextEffects) =
update x state
(finalState, finalEffects) =
pipe xs update nextState
in
(finalState, nextEffects ++ finalEffects)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment