module State (State, get, put, runState, evalState, execState) where
data State s a = S { runState :: s -> (a, s) }
instance Monad (State s) where
return x = S (\s -> (x, s))
st >>= f = S (\s -> let (x, s') = runState st s
in runState (f x) s')
evalState :: State s a -> s -> a
evalState s = fst . runState s
execState :: State s a -> s -> s
execState s = snd . runState s
get :: State s s
get = undefined
put :: s -> State s ()
put s' = undefined