As for not allowing exceptions to bubble to the top, you can’t let them
bubble all the way to the top. The point is that the type system allows you
to see exactly where exceptions happen, or are caught, just by looking at
the type of an expression.

If you want to allow exceptions to bubble up, look at the andThen functions
for Maybe and Result, both of which allow you to chain possibly failing
computations together.


(BTW, I've also posted this as a response on your blog)

On Wed, Sep 7, 2016 at 10:46 AM, Joey Eremondi <joey.eremo...@gmail.com>
wrote:

> So, a more nuanced statement would be "Elm has no unchecked runtime
> exceptions".
>
> We use Maybe and Result in place of Null and Exceptions. But the key is
> that the type system *forces* you to catch these. There's no (fromMaybe :
> Maybe a -> a) function, like there is in Haskell.
>
> What's also relevant is that a number of things that are runtime
> exceptions in other languages, like Null access, or array out of bounds,
> are not in Elm. They force you to check your exceptions.
>
> You *can* call Debug.crash, but don't, unless you know that your code will
> never reach that branch, or you have some really good reason. Check your
> exceptions and exit gracefully.
>
> It's pretty analogous to Java's checked exceptions, where the exception is
> in the type of the function, and you *have* to either catch the exceptions,
> or throw them yourself.
>
>
> On Wed, Sep 7, 2016 at 10:08 AM, Dave Ford <df...@smart-soft.com> wrote:
>
>> One of Elm’s most interesting features is "No Runtime Exceptions".
>>
>> But I would argue that Elm does in fact have Runtime Exceptions, even if
>> you don't call it that. I explain my reasoning in this blog post:
>>
>> https://medium.com/@daveford/my-take-on-elm-runtime-exceptio
>> ns-b3c5156887c9#.p1mrtcr2m
>>
>> I may very well be misunderstanding something. So please correct me if I
>> am missing the point.
>>
>> Thanks.
>>
>> --
>> 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