@Dave Ford: that's literally what Maybe.andThen and Result.andThen are for.
See also Maybe.map, and Result.map.

They let you chain together several computations that may throw an
exception. You can take a computation which throws an exception, and a
computation which expects a non-exception argument, and compose them into a
new computation that throws an exception. Use map when the computation
taking the argument throws no exception, and use andThen when it can itself
throw an exception.

Using these, you can handle your exceptions as high or as low in the
program logic as you'd like. You can let the exceptions bubble up using
andThen and map.

On Thu, Sep 8, 2016 at 10:21 AM, Dave Ford <df...@smart-soft.com> wrote:

> The analogous part is the fact you end with "exception handling" code
> interspersed throughout your main logic flow. That part seems very much
> like C to me.
>
> On Wednesday, September 7, 2016 at 1:23:24 PM UTC-7, Nick H wrote:
>>
>> I don't think the comparison to C is accurate at all. Error codes in C
>> are a programming convention. As far as the compiler is concerned, all ints
>> are created equal. Nothing is reminding the programmer to check for error
>> codes.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to