Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Peter Damoc
Can you mock some code that would show how would you like to use this? Imagine that it is already implemented in some library and write against that imaginary library. On Tue, May 17, 2016 at 5:36 PM, Daniel Kwiecinski < daniel.kwiecin...@gmail.com> wrote: > The problem is that the generic con

[elm-discuss] elm-hot-loader: 0.17 Hot-reloading

2016-05-18 Thread Flux Xu
Hi, I just published elm-hot-loader 0.3.0 to supports hot-reloading with Elm 0.17 Swap port and EmptyAction are gone. No modification of your code is needed, it just works. Project repository: https://github.com/fluxxu/elm-hot-loader Example project: https://github.com/fluxxu/elm-hot-loader-sta

Re: [elm-discuss] elm-hot-loader: 0.17 Hot-reloading

2016-05-18 Thread John Orford
Could you give a use case? It's not 100% clear to me what this does. On Wed, 18 May 2016 at 10:05 Flux Xu wrote: > Hi, > > I just published elm-hot-loader 0.3.0 to supports hot-reloading with Elm > 0.17 > Swap port and EmptyAction are gone. No modification of your code is > needed, it just works

[elm-discuss] Re: Pong example in Elm 0.17

2016-05-18 Thread Wil C
The mario example in 0.17 https://gist.github.com/pdamoc/6f7aa2d3774e5af58ebeba369637c228 On Thursday, May 12, 2016 at 12:59:13 AM UTC-7, Sean Seefried wrote: > > Hi all, > > I just started using Elm about 2 weeks ago. I had a lot of fun playing > with the Pong example and even started making my

[elm-discuss] Knowing if Dict has changed

2016-05-18 Thread surfncode
Hello everyone, Is there a way to know quickly if a dict has changed ? I know I could iterate over all key value pairs but is there a way to do it faster. I understand from reading the docs than the equality operator is unreliable when used on Dict but am I correct to assume that if I have to a

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Daniel Kwiecinski
Here is a sketch of how it would look like in reagent (ClojureScript) ; -- SOME CONCRETE COMPONENTS ; a component taking a String as a model (defn hello-component [name] [:p "Hello, " name "!"]) ; a stateless component using another component (defn say-hello [] [hello-component "wor

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Yosuke Torii
Oh, it looks just nesting views (I'm not familiar with ClojureScript though). If so, the solution is much simpler. Like this: ``` container : List (Html msg) -> Html msg container children = div [ style [ ("padding", "20px") ] ] children ``` full version

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Peter Damoc
Oh, that's much easier: import Html exposing (..) import Html.Attributes exposing (class) helloComponent name = p [] [text ("Hello, " ++ name ++ "!")] sayHello = helloComponent "world" listHello names = div [] (List.map helloComponent names) -- GENERIC WRAPPING COMPONENT wrapComponent

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Daniel Kwiecinski
This is fine. Big thanks for your effort. But, how about instead of components being simple functions we have components as {init, update, view, subscription} so they encapsulate their logic. Think in having a component similar to google places autocomplete. From it's parent we still want to pa

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Peter Damoc
You just use regular Elm Architecture and compose the model of the autocomplete into the proper place, same with update and view. To speak in React terms, what you had above are components that have only props. These can be implemented with simple functions in Elm. If a component needs state and

[elm-discuss] Re: elm-hot-loader: 0.17 Hot-reloading

2016-05-18 Thread Magnus Rundberget
This is awesome, tx ! Would it work with websockets too ? (I guess I should just try...) @John Allows you to hot-load (browser automatically updated) changes to elm, html and css, WITHOUT loosing model state. A bit like elm-reactor used to be back in the days (but that only worked for elm code

Re: [elm-discuss] Re: elm-hot-loader: 0.17 Hot-reloading

2016-05-18 Thread John Orford
that's what I was hoping for(!) On Wed, 18 May 2016 at 15:22 Magnus Rundberget wrote: > This is awesome, tx ! > > Would it work with websockets too ? (I guess I should just try...) > > > @John > Allows you to hot-load (browser automatically updated) changes to elm, > html and css, WITHOUT loosin

[elm-discuss] Re: Updating a game using Forms and Elements for input to Elm 0.17

2016-05-18 Thread Tobias Hermann
Btw, it is not just this game, that worries me. In our company we internally use a tool written in Elm. I can not post its source code. But It has buttons, input fields etc., and they all are embedded in a quite deep structure of Elements (flow down, flow right, etc.). Since I have to extend th

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Daniel Kwiecinski
Sounds very promising. Could you please provide minimalist example? On Wednesday, 18 May 2016 13:47:16 UTC+1, Peter Damoc wrote: > > You just use regular Elm Architecture and compose the model of the > autocomplete into the proper place, same with update and view. > > To speak in React terms,

Re: [elm-discuss] [ANN] Elm Style Animation v 1.0.0 - Now with SVG animations

2016-05-18 Thread Peter Damoc
This is awesome! I've updated the Dash docset to honor your release. I can now report that there are some 106 packages that have already made the transition to 0.17 :) On Wed, May 18, 2016 at 12:21 AM, Matthew Griffith wrote: > > Hi All, > > I just released a fairly large update I've been work

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Peter Damoc
This gist (previously posted) https://gist.github.com/pdamoc/aef6306a9001de109aeece37e5627d06 is a kind of minimalist example. It shows how to join together 2 different widgets (RandomGif and Counter). The process for extending the list with new widgets is mechanical, just add options to all the re

Re: [elm-discuss] Howto filter on Sub

2016-05-18 Thread Steve Schafer
By "deep down," I mean that I'm looking to see if there's anywhere that the model is being passed down to some deeper level where that could be bypassed, thus avoiding reconstruction of the model and thereby preserving reference equality. On Tuesday, May 17, 2016 at 12:43:36 PM UTC-4, Janis Vo

Re: [elm-discuss] [ANN] Elm Style Animation v 1.0.0 - Now with SVG animations

2016-05-18 Thread Joaquín Oltra
Awesome library and examples. Thanks! -- 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://gr

Re: [elm-discuss] [ANN] Elm Style Animation v 1.0.0 - Now with SVG animations

2016-05-18 Thread Max Goldstein
Sweet! There's now elm-community/easing-functions that you can use with this library. -- 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...@go

[elm-discuss] Re: Knowing if Dict has changed

2016-05-18 Thread Max Goldstein
Dict equality is unreliable, but in the sense that it say two dicts are unequal when semantically they are. Also, equality on lists is reliable (and Dict.fromList is always in sorted order) so equating the results of Dict.fromList should be okay. So... dictEquals : Dict a b -> Dict a b -> Bool

[elm-discuss] Re: Knowing if Dict has changed

2016-05-18 Thread Max Goldstein
Sorry, posted too soon. dictEquals : Dict a b -> Dict a b -> Bool dictEquals d1 d2 = d1 == d2 || Dict.toList d1 == Dict.toList d2 This will short-circuit when the object references are the same and otherwise do the work necessary to always give the correct answer. (I think - please tell me if

[elm-discuss] Re: Knowing if Dict has changed

2016-05-18 Thread surfncode
Thanks. That would be great. Can other experts confirm it works ? Le mercredi 18 mai 2016 17:11:56 UTC+2, Max Goldstein a écrit : > > Sorry, posted too soon. > > dictEquals : Dict a b -> Dict a b -> Bool > dictEquals d1 d2 = > d1 == d2 || Dict.toList d1 == Dict.toList d2 > > This will short-circ

Re: [elm-discuss] Re: Knowing if Dict has changed

2016-05-18 Thread Janis Voigtländer
In principle it’s correct. The type needs to be a bit different (comparable instead of a). Moreover, it will still not work reliably if you call it with something where the b type is itself a type that does not have reliable ==. For example, if you call that dictEquals on a Dict Int (Set Int), you

[elm-discuss] Re: Looking for people experienced with elm-html's "key" function

2016-05-18 Thread debois
I was using virtualdom key for two things, both of which I cannot do in 0.17. 1. Instructing virtual-dom whether or not to reset scrolling-state of an element. Try it out here: https://debois.github.io/elm-mdl/: Scroll to the bottom, then switch tab. Because virtual-dom is re-using the div cont

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread Daniel Kwiecinski
Hi Peter, Just skimmed on the gist, but can already tell this is great help. Many thanks for your work. Cheers, Dan On Wednesday, 18 May 2016 15:20:38 UTC+1, Peter Damoc wrote: > > This gist (previously posted) > https://gist.github.com/pdamoc/aef6306a9001de109aeece37e5627d06 > is a kind of

[elm-discuss] Re: onClick only firing 50% of the time

2016-05-18 Thread Yosuke Torii
Hi Russell, It's because `onClick` is attached to the icon, not the button. Maybe the area of icon is about 50% of its parent button ;) button [ class "btn btn-default" ] [ i [ class "fa fa-trash-o" , onClick address (Remove id) ] []] 2016年5月18日水曜日 5時00分48秒 UTC+9 Russell Dunp

[elm-discuss] Mouse position doesn't work in Internet Explorer (I have IE 11) in Elm 0.17

2016-05-18 Thread vjorjo
Hi all, I upgraded a project of mine, to version 0.17 and I noticed that my app became unresponsive in IE 11. The culprit is the elm-lang/mouse package which seems not working with IE. Even the example in the official site is not working in IE: http://elm-lang.org/examples/drag Thanks, George

Re: [elm-discuss] Re: Knowing if Dict has changed

2016-05-18 Thread surfncode
I hadn't thought of that, that's true indeed. Here are some other example using dictEquals. Do you think the d1==d2 short-circuit would still work in those cases? dictEquals : Dict comparable b -> Dict comparable b -> Bool dictEquals d1 d2 = d1 == d2 || Dict.toList d1 == Dict.toList d2 -- Ex

[elm-discuss] Re: Would appreciate some code review and comments on extracting a component

2016-05-18 Thread Yosuke Torii
Hi Joaquín, If you expect the component to do HTTP request internally and return the result, I think it is (Model, Cmd msg, Whatever) pettern, which Evan is going to explain here . Using this pattern, I recently implemented

Re: [elm-discuss] Re: Knowing if Dict has changed

2016-05-18 Thread Nick H
How important is this optimization to you? And do you really need it to work for the most general case? Making your code more complicated, in the hopes of exploiting an undocumented behavior of the compiler, is something you ought to avoid unless you are certain that it is necessary. If all you c

Re: [elm-discuss] Re: Knowing if Dict has changed

2016-05-18 Thread surfncode
To be honest I don't even know yet if I will need it. I have to run some performance tests first. I'm just trying to see what are my options in case using only records + list proves too slow. I have recently watched some videos about clojure/clojurescript where the advocate their support of p

Re: [elm-discuss] Re: How do I render a child component in 0.17 (like CounterList)?

2016-05-18 Thread Homan Chou
Ah... thanks. I read that wrong and thought you were linking the old repo. What does "Dispatch(Remove)" mean in the Counter exposing part? On Tue, May 17, 2016 at 10:54 PM, Peter Damoc wrote: > It works like you can see in the second link you've quoted. :) > > > > > On Wed, May 18, 2016 at 8:4

Re: [elm-discuss] Re: How do I render a child component in 0.17 (like CounterList)?

2016-05-18 Thread Peter Damoc
It means that it exports both the type Dispatch and the tag Remove. It's explicit with what it exports. It should have been "Dispatch(..)" because in cases like this you might want to expose all the Dispatch Tags. On Wed, May 18, 2016 at 10:55 PM, Homan Chou wrote: > Ah... thanks. I read that

[elm-discuss] Re: onClick only firing 50% of the time

2016-05-18 Thread Russell Dunphy
Ah, now I feel daft! Thank you, Yosuke. Still learning to mentally parse all the nested lists :-D On Wednesday, May 18, 2016 at 6:46:58 PM UTC+1, Yosuke Torii wrote: > > Hi Russell, > > It's because `onClick` is attached to the icon, not the button. Maybe the > area of icon is about 50% of its p

Re: [elm-discuss] Re: How do I render a child component in 0.17 (like CounterList)?

2016-05-18 Thread Homan Chou
Interesting... it's like it's own module. I feel like there are a lot of little things like this that aren't covered in any of the getting started guides. On Wed, May 18, 2016 at 1:05 PM, Peter Damoc wrote: > It means that it exports both the type Dispatch and the tag Remove. It's > explicit wi

Re: [elm-discuss] Re: How do I render a child component in 0.17 (like CounterList)?

2016-05-18 Thread Mark Hamburg
I'm hoping that's not how it is expected to work because it means that a view layout decision — we need to put the remove button in with the counter display and buttons — now spreads to the messages and update function. I much prefer the solution that someone else posted where viewWithRemove tak

Re: [elm-discuss] Re: How do I render a child component in 0.17 (like CounterList)?

2016-05-18 Thread Mark Hamburg
Or more succinctly, the issue to be dealt with in the counter with remove button case is that the view needs to be able to "send" more messages not that the counter update function needs to handle more messages. Mark > On May 18, 2016, at 1:40 PM, Mark Hamburg wrote: > > I'm hoping that's not

[elm-discuss] JSON Decode question

2016-05-18 Thread Eelco Hoekema
Hi, I'm a bit stuck in decoding some json. In http://package.elm-lang.org/packages/elm-lang/core/4.0.0/Json-Decode#andThen there is an example of decoding a tagged union for a shape. type Shape = Rectangle Float Float | Circle Float shape : Decoder Shapeshape = ("tag" := string) `and

Re: [elm-discuss] JSON Decode question

2016-05-18 Thread Mario Sangiorgio
No, the json explicitly has a tag attribute to let your code know what is the shape type it encodes followed by the attributes for that shape. Something like: { "tag": "rectangle", "width": "2", "height": "3"} { "tag": "circle", "radius": "2"} Note that there is no nesting. Mario On Wed, May 18

Re: [elm-discuss] JSON Decode question

2016-05-18 Thread Mario Sangiorgio
Actually you need width, height and radius to be numbers not strings. Otherwise you'll get parsing errors. { "tag": "rectangle", "width": 2, "height": 3} { "tag": "circle", "radius": 2} On Wed, May 18, 2016 at 10:36 PM Mario Sangiorgio wrote: > No, the json explicitly has a tag attribute to let

Re: [elm-discuss] What is the Type Signature of the 'Program' type

2016-05-18 Thread Tylor Steinberger
Thanks everyone for their input, I'm not purposefully ignoring anyone, just haven't had enough time to revisit any of my experiments here. I'd love to at some point collaborate with someone who might be more familiar with Elm -- You received this message because you are subscribed to the Google

Re: [elm-discuss] How to map multi-level nesting components in 0.17

2016-05-18 Thread Luis Fei
Thanks,Nick,sorry for the later reply I tried to apply the changes to Tab.view, still have the problem, this time the compiler complained inferring definition has this type: `(Msg -> a) -> Model -> List (Html Msg) -> Html Msg`, and I'm confused how to use this new added TabMsg parameter inside

Re: [elm-discuss] Re: How to implement wrapping components in elm

2016-05-18 Thread debois
As I understand it, you want to write a function which takes a list of TEA components, then wires up and renders those. As Peter pointed out, this can be done when your "components" are really just view functions. If they are actual TEA components, each with (view, update, Model, Message, Subsc

Re: [elm-discuss] Applying Html.App.map twice leads to "TypeError: domNode.replaceData is not a function"

2016-05-18 Thread debois
https://github.com/elm-lang/html/issues/16 On Sunday, May 15, 2016 at 3:40:19 PM UTC+2, Janis Voigtländer wrote: > > That’s great. But *please* report the bug as an issue on GitHub > nevertheless! > ​ > > 2016-05-15 15:23 GMT+02:00 Martin Troxler > >: > >> By using your workaround I could fix my

[elm-discuss] Re: Help resolving : domNode.replaceData is not a function

2016-05-18 Thread debois
Hi Richard, I experienced similar thing, and in my case, it seems to have to do with nested use of `Html.App.map`: https://github.com/elm-lang/html/issues/16. Cheers, Søren On Saturday, May 14, 2016 at 9:24:06 PM UTC+2, Richard Osafo wrote: > > Hi Martin, > After much trial and error, I got i