Do not use Either. The Result type in the standard library is the same, but
with the names more intuitive.
On Oct 7, 2016 11:58 PM, "Arthur Welf" wrote:
> If you want error messages, you can use type Either:
>
> type Either a b
> = Left a
> | Right b
>
> You define the
On Fri, Oct 7, 2016 at 11:10 AM, Peter Damoc wrote:
>
> If you can come up with a practical scenario where you would have an
> exception, I or someone else around here could tell you what would happen
> in Elm in that context.
>
Yes. The example I gave when I started the thread
On Fri, Oct 7, 2016 at 8:08 PM, Dave Ford wrote:
>
> But exception bubbling is a *feature*. An extremely useful feature.
> Language level support for exceptions has been a staple of every
> programming language since C. I do not consider Maybe and Result to be a
> useful
>
> Runtime exceptions are inevitable
The successful applications written in Elm proves that they are not. You
can keep saying it, but it doesn't make it true.
This is a path that Rust is following as well, so it's not like we're the
only people in the tech community with this attitude.
I
If you want Exception Bubbling like that, use Maybe.andThen or
Result.andThen. These are exactly what they are for.
You can bubble your exceptions as high as you like, but (1) that bubbling
is always expressed in the type signature, and (2) there's always something
that will catch it eventually,
+1 Peter
Elm forces you to explicitly handle failures - whereas you in many other
languages the use of exception handling is optional.
this freaks some people out, because it's so deeply baked in, that they can
miss it's there at all : )
On Fri, 7 Oct 2016 at 09:32 Peter Damoc
On Fri, Oct 7, 2016 at 5:13 AM, Dave Ford wrote:
> So, based on my understanding, the whole "no runtime exceptions" concept
> is just not computing.
>
> But I am new to Elm. Surely I am misunderstanding something. Please tell
> me what I am missing.
>
Programs will always
Yes, Result is worth looking at. It's like Maybe, except the error case can
carry some information too (usually a string). Task is used for
asynchronous effects (e.g. HTTP requests) which often can fail in odd ways.
I'd focus on Result for now, as all the tooling I'm about to mention is the
Elm has datatypes called Maybe, Result and Task. You mentioned Maybe
already, which may be understood to mean a list of at most one item, or a
data type with either missing data, or an unspecified error. Result allows
you to specify the error and propagate it, so take a look at that. Then
Duane. Don't get me wrong. I prefer compile errors over runtime errors.
And if Elm can catch more errors at compile time without adding a bunch of
noise to my code that is a good thing obviously.
But runtime errors are unavoidable. It's not possible for the compiler to
catch every possible error
On Thu, Oct 6, 2016 at 8:13 PM, Dave Ford wrote:
> 2. *Runtime Exception. *Like a NullPointerException or an
> IllegalArgumentException. I *love* these kind of bugs. Super easy to
> find. Super easy to fix. A stack trace tells me exactly where to look.
> These kind of
Thanks Joey.
> you will handle the error case, and either come up with a sensible
> default, or tell your program to display some error message, or do
> something else to properly handle the error.
>
You mean, do exactly like I showed in the java newbie example? What would
be considered an
I have listened to a number of podcasts where Richard Feldman boasts about
never getting a runtime exception.
I am having a hard time grasping the concept. I think I look at runtime
exceptions a bit differently. I look at them as a *positive*. A programmers
tool. A debugging tool. A way to
13 matches
Mail list logo