Re: [elm-discuss] Best practices for designing models in the Elm Architecture - lean or rich?

2017-07-25 Thread Christian Charukiewicz
In your expensive function example, you should be able to take advantage of Html.Lazy to prevent the view from re-running the expensive function unless its parameters change. By storing the derived data in the model rather than letting Elm handling the caching through the Lazy functions, you

[elm-discuss] Re: Best practices for designing models in the Elm Architecture - lean or rich?

2017-07-24 Thread Christian Charukiewicz
You should not keep derived values in the model. The model should be a single source of truth. This property is violated if you store derived data in the model. What happens if you create a new input that fires a different Msg that only updates the height, but does not recompute and update

[elm-discuss] Re: On producing production product

2017-06-07 Thread Christian Charukiewicz
> > Well, I run this small team that somehow, after Elm, became a lot bigger, > even tho the number of people remained. Fantastic way to summarize the impact of Elm on a small team. I share the same experience since we adopted Elm for production use. On Wednesday, June 7, 2017 at 6:56:01

[elm-discuss] Re: Google Places and Elm / Identifying when Elm is mounted

2017-04-03 Thread Christian Charukiewicz
I think what you want to do here is load your compiled Elm js script followed by your googleapis script. One way to do this would be to use jQuery's getScript() function (or a vanilla JS equivalent of it ) to sequence the order of the loading. With jQuery

[elm-discuss] Re: Flags vs Ports

2017-04-03 Thread Christian Charukiewicz
This is correct. I think you listed the primary use cases that each interface serves, but I would say ports goes beyond just data. I can provide a few examples of how we use both. Our Elm application is embedded into several pages of a much older and larger CakePHP application (CakePHP is a

[elm-discuss] Re: Compiler option to disable camel-case record property requirement?

2017-03-30 Thread Christian Charukiewicz
Sorry I made a few bad typos in my last example function. It should be: decodeUser : String -> User decodeUser jsonString = decodeString userDecoder jsonString On Thursday, March 30, 2017 at 12:14:23 PM UTC-5, Christian Charukiewicz wrote: > > To add onto what Rupert said, my a

[elm-discuss] Re: Compiler option to disable camel-case record property requirement?

2017-03-30 Thread Christian Charukiewicz
ay, March 30, 2017 at 12:11:44 AM UTC-5, Stein Setvik wrote: > > We're using Ports to bring the data from js into elm. > > On Wednesday, March 29, 2017 at 9:01:45 PM UTC-7, Christian Charukiewicz > wrote: >> >> Can you elaborate on how you are getting the data from the bac

Re: [elm-discuss] Better syntax for nested pattern matching (destructuring)?

2017-03-29 Thread Christian Charukiewicz
It's an option in the browser-based rich text editor that appears when posting/replying. The button looks like curly braces "{}". Highlight the code you have written and then press the button. On Wednesday, March 29, 2017 at 11:12:31 PM UTC-5, Duane Johnson wrote: > > May I ask how you

[elm-discuss] Re: Better syntax for nested pattern matching (destructuring)?

2017-03-29 Thread Christian Charukiewicz
We have found that this pattern is typically a good case for chaining a bunch of andThen statements with a withDefault statement at the end together. The one thing is you would have to be able to adjust your values to all be Maybes. For example, if you have the following: case someMaybeVal

[elm-discuss] Re: Compiler option to disable camel-case record property requirement?

2017-03-29 Thread Christian Charukiewicz
Can you elaborate on how you are getting the data from the backend into Elm values? Are you not using Elm decoders? We use snake_case for all of our database fields, and writing decoders that will receive the JSON and produce Elm values is a step we have to take with all of our data before it