
On Mon, May 19, 2014 at 8:31 AM, Corentin Dupont
However the instance in Control.Monad.Trans.Error.Error gets in the way... I cannot use this one, it works only with Strings. My use case is that the Either handle in the Right a final value, or else in the Left a list of things "left to do" to compute the value. How can I do?
You want to use a newtype to wrap your Either. It sounds like you would want to do this independently of the String instance because you are not using left as shortcutting failure anyway, rather you want to collect together the failure actions. newtype NotDoneYet b a = NotDoneYet (Either [b] a) instance Applicative (NotDoneYet b) where Left xs <*> Left ys = Left (xs ++ ys) ... -- John Meacham - http://notanumber.net/