[elm-discuss] Re: Got runtime error with nested json decoders

2017-03-28 Thread Adrian Ribao
Thanks!

I finally got the decoders to work, and I'm planning to write a post about 
that.



El lunes, 27 de marzo de 2017, 15:24:52 (UTC+2), Murphy Randle escribió:
>
> Hi, Adrian! I've struggled with this myself. And I wouldn't say that I 
> really understand the problem well, but It seems that any time you have 
> mutually recursive decoders, things can get messy at this point. I've taken 
> your example and made more of the decoders lazy: 
>
> https://ellie-app.com/LhJ5r5MX7ca1/0
>
> Now the runtime error is gone, but the decoding fails. But hopefully that 
> helps!
>
> On Monday, March 27, 2017 at 4:37:38 AM UTC-6, Adrian Ribao wrote:
>>
>> Hello,
>>
>> I'm creating a library to manage persistence with an Elixir backend using 
>> Phoenix Framework. In Phoenix, invalid fields are returned like this:
>>
>> { "errors" : 
>> field_name: ["list", "of", "errors"]
>> }
>>
>> And when you are working with nested relations, errors are like:
>>
>> { "errors" : 
>> nested_form: [
>> {name: ["Name too short"]}
>> ]
>> }
>>
>> For each field name, instead of getting a list of strings, now you get a 
>> dict with a list of strings.
>>
>> The two kind of errors may appear in the same json:
>>
>> { "errors" : 
>> field_name: ["This field is not valid"],
>> nested_form: [
>> {name: ["Name too short"]}
>> ]
>> }
>>
>> I've created a recursive decoder, you can see it here: 
>> https://ellie-app.com/LdLVZWNJHfa1/11
>>
>> But event though it compiles, using the lazy function raises a runtime 
>> exception.
>>
>> Is this a bug or I'm implementing it wrong?
>>
>> Thanks,
>>
>> Adrián
>>
>>

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Help with Jupyter/IPython notebook kernel for Elm

2017-03-28 Thread Austin Bingham
FWIW, I see that when the generated javascript is passed back to the 
Jupyter client, the client calls eval() on the javascript. This seems to 
work OK, insofar as it doesn't throw an exception. However - and this is 
where I'm a bit out of my depth - none of the bindings made in the 
javascript seem to be available in the calling context. Maybe this is the 
nature of eval(), but I'm not sure. The "ReferenceError" I reported 
initially seems to actually come from when I try to use the "Elm" object to 
embed the app in a DOM object.

On Monday, March 27, 2017 at 8:10:33 PM UTC+2, Austin Bingham wrote:
>
> Hi everyone,
>
> I started hacking a bit today on a Jupyter notebook kernel for elm. You 
> can see it here:
>
> https://github.com/abingham/jupyter-elm-kernel 
> 
>
> It doesn't quite work yet, though, and I think I need help from someone 
> who knows javascript/requirejs/web stuff a bit better than me. The proximal 
> problem I'm seeing is that when jupyter tries to run the elm-make-generated 
> javascript, it thinks that 'Elm' is undefined during (I think) some part of 
> the AMD machinery. Jupyter show this as the output for the cell:
>
> Javascript error adding output!
> ReferenceError: Elm is not defined
> See your browser Javascript console for more details.
>
> As far as I can see, Elm *should* be defined, and certainly the generated 
> code looks like any other Elm output I've looked at. So I'm a bit stumped.
>
> My approach to the kernel is currently very simple. The kernel is 
> implemented in Python, and it receives a blob of Elm source code. I dump 
> this to a temp file, use a subprocess to run "elm-make" to make the output, 
> read the output, and ship it back to jupyter. As far as I can see, all of 
> that is working properly. I run into problems when jupyter tries to execute 
> the stuff I return. This design may or may not be optimal in the long run, 
> but I want to get the plumbing working first.
>
> So if someone feels up to the challenge, I'd love any help I could get. 
> This seems like it should be pretty straightforward, but perhaps I'm being 
> naive and/or missing something obvious.
>
> Of course, I'm also happy to discuss other aspects of the kernel (e.g. 
> design, compilation technique, etc.), but my priority is to just get 
> something into an output cell.
>

-- 
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 https://groups.google.com/d/optout.


Re: [elm-discuss] Elm webcomponents for microservice front-end

2017-03-28 Thread Charles-Edouard Cady
Hi Peter! Thanks for your reply!

Front-end composition from microservices is an emerging pattern which 
allows cross-functional teams to independently deploy features (including 
back-end and front-end).
Each team has full responsibility of the feature they release (from 
back-end to front-end), which gives them full autonomy to release whenever 
they are ready.
It's a pattern used by Netflix, Amazon or Spotify, to name a few.

You can learn more about it here:

https://technologyconversations.com/2015/08/09/including-front-end-web-components-into-microservices/
http://techblog.scout24.com/2016/01/unexpected-solution-microservices-ui-composition/
https://medium.com/@clifcunn/nodeconf-eu-29dd3ed500ec



On Tuesday, March 28, 2017 at 8:58:22 AM UTC+2, Peter Damoc wrote:
>
>
> On Tue, Mar 28, 2017 at 9:26 AM, Charles-Edouard Cady <
> charlesed...@gmail.com > wrote:
>
>> I'm composing a single-page application from several microservices 
>> back-ends. Each back-end should render a part of the page.
>>
>> Right now I'm considering using webcomponents:
>>
>> - main page is in Elm and subscribes to a websocket giving it the list of 
>> microservices it can get webcomponents from
>> - each microservice serves an html page containing the web component & 
>> its name
>> - the main page dynamically includes the webcomponent & uses its name to 
>> create the node in the DOM
>>
>> This means that whenever I switch a microservice on the component appears 
>> on the page & it disappears when I switch the microservice off.
>>
>> The reason I'm using webcomponents here is that I may include 
>> microservices written by third parties who do not necessarily want to be 
>> locked in using Elm, or any specific technology for that matter.
>>
>> I therefore need two things :
>>
>> (1) the ability to use webcomponents in Elm (I think this has already 
>> been covered, except maybe some conflicts between Elm's virtual DOM & the 
>> webcomponent's virtual DOM)
>> (2) the ability to write webcomponents in Elm.
>>
>> I'm not too sure about number 2: what I've seen in the list so far is 
>> mainly interest in using webcomponents but not so much in writing them. 
>> Does anybody have more information on this? Any help would be greatly 
>> appreciated!
>>
>> Here is how you would implement a web component in regular Elm & Polymer 
>
> https://github.com/kevinlebrun/elm-polymer/tree/master/counter-elm-inside-polymer
>
> You will probably need to use some kind of head manipulation for 
> dynamically importing the web-components into your page. 
> I have never tried to do this but my intuition tells me it might be a very 
> bad idea. 
> Have you seen this approach done outside of Elm?  
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
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 https://groups.google.com/d/optout.


Re: [elm-discuss] Elm webcomponents for microservice front-end

2017-03-28 Thread Peter Damoc
My suggestion is to create a playground to explore this approach and
proceed with the actual implementation only after you get the details
right.

There are so many ways that this can break that have nothing to do with
Elm.




On Tue, Mar 28, 2017 at 11:19 AM, Charles-Edouard Cady <
charlesedouardc...@gmail.com> wrote:

> Hi Peter! Thanks for your reply!
>
> Front-end composition from microservices is an emerging pattern which
> allows cross-functional teams to independently deploy features (including
> back-end and front-end).
> Each team has full responsibility of the feature they release (from
> back-end to front-end), which gives them full autonomy to release whenever
> they are ready.
> It's a pattern used by Netflix, Amazon or Spotify, to name a few.
>
> You can learn more about it here:
>
> https://technologyconversations.com/2015/08/09/including-front-
> end-web-components-into-microservices/
> http://techblog.scout24.com/2016/01/unexpected-solution-
> microservices-ui-composition/
> https://medium.com/@clifcunn/nodeconf-eu-29dd3ed500ec
>
>
>
> On Tuesday, March 28, 2017 at 8:58:22 AM UTC+2, Peter Damoc wrote:
>>
>>
>> On Tue, Mar 28, 2017 at 9:26 AM, Charles-Edouard Cady <
>> charlesed...@gmail.com> wrote:
>>
>>> I'm composing a single-page application from several microservices
>>> back-ends. Each back-end should render a part of the page.
>>>
>>> Right now I'm considering using webcomponents:
>>>
>>> - main page is in Elm and subscribes to a websocket giving it the list
>>> of microservices it can get webcomponents from
>>> - each microservice serves an html page containing the web component &
>>> its name
>>> - the main page dynamically includes the webcomponent & uses its name to
>>> create the node in the DOM
>>>
>>> This means that whenever I switch a microservice on the component
>>> appears on the page & it disappears when I switch the microservice off.
>>>
>>> The reason I'm using webcomponents here is that I may include
>>> microservices written by third parties who do not necessarily want to be
>>> locked in using Elm, or any specific technology for that matter.
>>>
>>> I therefore need two things :
>>>
>>> (1) the ability to use webcomponents in Elm (I think this has already
>>> been covered, except maybe some conflicts between Elm's virtual DOM & the
>>> webcomponent's virtual DOM)
>>> (2) the ability to write webcomponents in Elm.
>>>
>>> I'm not too sure about number 2: what I've seen in the list so far is
>>> mainly interest in using webcomponents but not so much in writing them.
>>> Does anybody have more information on this? Any help would be greatly
>>> appreciated!
>>>
>>> Here is how you would implement a web component in regular Elm & Polymer
>> https://github.com/kevinlebrun/elm-polymer/tree/master/
>> counter-elm-inside-polymer
>>
>> You will probably need to use some kind of head manipulation for
>> dynamically importing the web-components into your page.
>> I have never tried to do this but my intuition tells me it might be a
>> very bad idea.
>> Have you seen this approach done outside of Elm?
>>
>>
>>
>> --
>> There is NO FATE, we are the creators.
>> blog: http://damoc.ro/
>>
> --
> 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 https://groups.google.com/d/optout.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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 https://groups.google.com/d/optout.


Re: [elm-discuss] Re: To wrap or not to wrap

2017-03-28 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, March 28, 2017 at 3:31:34 AM UTC+1, Mark Hamburg wrote:
>
> A lot of the code I've written that has dealt with wrapped models has used 
> the `as` keyword but I've found that it makes the code harder to follow 
> because the pieces working with the unwrapped model are mixed with the 
> pieces working with the wrapped model. If I were refactoring the code and 
> not just getting rid of wrapping, I would probably just unwrap and rewrap 
> at the API layer and allow the rest of the code to ignore the issue as much 
> as possible.
>

Yes, I think that is a nice clean approach. You could also group your API 
functions together in one place:

module FunkyDoDa exposing (computeIt)

-- API

computeIt : Model -> Model
computeIt (Wrapped impl) =
  computeItImpl impl |> Impl

-- Implementation 

computeItImpl : Impl -> Impl
...

As all the API functions would be simple wrap/unwrap boiler plate, they 
would all be short. Put near the top of the file and then it is easy to 
scan the API and its type signatures.

The only module I have where I have written other modules that depend on 
what is inside the Model is my Auth module - other modules look up what the 
logged on state it, what the current username is etc. I added some features 
to it recently, and now it occurs to me that I would be better making its 
model opaque and supplying functions to extract the things other modules 
need to know, then I can refactor its model internally along the 
make-impossible-states-unrepresentable line and all the dependant modules 
will continue to work correctly.

-- 
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 https://groups.google.com/d/optout.


Re: [elm-discuss] Re: To wrap or not to wrap

2017-03-28 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, March 28, 2017 at 10:15:42 AM UTC+1, Rupert Smith wrote:
>
> -- API
>
> computeIt : Model -> Model
> computeIt (Wrapped impl) =
>   computeItImpl impl |> Impl
>
>
Should have been:

computeIt : Model -> Model
computeIt (Wrapped impl) =
  computeItImpl impl |> Wrapped

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, March 28, 2017 at 7:26:37 AM UTC+1, Charles-Edouard Cady wrote:
>
> (2) the ability to write webcomponents in Elm.
>
> I'm not too sure about number 2: what I've seen in the list so far is 
> mainly interest in using webcomponents but not so much in writing them. 
> Does anybody have more information on this? Any help would be greatly 
> appreciated!
>

I have implemented a list box as a webcomponent in Elm (and consumed it in 
Elm too). I'll see what state it is currently in and get back to you. But 
first, coffee... 

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, March 28, 2017 at 10:21:02 AM UTC+1, Rupert Smith wrote:
>
> On Tuesday, March 28, 2017 at 7:26:37 AM UTC+1, Charles-Edouard Cady wrote:
>>
>> (2) the ability to write webcomponents in Elm.
>>
>> I'm not too sure about number 2: what I've seen in the list so far is 
>> mainly interest in using webcomponents but not so much in writing them. 
>> Does anybody have more information on this? Any help would be greatly 
>> appreciated!
>>
>
> I have implemented a list box as a webcomponent in Elm (and consumed it in 
> Elm too). I'll see what state it is currently in and get back to you. But 
> first, coffee... 
>

Here it is, freshly upgraded to Elm 0.18:

https://github.com/rupertlssmith/wood-polymer 

I gave my Elm Polymer components based on Polymer 'paper' the name 'wood'. 
Because wood is related to paper and Elm is wood.

The main files of interest are:

https://github.com/rupertlssmith/wood-polymer/blob/master/src/elm/Listbox/Listbox.elm
https://github.com/rupertlssmith/wood-polymer/blob/master/src/webcomponents/wood-listbox.html

You can see how the web component is initialized by passing a property (the 
'items' function builds this property).

You can see how the web component triggers an event in elm by using a 
property change event handler.

You can see where I make use of the Polymer life-cycle to attach Elm into 
the Dom in the attached() method.

One thing that turned out strange with this is that to make use of Polymers 
automatic ability to notify on changed properties, I had to keep a copy of 
the list box state on the javascript side. I also have its state on the Elm 
side in the Model. This is rather unfortunate, as you can see various ports 
and subscriptions that are need to keep the two sides in sync. This feature 
of Polymer is convenient for working with it in javascript, but not for Elm.

The Polymer component would also tend to fire off _itemsChanged, when the 
items have not changed. So you can see I tried to filter out some of these 
spurious firings with arrays equal tests.

I used Polymer as a convenient way of getting started with web components, 
but I think perhaps it is the wrong library. Really Elm needs some support 
for web components added to it that is better attuned to how Elm works. My 
suggestion is a new Program type in Elm, that helps you build an Elm 
Program-as-webcomponent. However, to begin with we just figure out how to 
code Elm webcomponents by hand then figure out what bits of that can be 
extracted as helper code to be incorporated into Elm :-)

Also important, configure Polymer with these settings in index.html:


window.Polymer = {
dom: 'shadow',
lazyRegister: true
};


===

For your application, how much interaction is there between the web 
components and the main page? I expect from your description that the 
components are fairly self-contained - I think this makes them a reasonable 
candidate for implementing as web components within Elm.

The one problem you may have is if the Elm managed virtual DOM decides to 
re-render your webcomponent, it will be re-initialized and lose its 
internal state. This may not be so much of a problem. The situation where 
it may occur is if you have a list of these components within some div and 
you add another one and the whole div is re-rendered. Html.Keyed will help 
you out here.


===

Peter says you may find dynamically importing the components tricky? I 
don't think it will be so hard, as you can always import the necessary 
stuff inline in the Html body, you don't need to declare all imports 
up-front in the head.


-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread Charles-Edouard Cady
Thanks a lot, that's exactly what I was looking for!
For my application, the webcomponents' state will be concatenated & sent to 
a server for evaluation, because the server needs the state of all 
webcomponents to perform that evaluation.
What I'll do is ask the webcomponent to generate a JSON on event & Elm will 
simply send that uninterpreted JSON to the server without even parsing it 
(although I've had problems with the double quotes being escaped...)

Regarding the component's internal state, I'll regenerate it if it has been 
erased or is inconsistent with the component's attributes.

Once again, thank you: you just saved me a lot of time!

On Tuesday, March 28, 2017 at 12:15:35 PM UTC+2, Rupert Smith wrote:
>
> On Tuesday, March 28, 2017 at 10:21:02 AM UTC+1, Rupert Smith wrote:
>>
>> On Tuesday, March 28, 2017 at 7:26:37 AM UTC+1, Charles-Edouard Cady 
>> wrote:
>>>
>>> (2) the ability to write webcomponents in Elm.
>>>
>>> I'm not too sure about number 2: what I've seen in the list so far is 
>>> mainly interest in using webcomponents but not so much in writing them. 
>>> Does anybody have more information on this? Any help would be greatly 
>>> appreciated!
>>>
>>
>> I have implemented a list box as a webcomponent in Elm (and consumed it 
>> in Elm too). I'll see what state it is currently in and get back to you. 
>> But first, coffee... 
>>
>
> Here it is, freshly upgraded to Elm 0.18:
>
> https://github.com/rupertlssmith/wood-polymer 
>
> I gave my Elm Polymer components based on Polymer 'paper' the name 'wood'. 
> Because wood is related to paper and Elm is wood.
>
> The main files of interest are:
>
>
> https://github.com/rupertlssmith/wood-polymer/blob/master/src/elm/Listbox/Listbox.elm
>
> https://github.com/rupertlssmith/wood-polymer/blob/master/src/webcomponents/wood-listbox.html
>
> You can see how the web component is initialized by passing a property 
> (the 'items' function builds this property).
>
> You can see how the web component triggers an event in elm by using a 
> property change event handler.
>
> You can see where I make use of the Polymer life-cycle to attach Elm into 
> the Dom in the attached() method.
>
> One thing that turned out strange with this is that to make use of 
> Polymers automatic ability to notify on changed properties, I had to keep a 
> copy of the list box state on the javascript side. I also have its state on 
> the Elm side in the Model. This is rather unfortunate, as you can see 
> various ports and subscriptions that are need to keep the two sides in 
> sync. This feature of Polymer is convenient for working with it in 
> javascript, but not for Elm.
>
> The Polymer component would also tend to fire off _itemsChanged, when the 
> items have not changed. So you can see I tried to filter out some of these 
> spurious firings with arrays equal tests.
>
> I used Polymer as a convenient way of getting started with web components, 
> but I think perhaps it is the wrong library. Really Elm needs some support 
> for web components added to it that is better attuned to how Elm works. My 
> suggestion is a new Program type in Elm, that helps you build an Elm 
> Program-as-webcomponent. However, to begin with we just figure out how to 
> code Elm webcomponents by hand then figure out what bits of that can be 
> extracted as helper code to be incorporated into Elm :-)
>
> Also important, configure Polymer with these settings in index.html:
>
> 
> window.Polymer = {
> dom: 'shadow',
> lazyRegister: true
> };
> 
>
> ===
>
> For your application, how much interaction is there between the web 
> components and the main page? I expect from your description that the 
> components are fairly self-contained - I think this makes them a reasonable 
> candidate for implementing as web components within Elm.
>
> The one problem you may have is if the Elm managed virtual DOM decides to 
> re-render your webcomponent, it will be re-initialized and lose its 
> internal state. This may not be so much of a problem. The situation where 
> it may occur is if you have a list of these components within some div and 
> you add another one and the whole div is re-rendered. Html.Keyed will help 
> you out here.
>
>
> ===
>
> Peter says you may find dynamically importing the components tricky? I 
> don't think it will be so hard, as you can always import the necessary 
> stuff inline in the Html body, you don't need to declare all imports 
> up-front in the head.
>
>
>

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread Charles-Edouard Cady
I tried your application on Iceweasel. The checkboxes never get checked, 
but opening the Javascript console I can see the messages are getting 
through:

"Main: SelectChanged (Dict.fromList [("1","one"),("2","two")])" 
wood.js:907:2
"_itemsChanged : newValue = 1,one,2,two,3,three, oldValue = 
1,one,2,two,3,three"

It looks like Mdl messages are not coming through. The checkboxes are 
rendered correctly (mdl-style), just not checked.


On Tuesday, March 28, 2017 at 12:15:35 PM UTC+2, Rupert Smith wrote:
>
> On Tuesday, March 28, 2017 at 10:21:02 AM UTC+1, Rupert Smith wrote:
>>
>> On Tuesday, March 28, 2017 at 7:26:37 AM UTC+1, Charles-Edouard Cady 
>> wrote:
>>>
>>> (2) the ability to write webcomponents in Elm.
>>>
>>> I'm not too sure about number 2: what I've seen in the list so far is 
>>> mainly interest in using webcomponents but not so much in writing them. 
>>> Does anybody have more information on this? Any help would be greatly 
>>> appreciated!
>>>
>>
>> I have implemented a list box as a webcomponent in Elm (and consumed it 
>> in Elm too). I'll see what state it is currently in and get back to you. 
>> But first, coffee... 
>>
>
> Here it is, freshly upgraded to Elm 0.18:
>
> https://github.com/rupertlssmith/wood-polymer 
>
> I gave my Elm Polymer components based on Polymer 'paper' the name 'wood'. 
> Because wood is related to paper and Elm is wood.
>
> The main files of interest are:
>
>
> https://github.com/rupertlssmith/wood-polymer/blob/master/src/elm/Listbox/Listbox.elm
>
> https://github.com/rupertlssmith/wood-polymer/blob/master/src/webcomponents/wood-listbox.html
>
> You can see how the web component is initialized by passing a property 
> (the 'items' function builds this property).
>
> You can see how the web component triggers an event in elm by using a 
> property change event handler.
>
> You can see where I make use of the Polymer life-cycle to attach Elm into 
> the Dom in the attached() method.
>
> One thing that turned out strange with this is that to make use of 
> Polymers automatic ability to notify on changed properties, I had to keep a 
> copy of the list box state on the javascript side. I also have its state on 
> the Elm side in the Model. This is rather unfortunate, as you can see 
> various ports and subscriptions that are need to keep the two sides in 
> sync. This feature of Polymer is convenient for working with it in 
> javascript, but not for Elm.
>
> The Polymer component would also tend to fire off _itemsChanged, when the 
> items have not changed. So you can see I tried to filter out some of these 
> spurious firings with arrays equal tests.
>
> I used Polymer as a convenient way of getting started with web components, 
> but I think perhaps it is the wrong library. Really Elm needs some support 
> for web components added to it that is better attuned to how Elm works. My 
> suggestion is a new Program type in Elm, that helps you build an Elm 
> Program-as-webcomponent. However, to begin with we just figure out how to 
> code Elm webcomponents by hand then figure out what bits of that can be 
> extracted as helper code to be incorporated into Elm :-)
>
> Also important, configure Polymer with these settings in index.html:
>
> 
> window.Polymer = {
> dom: 'shadow',
> lazyRegister: true
> };
> 
>
> ===
>
> For your application, how much interaction is there between the web 
> components and the main page? I expect from your description that the 
> components are fairly self-contained - I think this makes them a reasonable 
> candidate for implementing as web components within Elm.
>
> The one problem you may have is if the Elm managed virtual DOM decides to 
> re-render your webcomponent, it will be re-initialized and lose its 
> internal state. This may not be so much of a problem. The situation where 
> it may occur is if you have a list of these components within some div and 
> you add another one and the whole div is re-rendered. Html.Keyed will help 
> you out here.
>
>
> ===
>
> Peter says you may find dynamically importing the components tricky? I 
> don't think it will be so hard, as you can always import the necessary 
> stuff inline in the Html body, you don't need to declare all imports 
> up-front in the head.
>
>
>

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Got runtime error with nested json decoders

2017-03-28 Thread Adrian Ribao
I've created a post about this decoder problem, I hope it helps other 
people: 
https://medium.com/@adrian_ribao/recursive-decoders-on-elm-to-manage-server-side-validation-errors-82bee47cc38c


El lunes, 27 de marzo de 2017, 12:37:38 (UTC+2), Adrian Ribao escribió:
>
> Hello,
>
> I'm creating a library to manage persistence with an Elixir backend using 
> Phoenix Framework. In Phoenix, invalid fields are returned like this:
>
> { "errors" : 
> field_name: ["list", "of", "errors"]
> }
>
> And when you are working with nested relations, errors are like:
>
> { "errors" : 
> nested_form: [
> {name: ["Name too short"]}
> ]
> }
>
> For each field name, instead of getting a list of strings, now you get a 
> dict with a list of strings.
>
> The two kind of errors may appear in the same json:
>
> { "errors" : 
> field_name: ["This field is not valid"],
> nested_form: [
> {name: ["Name too short"]}
> ]
> }
>
> I've created a recursive decoder, you can see it here: 
> https://ellie-app.com/LdLVZWNJHfa1/11
>
> But event though it compiles, using the lazy function raises a runtime 
> exception.
>
> Is this a bug or I'm implementing it wrong?
>
> Thanks,
>
> Adrián
>
>

-- 
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 https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Help with Jupyter/IPython notebook kernel for Elm

2017-03-28 Thread Noah Hall
If you join the https://elmlang.slack.com and join #elm-dev, I can
help you out (eeue56)

On Tue, Mar 28, 2017 at 4:53 PM, Berry Groenendijk
 wrote:
> Hi Austin,
>
> I like Jupyter/iPython a lot as a concept. I did not use it a lot though.
> And Elm seems to be like a natural fit.
>
> My dream would be to have live aka. living documents where static text and
> live code are intermingled. Jupyter is a step in the right direction. But,
> you still need a server.
>
> Just recently I found a thing called Klipse, see:
> http://blog.klipse.tech/javascript/2016/06/20/blog-javascript.html. It looks
> a lot like Jupyter (minus the document editing, but that should be trivial),
> but all the code is executed in the browser! It currently has support for
> clojure, ruby, javascript, python, scheme, es2017, jsx, brainfuck, c++ and
> Lua. Quite impressive. And if javascript works, them Elm should also work.
> Perhaps it is already possible... import elm.js... hmmm... I don't know.
>
> Sorry, if this post isn't directly related to Jupyter and your challenge to
> integrate Elm in Jupyter.
>
> Op maandag 27 maart 2017 20:10:33 UTC+2 schreef Austin Bingham:
>>
>> Hi everyone,
>>
>> I started hacking a bit today on a Jupyter notebook kernel for elm. You
>> can see it here:
>>
>> https://github.com/abingham/jupyter-elm-kernel
>>
>> It doesn't quite work yet, though, and I think I need help from someone
>> who knows javascript/requirejs/web stuff a bit better than me. The proximal
>> problem I'm seeing is that when jupyter tries to run the elm-make-generated
>> javascript, it thinks that 'Elm' is undefined during (I think) some part of
>> the AMD machinery. Jupyter show this as the output for the cell:
>>
>> Javascript error adding output!
>> ReferenceError: Elm is not defined
>> See your browser Javascript console for more details.
>>
>> As far as I can see, Elm *should* be defined, and certainly the generated
>> code looks like any other Elm output I've looked at. So I'm a bit stumped.
>>
>> My approach to the kernel is currently very simple. The kernel is
>> implemented in Python, and it receives a blob of Elm source code. I dump
>> this to a temp file, use a subprocess to run "elm-make" to make the output,
>> read the output, and ship it back to jupyter. As far as I can see, all of
>> that is working properly. I run into problems when jupyter tries to execute
>> the stuff I return. This design may or may not be optimal in the long run,
>> but I want to get the plumbing working first.
>>
>> So if someone feels up to the challenge, I'd love any help I could get.
>> This seems like it should be pretty straightforward, but perhaps I'm being
>> naive and/or missing something obvious.
>>
>> Of course, I'm also happy to discuss other aspects of the kernel (e.g.
>> design, compilation technique, etc.), but my priority is to just get
>> something into an output cell.
>
> --
> 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 https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Help with Jupyter/IPython notebook kernel for Elm

2017-03-28 Thread Berry Groenendijk
Hi Austin,

I like Jupyter/iPython a lot as a concept. I did not use it a lot though. 
And Elm seems to be like a natural fit.

My dream would be to have live aka. living documents where static text and 
live code are intermingled. Jupyter is a step in the right direction. But, 
you still need a server.

Just recently I found a thing called Klipse, see: 
http://blog.klipse.tech/javascript/2016/06/20/blog-javascript.html. It 
looks a lot like Jupyter (minus the document editing, but that should be 
trivial), but all the code is executed in the browser! It currently has 
support for clojure, ruby, javascript, python, scheme, es2017, jsx, 
brainfuck, c++ and Lua. Quite impressive. And if javascript works, them Elm 
should also work. Perhaps it is already possible... import elm.js... 
hmmm... I don't know.

Sorry, if this post isn't directly related to Jupyter and your challenge to 
integrate Elm in Jupyter.

Op maandag 27 maart 2017 20:10:33 UTC+2 schreef Austin Bingham:
>
> Hi everyone,
>
> I started hacking a bit today on a Jupyter notebook kernel for elm. You 
> can see it here:
>
> https://github.com/abingham/jupyter-elm-kernel 
> 
>
> It doesn't quite work yet, though, and I think I need help from someone 
> who knows javascript/requirejs/web stuff a bit better than me. The proximal 
> problem I'm seeing is that when jupyter tries to run the elm-make-generated 
> javascript, it thinks that 'Elm' is undefined during (I think) some part of 
> the AMD machinery. Jupyter show this as the output for the cell:
>
> Javascript error adding output!
> ReferenceError: Elm is not defined
> See your browser Javascript console for more details.
>
> As far as I can see, Elm *should* be defined, and certainly the generated 
> code looks like any other Elm output I've looked at. So I'm a bit stumped.
>
> My approach to the kernel is currently very simple. The kernel is 
> implemented in Python, and it receives a blob of Elm source code. I dump 
> this to a temp file, use a subprocess to run "elm-make" to make the output, 
> read the output, and ship it back to jupyter. As far as I can see, all of 
> that is working properly. I run into problems when jupyter tries to execute 
> the stuff I return. This design may or may not be optimal in the long run, 
> but I want to get the plumbing working first.
>
> So if someone feels up to the challenge, I'd love any help I could get. 
> This seems like it should be pretty straightforward, but perhaps I'm being 
> naive and/or missing something obvious.
>
> Of course, I'm also happy to discuss other aspects of the kernel (e.g. 
> design, compilation technique, etc.), but my priority is to just get 
> something into an output cell.
>

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, March 28, 2017 at 2:04:22 PM UTC+1, Charles-Edouard Cady wrote:
>
> I tried your application on Iceweasel. The checkboxes never get checked, 
> but opening the Javascript console I can see the messages are getting 
> through:
>
> "Main: SelectChanged (Dict.fromList [("1","one"),("2","two")])" 
> wood.js:907:2
> "_itemsChanged : newValue = 1,one,2,two,3,three, oldValue = 
> 1,one,2,two,3,three"
>
> It looks like Mdl messages are not coming through. The checkboxes are 
> rendered correctly (mdl-style), just not checked.
>

 It needs the shadow DOM, which is what this config is for:


window.Polymer = {
dom: 'shadow',
lazyRegister: true
};


Perhaps it falls back to shady DOM on iceweasel? I just tried it on Firefox 
45.3 on Linux, and it also did not work. Works ok on Chrome.

Here is the doc page where I read about these settings:

https://www.polymer-project.org/1.0/docs/devguide/settings

Yes, you will have to be very careful with what browsers you need to 
support and will likely have many headaches to solve in that regard.

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread Charles-Edouard Cady
There's a polyfill for non-chrome browsers:

https://github.com/WebComponents/webcomponentsjs

Haven't tested it with your code though.



On Tuesday, March 28, 2017 at 5:45:49 PM UTC+2, Rupert Smith wrote:
>
> On Tuesday, March 28, 2017 at 2:04:22 PM UTC+1, Charles-Edouard Cady wrote:
>>
>> I tried your application on Iceweasel. The checkboxes never get checked, 
>> but opening the Javascript console I can see the messages are getting 
>> through:
>>
>> "Main: SelectChanged (Dict.fromList [("1","one"),("2","two")])" 
>> wood.js:907:2
>> "_itemsChanged : newValue = 1,one,2,two,3,three, oldValue = 
>> 1,one,2,two,3,three"
>>
>> It looks like Mdl messages are not coming through. The checkboxes are 
>> rendered correctly (mdl-style), just not checked.
>>
>
>  It needs the shadow DOM, which is what this config is for:
>
> 
> window.Polymer = {
> dom: 'shadow',
> lazyRegister: true
> };
> 
>
> Perhaps it falls back to shady DOM on iceweasel? I just tried it on 
> Firefox 45.3 on Linux, and it also did not work. Works ok on Chrome.
>
> Here is the doc page where I read about these settings:
>
> https://www.polymer-project.org/1.0/docs/devguide/settings
>
> Yes, you will have to be very careful with what browsers you need to 
> support and will likely have many headaches to solve in that regard.
>

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, March 28, 2017 at 2:04:22 PM UTC+1, Charles-Edouard Cady wrote:
>
> I tried your application on Iceweasel. The checkboxes never get checked, 
> but opening the Javascript console I can see the messages are getting 
> through:
>
> "Main: SelectChanged (Dict.fromList [("1","one"),("2","two")])" 
> wood.js:907:2
> "_itemsChanged : newValue = 1,one,2,two,3,three, oldValue = 
> 1,one,2,two,3,three"
>
> It looks like Mdl messages are not coming through. The checkboxes are 
> rendered correctly (mdl-style), just not checked.
>

Pull the latest and give it another try. I changed the webcomopnent import:

-
+
 
I think one iceweasel it may be falling back to shady DOM and the lite 
version doesn't come with that.

The full version comes with it but its a bigger download, which is also 
something you should be aware of; Polymer is a fairly big framework.

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread Charles-Edouard Cady
Wonderful! It works! Nice & green!

On Tuesday, March 28, 2017 at 5:50:13 PM UTC+2, Rupert Smith wrote:
>
> On Tuesday, March 28, 2017 at 2:04:22 PM UTC+1, Charles-Edouard Cady wrote:
>>
>> I tried your application on Iceweasel. The checkboxes never get checked, 
>> but opening the Javascript console I can see the messages are getting 
>> through:
>>
>> "Main: SelectChanged (Dict.fromList [("1","one"),("2","two")])" 
>> wood.js:907:2
>> "_itemsChanged : newValue = 1,one,2,two,3,three, oldValue = 
>> 1,one,2,two,3,three"
>>
>> It looks like Mdl messages are not coming through. The checkboxes are 
>> rendered correctly (mdl-style), just not checked.
>>
>
> Pull the latest and give it another try. I changed the webcomopnent import:
>
> -
> +
>  
> I think one iceweasel it may be falling back to shady DOM and the lite 
> version doesn't come with that.
>
> The full version comes with it but its a bigger download, which is also 
> something you should be aware of; Polymer is a fairly big framework.
>

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread Charles-Edouard Cady
The Gruntfile is pretty scary! That's really the thing with webcomponents I 
think: the boilerplate is quite huge...


On Tuesday, March 28, 2017 at 5:50:13 PM UTC+2, Rupert Smith wrote:
>
> On Tuesday, March 28, 2017 at 2:04:22 PM UTC+1, Charles-Edouard Cady wrote:
>>
>> I tried your application on Iceweasel. The checkboxes never get checked, 
>> but opening the Javascript console I can see the messages are getting 
>> through:
>>
>> "Main: SelectChanged (Dict.fromList [("1","one"),("2","two")])" 
>> wood.js:907:2
>> "_itemsChanged : newValue = 1,one,2,two,3,three, oldValue = 
>> 1,one,2,two,3,three"
>>
>> It looks like Mdl messages are not coming through. The checkboxes are 
>> rendered correctly (mdl-style), just not checked.
>>
>
> Pull the latest and give it another try. I changed the webcomopnent import:
>
> -
> +
>  
> I think one iceweasel it may be falling back to shady DOM and the lite 
> version doesn't come with that.
>
> The full version comes with it but its a bigger download, which is also 
> something you should be aware of; Polymer is a fairly big framework.
>

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Help with Jupyter/IPython notebook kernel for Elm

2017-03-28 Thread Austin Bingham
Klipse looks interesting, but I'm hoping to use Jupyter to make a 
presentation so I'm going to stick with that for now.

Regarding Jupyter needing a server: there are places that host notebooks, 
so the server requirement is only partly true. Your point is a good one, 
though. Sometime the complexity of jupyter can seem a bit unwieldy.

On Tuesday, March 28, 2017 at 4:53:48 PM UTC+2, Berry Groenendijk wrote:
>
> Hi Austin,
>
> I like Jupyter/iPython a lot as a concept. I did not use it a lot though. 
> And Elm seems to be like a natural fit.
>
> My dream would be to have live aka. living documents where static text and 
> live code are intermingled. Jupyter is a step in the right direction. But, 
> you still need a server.
>
> Just recently I found a thing called Klipse, see: 
> http://blog.klipse.tech/javascript/2016/06/20/blog-javascript.html. It 
> looks a lot like Jupyter (minus the document editing, but that should be 
> trivial), but all the code is executed in the browser! It currently has 
> support for clojure, ruby, javascript, python, scheme, es2017, jsx, 
> brainfuck, c++ and Lua. Quite impressive. And if javascript works, them Elm 
> should also work. Perhaps it is already possible... import elm.js... 
> hmmm... I don't know.
>
> Sorry, if this post isn't directly related to Jupyter and your challenge 
> to integrate Elm in Jupyter.
>
> Op maandag 27 maart 2017 20:10:33 UTC+2 schreef Austin Bingham:
>>
>> Hi everyone,
>>
>> I started hacking a bit today on a Jupyter notebook kernel for elm. You 
>> can see it here:
>>
>> https://github.com/abingham/jupyter-elm-kernel 
>> 
>>
>> It doesn't quite work yet, though, and I think I need help from someone 
>> who knows javascript/requirejs/web stuff a bit better than me. The proximal 
>> problem I'm seeing is that when jupyter tries to run the elm-make-generated 
>> javascript, it thinks that 'Elm' is undefined during (I think) some part of 
>> the AMD machinery. Jupyter show this as the output for the cell:
>>
>> Javascript error adding output!
>> ReferenceError: Elm is not defined
>> See your browser Javascript console for more details.
>>
>> As far as I can see, Elm *should* be defined, and certainly the generated 
>> code looks like any other Elm output I've looked at. So I'm a bit stumped.
>>
>> My approach to the kernel is currently very simple. The kernel is 
>> implemented in Python, and it receives a blob of Elm source code. I dump 
>> this to a temp file, use a subprocess to run "elm-make" to make the output, 
>> read the output, and ship it back to jupyter. As far as I can see, all of 
>> that is working properly. I run into problems when jupyter tries to execute 
>> the stuff I return. This design may or may not be optimal in the long run, 
>> but I want to get the plumbing working first.
>>
>> So if someone feels up to the challenge, I'd love any help I could get. 
>> This seems like it should be pretty straightforward, but perhaps I'm being 
>> naive and/or missing something obvious.
>>
>> Of course, I'm also happy to discuss other aspects of the kernel (e.g. 
>> design, compilation technique, etc.), but my priority is to just get 
>> something into an output cell.
>>
>

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Re: Elm webcomponents for microservice front-end

2017-03-28 Thread 'Rupert Smith' via Elm Discuss
On Tuesday, March 28, 2017 at 4:56:53 PM UTC+1, Charles-Edouard Cady wrote:
>
> The Gruntfile is pretty scary! That's really the thing with webcomponents 
> I think: the boilerplate is quite huge...
>

A lot of it is not really needed for this demo, it just got cut and pasted 
across from some other project. 

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Cmd.map

2017-03-28 Thread Brian Marick
I’m having trouble thinking of a scenario in which you’d use `Cmd.map`. 

Is it for a case where you create a `Cmd a` where `a` is something different 
than the usual `Msg`, then transform it into a `Msg`? (When would you do such a 
thing?)

Or for a case where you want to change the `Msg` constructor that `Cmd` 
“wraps”? (Ditto.)

-- 
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 https://groups.google.com/d/optout.


Re: [elm-discuss] Debugger becomes useless with time and mouse movement events

2017-03-28 Thread Sandi
>
> All my messages are wrapped and appear the same at the top-level; the
> filter is not sophisticated enough to deal with that.


Yeah, I've discovered the same problem. My main module only has one
subcomponent and all the relevant messages are wrapped in it's Msg. I would
think that's a very common use case.

On 28 March 2017 at 08:40, John Kelly  wrote:

> Here's some more context:
>
> https://groups.google.com/forum/m/?source=mog&gl=us#!
> topic/elm-dev/cn5EPjyF1uU
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Elm Discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/elm-discuss/z2HthlKENew/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/d/optout.


Re: [elm-discuss] Cmd.map

2017-03-28 Thread Peter Damoc
If you have a series of pages that each has Cmds and you have these pages
unified under one app, you need to lift each page Cmd to become an app Cmd.

There used to be a nesting architecture where this was demonstrated but now
that's been dropped in favor of the Config approach.



On Wed, Mar 29, 2017 at 1:09 AM, Brian Marick  wrote:

> I’m having trouble thinking of a scenario in which you’d use `Cmd.map`.
>
> Is it for a case where you create a `Cmd a` where `a` is something
> different than the usual `Msg`, then transform it into a `Msg`? (When would
> you do such a thing?)
>
> Or for a case where you want to change the `Msg` constructor that `Cmd`
> “wraps”? (Ditto.)
>
> --
> 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 https://groups.google.com/d/optout.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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 https://groups.google.com/d/optout.


[elm-discuss] Bug report (Undefined is not a function!)

2017-03-28 Thread Mark Hamburg
I've now seen something like this a few times. The last time I tried to
build an SSCCE, the bug went away when I looked more closely so I expect to
get nasty messages from the bug submission system if I try to report it as
is, but I figured I would see whether anyone else has seen anything like
this in an effort to narrow in.

This Elm code

operationHandlers : List (Operation.Op Msg -> Maybe Updater)
operationHandlers =
[ handleAccountOperation
]

handleAccountOperation : Operation.Op Msg -> Maybe Updater
handleAccountOperation op =
case Debug.log "handleAccountOperation" op of
Operation.Account accountID accountOp ->
applyAccountOperation accountOp
|> Maybe.map (updateAccount accountID)
_ ->
Nothing


produces this JavaScript

var _adobe$adlproj$App_SessionData$operationHandlers = {
ctor: '::',
_0: *_adobe$adlproj$App_SessionData$handleAccountOperation*,
_1: {ctor: '[]'}
};
var _adobe$adlproj$App_SessionData$handleAccountOperation = function (op) {
var _p5 = A2(_elm_lang$core$Debug$log, 'handleAccountOperation', op);
if (_p5.ctor === 'Account') {
return A2(
_elm_lang$core$Maybe$map,
_adobe$adlproj$App_SessionData$updateAccount(_p5._0),
_adobe$adlproj$App_SessionData$applyAccountOperation(_p5._1));
} else {
return _elm_lang$core$Maybe$Nothing;
}
};


Note the problem in bold: At the point where we construct the list, we have
not initialized the variable being stored in the list. When we then try to
call the function at the head of the list, we get informed that it isn't a
function. Boom.

Reversing order does not fix this (and should not be required to fix this).

Mark

-- 
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 https://groups.google.com/d/optout.