*Main> tree1 Node "f" (Node "e" (Leaf "c") (Leaf "d")) (Node "g" (Leaf "a") (Leaf "b")) *Main> depth tree1 :4:1: error: • No instance for (Show (State [[Char]] ())) arising from a use of ‘print’ • In a stmt of an interactive GHCi command: print it *Main> depth tree1 :7:1: error: • No instance for (Show (State [[Char]] ())) arising from a use of ‘print’ • In a stmt of an interactive GHCi command: print it *Main> runState [] (depth tree1) ((),["c","e","d","f","a","g","b"]) *Main> runState [] (depth tree1) ((),["c","e","d","f","a","g","b"]) *Main> :t (>>) (>>) :: Monad m => m a -> m b -> m b *Main> :t (>>=) (>>=) :: Monad m => m a -> (a -> m b) -> m b *Main> breadth :17:1: error: • No instance for (Show (State [Tree a0] [a0])) arising from a use of ‘print’ • In a stmt of an interactive GHCi command: print it *Main> runState [tree1] breadth (["f","e","g","c","d","a","b"],[]) *Main> tree1 Node "f" (Node "e" (Leaf "c") (Leaf "d")) (Node "g" (Leaf "a") (Leaf "b")) *Main> :t getChar getChar :: IO Char *Main> getChar a 'a' *Main> *Main> putChar 'c' c*Main> :r *Main> sequenceIO [putChar 'a', putChar 'b', putChar 'c', putChar '\n'] abc *Main> putString "hello" hello*Main> putString "hello\n" hello *Main> putString' "hello\n" hello *Main> echo m m p p a aa*Main> *Main>