import Control.Monad.State
state_obj :: State [Char] [Char]
state_obj = state (\s -> ("one","two"))
show_result :: Show a => State [Char] a -> IO ()
show_result so =
( putStrLn ("First: " ++ (show (fst ran))) ) >>
( putStrLn ("Second: " ++ (show (snd ran))) )
where ran = runState so "anything"
main = show_result state_obj
Note the show_result function could have been declared
show_result :: State [Char] [Char] -> IO ()
and written without (show …). I did not do it
that way because later we will need
show_result to be flexible enough to work when the
interior object is ().