Re: [elm-discuss] Re: Separating model state structure from the view hierarchy

2017-07-21 Thread Mark Hamburg
Confluence of threads between this one and the question about subscriptions just made me realize that passing the data model down through the view model hierarchy on each update to the data model is not the worst thing in the world from a performance standpoint when you consider that a subscription

Re: [elm-discuss] Passing whole state to each view function

2017-07-21 Thread Raoul Duke
if passing the whole db, i wonder if i want something like structural types on the consuming apis to keep things more clear & safe & sane. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails fr

Re: [elm-discuss] Passing whole state to each view function

2017-07-21 Thread Mark Hamburg
Per the other thread discussing this this morning, I don't know that passing the whole data model to all of the view-side functions is that horrendous. (We pass around a UXConfig structure in all of our views to provide access to translation functions amongst other things and the biggest pain is th

Re: [elm-discuss] Re: Why is the signature of 'program.subs' 'model -> Sub msg' ?

2017-07-21 Thread Mark Hamburg
My understanding is that yes, Elm does this with every update and then the effects managers have to look at the new subscriptions and compare them to the old subscriptions. I would love to hear that my understanding is wrong because while this isn't bad if you have just a few subscriptions, it seem

Re: [elm-discuss] Re: Separating model state structure from the view hierarchy

2017-07-21 Thread Mark Hamburg
One argument against the "pass the model to all view functions" approach is that it pretty much blows up laziness. If one ignores that, then one could do something like the following: * All view-side functions including both update and view receive a global context containing the data model. (Fir

[elm-discuss] Re: Separating model state structure from the view hierarchy

2017-07-21 Thread Martin Norbäck Olivers
Hi! We discussed this on the slack the other day, right? Let me just get this straight, the Re-Frame solution depends on functions having access to a global "db" object or similar (that corresponds to the Elm model)? How is that conceptually different than passing the model as a parameter throu

Re: [elm-discuss] main : Program Never Model Msg -- What does it mean?

2017-07-21 Thread Андрей Коппель
This means that main returns Program type (http://package.elm-lang.org/packages/elm-lang/core/5.1.1/Platform#Program ). It has three arguments which are flags, model and msg. Never means there will no always no flags. Mo

[elm-discuss] Re: Unexpected compiler behaviour and message "pattern is redundant".

2017-07-21 Thread Patrick Stubner
I haven't really used Elm that much, but you may want something like this: module Main exposing (..) import Html exposing (Html, text, div) type Message = Good | Bad | ManyOthers type alias Node = { message : Message } trymatch : Node -> Message -> Bool *trymatch node messageParam =* *nod

[elm-discuss] Re: ADT: How to know whether two values have the same constructor?

2017-07-21 Thread Gabriel Sartori
I am not sure if this snippet would help you > type ValA = A1 | A2 > type Bla = A ValA Int | B Int > valA1 = A 1 A1 > valA2 = A 2 A2 > > > > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving em

Re: [elm-discuss] Passing whole state to each view function

2017-07-21 Thread ajs
> However, the downside of doing passing the entire model everywhere is that > you have to keep the entire model in your head when looking at any of your > view functions. This is correct, but how can you avoid passing the whole model to all views if the data model isn't structured similarly t

Re: [elm-discuss] ADT: How to know whether two values have the same constructor?

2017-07-21 Thread Allan Clark
If you want to have the compiler complain when you add a new constructor then: haveSameConstructor : Bla -> Bla -> Bool haveSameConstructor first second = case (first, second) of (A _, A _) -> True (A _, _) -> False (B _, B _) -> True

Re: [elm-discuss] any editor supports elm simple whole-buffer reformat?

2017-07-21 Thread Wendel Wang
For me the LightTable elm-light plugin works well. You install it with the plugin manager and then set up the keymapping depending on you rpreferences. An example setup is given in the elm-light docu that you can just cut and paste into you user-settings file. I have set up elm-format on save.

[elm-discuss] Separating model state structure from the view hierarchy

2017-07-21 Thread ajs
I had an interesting discussion with several members on the #beginners channel on Slack. It was suggested I post this out to the larger community for input. As a quick background, I'm a professional Clojurescript developer for many years, and have been through the early days of React (when it w

[elm-discuss] Re: Elm.fullscreen is not a function

2017-07-21 Thread Denis Kolodin
Another reason for 0.18: I take `Elm.MyApp.fullscreen is not a function` when I forget to add `main` (which calls `Html.program`) function to MyApp module. On Wednesday, June 29, 2016 at 12:29:24 PM UTC+3, Stuart Axon wrote: > > I've been getting started with elm using the environment described

[elm-discuss] Leaking event handlers with Elm SPA

2017-07-21 Thread Deedostar
Hi everyone, I have recently thought about how there is a chance in Elm to leak event handlers if they are not cleaned up properly. A basic scenario where this can happen is this: Assume an SPA made of React with some embedded Elm parts which uses subscriptions. Now navigate to a page, which h

[elm-discuss] Leaking event handlers with Elm SPA

2017-07-21 Thread Deedostar
Hi everyone, I have recently thought about how there is a chance in Elm to leak event handlers if they are not cleaned up properly. A basic scenario where this can happen is this: Assume an SPA made of React with some embedded Elm parts which uses subscriptions. Now navigate to a page, which h

Re: [elm-discuss] Re: Why is the signature of 'program.subs' 'model -> Sub msg' ?

2017-07-21 Thread Vasily Vasilkov
Does it mean that Elm runtime creates and cancels subscriptions on the fly (for  every model change)? On Mon, Jul 17, 2017 at 6:19 PM +0400, "Marek Fajkus" wrote: Sometimes you don't need subscriptions