<div dir="ltr"><a href="http://hackage.haskell.org/package/validation-0.3.4/docs/Data-Validation.html">http://hackage.haskell.org/package/validation-0.3.4/docs/Data-Validation.html</a><br><br></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Thu, May 22, 2014 at 7:46 AM, John Meacham <span dir="ltr"><<a href="mailto:john@repetae.net" target="_blank">john@repetae.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

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