compute our result, such as 0, (giving (a,s)), and then just pull out the result out of the tuple by using fst. -- State Monad implementation: take a tree and give all leafs a unique number. -- I number the leafs in depth first order, any order is fine thoughrenumberTree' :: Tree a -> Tree IntrenumberTree' tree = fst $ runState (renumberHelper tree) 0Some helper functions:One can imagine that