Created
September 2, 2015 01:13
-
-
Save TheSeamau5/1fd2fdc66eb85f27abef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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