You might also want to check out Chronicle monad in these package: <a href="https://hackage.haskell.org/package/these-0.6.2.1/docs/Control-Monad-Chronicle.html">https://hackage.haskell.org/package/these-0.6.2.1/docs/Control-Monad-Chronicle.html</a><br><br>Kind regards,<br>Nick<br><div class="gmail_quote"><div dir="ltr">On Sat, 6 Feb 2016 at 11:58, Roman Cheplyaka <<a href="mailto:roma@ro-che.info">roma@ro-che.info</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It sounds like you want the Validation applicative functor.<br>
See e.g. <a href="https://ro-che.info/articles/2015-05-02-smarter-validation" rel="noreferrer" target="_blank">https://ro-che.info/articles/2015-05-02-smarter-validation</a><br>
<br>
On 02/06/2016 04:58 AM, Lian Hung Hon wrote:<br>
> Dear haskellers,<br>
><br>
> I have a multi-step computation. The steps are predefined, but users can<br>
> choose which steps to execute (something like a recipe). Here is an<br>
> example recipe:<br>
><br>
> Step 1 - Get data from network (multiple HTTP calls) and put into a list<br>
> Step 2 - Process the data (e.g. average, sum, median, etc.)<br>
> Step 3 - Persist result to database<br>
><br>
> Sometimes, Step 1 can fail for some of the HTTP calls. When this<br>
> happens, Step 2 should continue as much as possible using whatever data<br>
> that has been retrieved, but somehow indicate that an error has occurred<br>
> and the result is partial.<br>
><br>
> Q1: What is the idiomatic way of achieving this? Using throwError in<br>
> Control.Monad.Except aborts the computation, which isn't what I want.<br>
><br>
> Q2: (General software design) Furthermore, where should the error be<br>
> logged? Logging it in both Step 1 and 2 preserves modularity for each of<br>
> the steps, unfortunately it would result in duplicate error messages.<br>
> What is the best practice for this?<br>
><br>
> Regards,<br>
> Hon<br>
><br>
><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
><br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div>