Haskell – depth for each node in binary tree using Reader monad
I want to show you that your idea is an instance of a more general concept – zipping. Here’s a version of your program that employs a simpler and more functional style. Applicative Functors Here’s the definition of Applicative: class Functor f => Applicative f where pure :: a -> f a (<*>) :: f … Read more