[elm-discuss] Re: Elm dynamically loading a decoder based on previous field

2016-12-02 Thread Leroy Campbell
I've posted a full example here: https://gist.github.com/artisonian/4f62ee4572a788d5d801c997e5a560ce If it'd be helpful, I can work on a writeup to explain my design choices. On Friday, December 2, 2016 at 8:11:45 PM UTC-5, Nima Birgani wrote: > > Hi all, > > I'm trying to decode an relatively

[elm-discuss] Re: How to write function that updates arbitrary element of a record

2016-10-23 Thread Leroy Campbell
I think I have something close to what you're looking for, but my solution makes me wonder, *why store text in your model rather than the parsed float/int values?* It seems like you want the parsed values for a calculation, not to format a paragraph of text. update : Msg -> Model -> Model

Re: [elm-discuss] Outgoing port event ordering

2016-10-17 Thread Leroy Campbell
gt; calling window.close, the current port implementation would have worked for > me. > > On Oct 17, 2016 2:03 PM, "Leroy Campbell" <artis...@gmail.com > > wrote: > >> From what I can tell, port communication uses Cmd because interop with >> JavaScript isn'

Re: [elm-discuss] Outgoing port event ordering

2016-10-17 Thread Leroy Campbell
>From what I can tell, port communication uses Cmd because interop with JavaScript isn't necessarily a request-response communication pattern (instead, port are pubsub). But I do have a question: *Is the underlying problem a need to coordinate access to a shared resource in JavaScript? *I ask

[elm-discuss] Difficulty learning Elm

2016-09-27 Thread Leroy Campbell
Rather than decode to nested Dict types, you could create types that represent your domain better (assuming the underlying JSON is well-structured). You can also use `andThen` to decode based on some field in your objects. -- You received this message because you are subscribed to the Google

[elm-discuss] Private state: A contrived example

2016-09-09 Thread Leroy Campbell
Mark, I don't understand why so much concern about private state. The reason components (in JS frameworks) need private state is to protect them from accidental mutation by callers. With immutable data, I don't see a need to hide data. I've had to maintain several 10K+ JavaScript codebases.

[elm-discuss] What concepts and models did you had to learn in order to be able to write good Elm code?

2016-08-11 Thread Leroy Campbell
I'd say learning how to make illegal states unrepresentable. https://vimeo.com/162036084 -- 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

Re: [elm-discuss] Re: port module for JS interop.. without main/view ?

2016-07-28 Thread Leroy Campbell
Just to clarify, inbound messages to Elm are batched (enqueued) and then executed on nextTick. And to echo Luke, observables would make more sense. A Promise-based interface would mean supporting only request-response semantics. Observables not only allow for request-response, but also

[elm-discuss] Re: How do I organize "inheritance" between my data types?

2016-07-18 Thread Leroy Campbell
It may help to watch this talk on modeling from a functional programming perspective (features F#, but applicable to Elm since they both are ML-based): https://vimeo.com/162036084 On Sunday, July 17, 2016 at 7:06:32 PM UTC-4, Leonardo Sá wrote: > > Short question: > > What is the best way to

[elm-discuss] Re: Port Error

2016-07-18 Thread Leroy Campbell
I recreated your example without issue, so I wonder if there is another problem. Here's a fork of your gist: https://gist.github.com/artisonian/11e93321cd7fd108142115269cbeafe7 On Monday, July 18, 2016 at 4:40:06 AM UTC-4, Zachary Kessin wrote: > > I am having a strange problem with ports, I am

[elm-discuss] Re: Union type list

2016-05-22 Thread Leroy Campbell
I assume if it were possible to have lists with mixed types, you'd lose some algebraic guarantees. How would you use such a list? There's probably another way to accomplish the same thing while retaining type safety. On Friday, May 20, 2016 at 1:41:38 PM UTC-4, John Orford wrote: > > Why isn't