Skip to content

Instantly share code, notes, and snippets.

@dminuoso dminuoso/state.hs
Created Dec 6, 2017

Embed
What would you like to do?
combine1 :: (a -> a) -> State [a] ()
combine1 op = do
a <- pop
push $ op a
combine2 :: (a -> a -> a) -> State [a] ()
combine2 op = do
a <- pop
b <- pop
push op a b
combine3 :: (a -> a -> a -> a) -> State [a] ()
combine3 op = do
a <- pop
b <- pop
c <- pop
push $ op a b c
combine4 :: (a -> a -> a -> a -> a) -> State [a] ()
combine4 op = do
a <- pop
b <- pop
c <- pop
d <- pop
push $ op a b c d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.