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

2016-10-08 Thread Zachary Kessin
Putting on my Erlang Developer hat (Moto: Let it Crash) I look at it this way there are two kinds .of errors, normal errors an exceptional errors. Lets say you want to go to the store to buy a dozen eggs. There are a few possible outcomes here 1) You get the eggs 2) You can't buy the eggs (Store

Re: [elm-discuss] Re: Creating an API to be consumed by JS developers

2016-10-08 Thread Dave Ford
That's pretty much how GWT was. On Sat, Oct 8, 2016 at 1:34 PM, OvermindDL1 wrote: > The 'official' interaction between Elm and javascript is via ports, which > involves marshelling any JSON-compatible type across the interface. From > the Javascript side it involves

Re: [elm-discuss] Maybe.andThen with List.foldr type trick?

2016-10-08 Thread Duane Johnson
Ah, I misunderstood the order of foldr. Thanks alll. BTW, this helped me see where I'd gone wrong: http://stackoverflow.com/questions/1757740/how-foldr-works#1763323 On Sat, Oct 8, 2016 at 10:09 AM, Janis Voigtländer < janis.voigtlaen...@gmail.com> wrote: >

[elm-discuss] Re: Which text editor do you prefer for Elm?

2016-10-08 Thread Thomas Droxler
Hi everyone, I'm using vim (neovim) with `ElmCast/elm-vim` and I'm currently integrating elm to Sarsi (see PR ). This allows me to automatically jump on error (no need to read the file/line/column in the error

[elm-discuss] Creating an API to be consumed by JS developers

2016-10-08 Thread Dave Ford
My experience with compile-to-js languages include: GWT, Dart and TypeScript. GWT was very good at *calling* JS libraries. Almost zero friction. But not so, in the other direction. Creating API's to be consumed by JS was so ugly that I can confidently say that it was not worth it. Unless you

Re: [elm-discuss] Maybe.andThen with List.foldr type trick?

2016-10-08 Thread Janis Voigtländer
http://package.elm-lang.org/packages/elm-community/maybe-extra/2.0.0/Maybe-Extra#combine You can also check that function's source code. > Am 08.10.2016 um 17:03 schrieb Max Goldstein : > > The Elm compiler is correctly telling you that your list is a list of >

Re: [elm-discuss] Re: Pattern matching functions

2016-10-08 Thread 'Andrew Radford' via Elm Discuss
Well the idea is to add a *different* keyword to make a function, using similar syntax to case/of . As above, you can see F# uses the 'function' keyword, which TBH I'm not huge fan of, it's really hard to google. Elm already has syntax of convenience like this, for example instead of having

Re: [elm-discuss] View: Model -> Html Msg

2016-10-08 Thread Max Goldstein
Syntactically, it's just like List Int. Msg is a type parameter of Html. Semantically, Html is not a data structure. It's a somewhat magical thing that can produce messages when the user interacts with it. The type parameter tells you what those messages are. -- You received this message

Re: [elm-discuss] View: Model -> Html Msg

2016-10-08 Thread Joey Eremondi
Exactly, it's a type parameter. Html is parameterized by the type of messages the form can produce. On Oct 8, 2016 9:25 AM, "Dave Ford" wrote: > I understand this function signature: > > update: Msg -> Model -> Model > > to mean the function takes two inputs, a Msg and a

Re: [elm-discuss] In

2016-10-08 Thread Joey Eremondi
Nothing except when paired with a let. You do let x = foo y = bar ... in baz This let's you break up large expressions, and avoid recomputing values that are used more than once. On Oct 8, 2016 9:26 AM, "Dave Ford" wrote: > What does the in keyword do? > >

[elm-discuss] In

2016-10-08 Thread Dave Ford
What does the in keyword do? -- 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

Re: [elm-discuss] Maybe.andThen with List.foldr type trick?

2016-10-08 Thread Joey Eremondi
Oops, in the first case it should return Just [], not [] On Oct 8, 2016 9:02 AM, "Joey Eremondi" wrote: > I'm not sure using and then will work like this in the accumulator, you're > giving it a list of thunks, but andThen tries to chain functions together, > and your

Re: [elm-discuss] Maybe.andThen with List.foldr type trick?

2016-10-08 Thread Joey Eremondi
I'm not sure using and then will work like this in the accumulator, you're giving it a list of thunks, but andThen tries to chain functions together, and your functions don't chain like that. How about this: forMaybe list = case list of [] -> [] hm::tm -> hm `andThen` \h -> (forMaybe tm)

[elm-discuss] Maybe.andThen with List.foldr type trick?

2016-10-08 Thread Duane Johnson
To avoid the XY problem: I'm aiming to create a function that will take a List (Maybe a) and return a Maybe (List a), where the result will be Nothing if ANY of the (Maybe a)s are Nothing, otherwise it will be a list of just the "a"s. Here's where I'm getting tripped up in that quest, however:

Re: [elm-discuss] Re: Pattern matching functions

2016-10-08 Thread Joey Eremondi
Much like how we don't have where clauses, the general approach in Elm is to only have one syntax for a particular thing. On Oct 8, 2016 7:18 AM, "Luke Westby" wrote: > case .. of statements are only expressions, not functions, so you'll need > to continue wrapping those

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

2016-10-08 Thread Martin Janiczek
Dave, how do you think about JavaScript Promises? Where you code for the happy path (the chain of Promise.resolve().then().then().then()), any of which can throw, and have a .catch() handler that catches whatever the thrown value was and does something about it. The Elm Result type is very

[elm-discuss] Pattern matching functions

2016-10-08 Thread 'Andrew Radford' via Elm Discuss
In F# there are pattern matching case/of statements can be written as functions, which is handy for composing with other functions, piping with |> etc: let foo1 x = match x with | 1 -> "one" | _ -> "not one" let foo2 = function | 1 -> "one" | _ -> "not one" Has there

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