
Dear Evan, Probably you want to have a look whether the mtl package has something for you. Anything beyond the Functor instance for (Either e), though, models exceptions that abort the computation as soon as the first Left arises. You seem to use the type in a different way which may be one reason why you do not find your functions implemented elsewhere. For logging or warnings, most Haskellers use something like a writer monad transformer. The underlying monad, Writer w a = (w,a) for some monoid w, is exceptionally versatile because of the function Functor f => Writer w (f a) -> f (Writer w a) which in combination with traverse lets you move the (Writer w) type in and out of nested types easily. Cheers, Olaf

Anything beyond the Functor instance for (Either e), though, models exceptions that abort the computation as soon as the first Left arises. You seem to use the type in a different way which may be one reason why you do not find your functions implemented elsewhere. For logging or warnings, most Haskellers use something like a writer monad transformer. The underlying monad,
Writer w a = (w,a)
That's the thing I was saying destroys streaming. The problem is that it returns ([log], [a]), instead of [Either log a], so the interleaving has been lost.
participants (2)
-
Evan Laforge
-
Olaf Klinke