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

2016-05-19 Thread David Legard
What would be the minimal list of Json dependencies required for a project to work? Writing: "dependencies": { "elm-lang/core": "4.0.0 <= v < 5.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/window": "1.0.0 <= v < 2.0.0", "debois/elm-dom": "1.2.0 <= v < 2.0

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

2016-05-19 Thread Max Goldstein
> > No more explanations needed I guess. > As an end-user, no. But there's a rational explanation for the behavior you're seeing. Dicts (and sets) are implemented as red-black trees (like binary trees but self-balancing). This is why keys must be comparable. Equality is Elm checks reference e

[elm-discuss] Re: How to get relative mouse coordinates

2016-05-19 Thread Micah Geisel
https://gist.github.com/botandrose/ee0957cdcd9ff4e2e86ad7a9578ca72e in case you're interested On Thursday, May 19, 2016 at 5:17:31 PM UTC-7, Micah Geisel wrote: > > I ran into this exact yesterday problem, and solved it by calculating the > relative offset in JavaScript, and then passing it into

[elm-discuss] Re: How to get relative mouse coordinates

2016-05-19 Thread Micah Geisel
I ran into this exact yesterday problem, and solved it by calculating the relative offset in JavaScript, and then passing it into Elm on init via `Html.App.programWithFlags`. However, this is not a pure Elm solution, and it doesn't take into account window resize or scroll events. I would love

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

2016-05-19 Thread Mark Hamburg
Some members of my team just raised the concern that not providing for item identity could cause focused text fields to lose focus and a bunch of edit state. I said I would pass it on. > On May 18, 2016, at 9:24 AM, debois wrote: > > I was using virtualdom key for two things, both of which I c

[elm-discuss] How to get relative mouse coordinates

2016-05-19 Thread Fernando Alegre
I am trying to write a plotting program that will have some user interaction. In particular, when the mouse enters a particular rectangle (let's call it the "plotting area") I need to show the (x,y) coordinates relative to the top left corner of that rectangle. Using "import Mouse" I get absol

[elm-discuss] Re: Architecture related question

2016-05-19 Thread Nicolas Lawler
Not sure if this pattern still applies in 0.17 (since the examples that used it have been taken out of the Elm Architecture tutorial), but the way I would've solved this would be to take the config object out of the root model and instead pass it to "EditUser.update" as an extra "Context" argum

[elm-discuss] Architecture related question

2016-05-19 Thread TheGryzor123
So I'm implementing my first Elm web app and it's getting bigger every day. In my root model (in Main.elm) I put the `config` record containing the HTTP information to talk to the backend. I created an `EditUser` module with it's own model which doesn't include the config. Now I would like to

Re: [elm-discuss] How to disable auto-repeat for keypresses

2016-05-19 Thread Sönke Hahn
Hi Peter, thanks a lot, that gist should get me going. Thanks for taking the time to answer! Cheers, Sönke -- 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-

Re: [elm-discuss] Re: How to migrate 0.16 code using Effects.task to equivalent 0.17 code

2016-05-19 Thread Janis Voigtländer
Cool. I've made a pull request streamlining the recommendation a bit, and covering an additional case. 2016-05-19 18:10 GMT+02:00 Frederick Yankowski : > I added that info to the FAQ. > > http://elm-community.github.io/elm-faq/17-tasks.html >> >> ​ >> > -- > You received this message because you

[elm-discuss] Re: How to migrate 0.16 code using Effects.task to equivalent 0.17 code

2016-05-19 Thread Frederick Yankowski
I added that info to the FAQ. http://elm-community.github.io/elm-faq/17-tasks.html > > ​ > -- 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..

Re: [elm-discuss] Running Tasks at Init

2016-05-19 Thread Matic Zavadlal
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://groups.google.com/d/optout.

Re: [elm-discuss] Running Tasks at Init

2016-05-19 Thread Matic Zavadlal
Thanks! Dne četrtek, 19. maj 2016 16.35.39 UTC+2 je oseba Janis Voigtländer napisala: > > init = >(Model { width = 0, height = 0 } [] { x=0 , y=0 }, Task.perform never > WindowResize Window.size) > > with never from > http://package.elm-lang.org/packages/elm-community/basics-extra. > ​ > >

Re: [elm-discuss] Running Tasks at Init

2016-05-19 Thread Janis Voigtländer
init = (Model { width = 0, height = 0 } [] { x=0 , y=0 }, Task.perform never WindowResize Window.size) with never from http://package.elm-lang.org/packages/elm-community/basics-extra. ​ 2016-05-19 16:24 GMT+02:00 Matic Zavadlal : > The problem is that init sets width and height of screen to 0

[elm-discuss] Running Tasks at Init

2016-05-19 Thread Matic Zavadlal
The problem is that init sets width and height of screen to 0 and doesn't update them until the screen resizes. How can I get the values of window width and height in init with Tasks? Here's my code: import Color exposing (..) import Collage exposing (..) import Element exposing (..) import R

Re: [elm-discuss] Question on updating to Elm 0.17

2016-05-19 Thread Janis Voigtländer
That's *not* what I wrote. > Am 19.05.2016 um 14:40 schrieb Wyatt Benno : > > I am trying different versions but from what you wrote > > executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a -> > b) -> Cmd b > executeQuery decoder callback action = > fromJson decoder callb

Re: [elm-discuss] elm-test

2016-05-19 Thread John Watson
Ah - I see. Must have missed that. Many thanks, Noah. On Thursday, 19 May 2016 13:03:45 UTC+1, Noah Hall wrote: > > You no longer need a binary. Check out this PR for examples -> > https://github.com/elm-lang/core/pull/579 > and this repo for examples -> > https://github.com/elm-community/elm-t

Re: [elm-discuss] Question on updating to Elm 0.17

2016-05-19 Thread Wyatt Benno
It worked! Thank you! 2016年5月19日木曜日 21時40分14秒 UTC+9 Wyatt Benno: > > I am trying different versions but from what you wrote > > executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a > -> b) -> Cmd b > executeQuery decoder callback action = > fromJson decoder callback > |>

Re: [elm-discuss] Question on updating to Elm 0.17

2016-05-19 Thread Wyatt Benno
I am trying different versions but from what you wrote executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a -> b) -> Cmd b executeQuery decoder callback action = fromJson decoder callback |> Task.toMaybe |> Task.perform Basics.Extra.never gives -- TYPE MISMATCH ---

Re: [elm-discuss] Question on updating to Elm 0.17

2016-05-19 Thread Janis Voigtländer
No, you get that with something different that what I wrote. Read my message again, please. 2016-05-19 14:15 GMT+02:00 Wyatt Benno : > With this I get. > > executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a > -> b) -> Cmd b > executeQuery decoder callback action = > fromJs

Re: [elm-discuss] Question on updating to Elm 0.17

2016-05-19 Thread Wyatt Benno
With this I get. executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a -> b) -> Cmd b executeQuery decoder callback action = fromJson decoder callback |> Task.toMaybe |> Task.map action |> Task.perform Basics.Extra.never The right argument of (|>) is causing a ty

Re: [elm-discuss] elm-test

2016-05-19 Thread Noah Hall
You no longer need a binary. Check out this PR for examples -> https://github.com/elm-lang/core/pull/579 and this repo for examples -> https://github.com/elm-community/elm-test#testing-from-the-command-line Note: - No longer need console, IO, or ports. import "runSuite" from ElmTest elm-make Te

[elm-discuss] Re: How to migrate 0.16 code using Effects.task to equivalent 0.17 code

2016-05-19 Thread Janis Voigtländer
Oh, and of course, if task was something not involving Task.toMaybe or Task.toResult (for, example, task could have been simply Task.succeed ...), then: If in 0.16 you had: task |> Effects.task use the following in 0.17: task |> Task.perform never identity ​ 2016-05-19 12:37 GMT+02:00 Janis V

[elm-discuss] How to migrate 0.16 code using Effects.task to equivalent 0.17 code

2016-05-19 Thread Janis Voigtländer
Questions how to do migrate 0.16 code involving Effects.task to 0.17 have come up repeatedly now, so I thought it makes sense to write down general advice about this. Below is *my* advice. In each of the cases below, I first give a snippet of 0.16 code and what I advise to use as equivalent 0.17 co

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

2016-05-19 Thread Søren Debois
Neat. We use the same idiom (view function takes a function mapping its message type, in your case, “container") in elm-mdl.  -- 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

[elm-discuss] elm-test

2016-05-19 Thread John Watson
Is there yet an elm-test binary for 0.17? -- 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:

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

2016-05-19 Thread Yosuke Torii
I just wrote a new version of example here . This container view can also handle the messages of its children that have different kind of messages defined outside. I think this is more practical than previous one. (I haven't tried it

Re: [elm-discuss] Question on updating to Elm 0.17

2016-05-19 Thread Janis Voigtländer
Import http://package.elm-lang.org/packages/elm-community/basics-extra, replace line |> Task.map action in your 0.17 code by |> Task.perform Basics.Extra.never action, give the function the return type Cmd b, done. ​ 2016-05-19 11:18 GMT+02:00 Wyatt Benno : > I am having the same issue. > > 0.16

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

2016-05-19 Thread debois
They both have been already: http://package.elm-lang.org/packages/debois/elm-mdl/4.0.0/ http://package.elm-lang.org/packages/debois/elm-parts/2.0.0/ On Thursday, May 19, 2016 at 11:27:46 AM UTC+2, Daniel Kwiecinski wrote: > > Any plans to update elm-mdl and elm-parts to 0.17? > > On Thursday, 19

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

2016-05-19 Thread Daniel Kwiecinski
Any plans to update elm-mdl and elm-parts to 0.17? On Thursday, 19 May 2016 07:32:23 UTC+1, debois wrote: > > 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"

Re: [elm-discuss] Question on updating to Elm 0.17

2016-05-19 Thread Wyatt Benno
I am having the same issue. 0.16 code executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a -> b) -> Effects b executeQuery decoder callback action = fromJson decoder callback |> Task.toMaybe |> Task.map action |> Effects.task 0.17 code executeQuery : Json.Decoder a

Re: [elm-discuss] JSON Decode question

2016-05-19 Thread Janis Voigtländer
No, the order in the input is irrelevant. 2016-05-19 10:03 GMT+02:00 Eelco Hoekema : > Thanks! I was making things too complex, apparently. > > Am i correct that the assumption here is that "tag" MUST be the first > string the decoder runs into? So if my backend returns the JSON with > alphabetic

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

2016-05-19 Thread Joaquín Oltra
Oh I just saw this: Dictionary equality with (==) is unreliable and should not be used. http://package.elm-lang.org/packages/elm-lang/core/4.0.0/Dict Set equality with (==) is unreliable and should not be used. http://package.elm-lang.org/packages/elm-lang/core/4.0.0/Set No more explanations nee

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

2016-05-19 Thread Joaquín Oltra
Wait, this is very confusing. How is equality then determined for this data structure? Is there anywhere to read about the semantics of equality for the data structures in Elm? I come from JS and Clojure and I'm very familiar with those but the behavior I'm seeing in Elm doesn't match any of th

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

2016-05-19 Thread Peter Damoc
you can simply fix that by wrapping the output of the map in div. e.g. div [] [ Html.App.map Button (buttonView model) ] On Thu, May 19, 2016 at 11:05 AM, Eelco Hoekema wrote: > I had a similar problem, reverted back to 0.16 because of it. And i also > had a nested nest. > > eelco > > On Thu

Re: [elm-discuss] How to disable auto-repeat for keypresses

2016-05-19 Thread Peter Damoc
The Pong example you linked was written for an older version of Elm I have created a 0.17 version: https://gist.github.com/pdamoc/fd29925b8e20dd92e91c5b75e6c3711e As you can see there, the keyboard ups and downs are translated into actions that update some player info structure with the direction

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

2016-05-19 Thread Eelco Hoekema
I had a similar problem, reverted back to 0.16 because of it. And i also had a nested nest. eelco On Thu, May 19, 2016 at 8:37 AM, debois wrote: > 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

Re: [elm-discuss] JSON Decode question

2016-05-19 Thread Eelco Hoekema
Thanks! I was making things too complex, apparently. Am i correct that the assumption here is that "tag" MUST be the first string the decoder runs into? So if my backend returns the JSON with alphabetically sorted keys { "height": 3, "tag": "rectangle", "width": 2}, the decoder will run into an er

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

2016-05-19 Thread Joaquín Oltra
Awesome, thanks for the comments. It seems like the second change I made makes sense, but if the search form were to do commands then I'd modify the signature to include them as you said. I'm finding Elm very nice to work with, but there is a lot of boilerplate for connecting parent components

[elm-discuss] Re: How to disable auto-repeat for keypresses

2016-05-19 Thread Sönke Hahn
Hi, thanks for the suggestion. I also thought about exactly doing that. But I'm suspecting the matter is slightly more complex then just changing a state on 'keypress' and `keyup' events. For example: - What happens if a user presses a key and then switches to a different window, before releas

Re: [elm-discuss] How to disable auto-repeat for keypresses

2016-05-19 Thread Sönke Hahn
Hi Peter, thanks for your answer! On Monday, May 16, 2016 at 12:25:32 AM UTC+8, Peter Damoc wrote: > > Auto-repeat happens bellow the level controlled by Elm. > > https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Auto-repeat_handling > Yeah, that is what I suspected. > Why do yo