Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-08 Thread Joey Eremondi
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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-07 Thread Dave Ford
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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-07 Thread Peter Damoc
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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-07 Thread Joey Eremondi
> > 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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-07 Thread Joey Eremondi
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,

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-07 Thread John Orford
+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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-07 Thread 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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-06 Thread Max Goldstein
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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-06 Thread Ambrose Laing
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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-06 Thread Dave Ford
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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-06 Thread Duane Johnson
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

Re: [elm-discuss] No Runtime Exceptions - Still not computing

2016-10-06 Thread Dave Ford
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

[elm-discuss] No Runtime Exceptions - Still not computing

2016-10-06 Thread Dave Ford
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