[elm-discuss] Re: Period(.) in repository field of elm-package.json generates erroneous code

2016-12-21 Thread Lucas Desgouilles
You're not required to set the repository field. It's used when you try to publish a package though. On Sunday, 18 December 2016 19:34:37 UTC+1, fxmy wang wrote: > > Hello guys, so when I was following some tutorial and decide to build some > github pages with elm. > > So I updated elm-package.j

Re: [elm-discuss] What up with elm-mdl?

2016-12-21 Thread Peter Damoc
On Wed, Dec 21, 2016 at 8:02 PM, Rex van der Spuy wrote: > > Can anyone explain what's going on? > I haven't been following elm-mdl lately but maybe I can provide some historical context. Reuse of UI is a topic that hasn't been solved in Elm. This is why we don't have any official or recommended

[elm-discuss] Visualizing project dependencies

2016-12-21 Thread Justin Mimbs
I enjoy looking at dependency graphs, so I wrote a small library that makes diagrams of acyclic digraphs. To put it to use, I made something for exploring package and module dependencies of Elm projects. To see it, you can play with this example

[elm-discuss] DOM geometry / SVG library

2016-12-21 Thread Fabrice Marchal
Hi, I'm evaluating elm to rewrite an SVG diagram-drawing component inside an SPA. 1. Is someone working on an higher-level SVG library than elm-lang/svg ? Im thinking about support for path intersection, bounding box operations, etc. 2. Is there some progress on a solution to read DOM geometry

Re: [elm-discuss] Re: Patterns for sum and product types

2016-12-21 Thread Wouter In t Velt
Wow, this is awesome Mark! Thanks! This would really further improve and simplify the solution. It seems I am just scratching the surface/ beginning to understand. In another further exploration (based on Richard's talk), I found that putting the Destination in an opaque type also forced me to d

Re: [elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Rafał Cieślak
2016-12-21 21:36 GMT+01:00 Wouter In t Velt : > Seems input [ type_ "number" ] behaves weird in different ways. Oh yes, definitely, I forgot to explicitly say that. :) What I wanted to point out in my example is that defaultValue can't be considered a viable solution not only because of the leaka

[elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Bernardo
On Wednesday, 21 December 2016 18:04:44 UTC-3, Alexandre Galays wrote: > > - About the input being reused in another view; that's entirely normal. > Any VDOM implementation can't know whether the input should be a physically > different one unless it has a different class, id or key. > The probl

[elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Wouter In t Velt
Op woensdag 21 december 2016 22:04:44 UTC+1 schreef Alexandre Galays: > > - About the input being reused in another view; that's entirely normal. > Any VDOM implementation can't know whether the input should be a physically > different one unless it has a different class, id or key. > > - About t

[elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Alexandre Galays
- About the input being reused in another view; that's entirely normal. Any VDOM implementation can't know whether the input should be a physically different one unless it has a different class, id or key. - About the cursor going crazy; this is a bug in Elm. I've seen that kind of bugs in at l

[elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Wouter In t Velt
Op woensdag 21 december 2016 21:02:04 UTC+1 schreef Rafał Cieślak: > > Here's an example: https://runelm.io/c/q6z > Interesting! The fast-typing-makes-cursor-jump-to-end does not appear to happen in the number type with value set. Still, I find different weird behavior in type number in both exa

Re: [elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Karol Samborski
śr., 21 gru 2016 o 19:09 użytkownik Wouter In t Velt < wouter.intv...@gmail.com> napisał: > Do you still set the input value + onInput handler in the lazy variant? > And does that also somehow prevent the "leak" of input value to a next > render? > > > Recently I ported 0.16 app where I used "lazy

Re: [elm-discuss] What up with elm-mdl?

2016-12-21 Thread Eduardo Cuducos
I'm in the same boat, just following this Issue at their repo https://github.com/debois/elm-mdl/issues/253 ; ) On Wed, 21 Dec 2016 at 17:02 Rex van der Spuy wrote: > Hi Everyone, > > I'm just starting to bump my Elm projects to 0.18 and found out that my > beloved elm-mdl is still at 0.17. > But

[elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Rafał Cieślak
What I found is that defaultValue can't really be used with number inputs that are controlled (in the sense that defaultValue is changes with the model as in the first example in the thread). If you have such input, then start typing a valid number and then you add some commas/dots (depending o

[elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Bernardo
I'm not currently doing this as I was not aware of this problem. But what I was thinking is very simple. What I'm doing now is always redirecting to a new url (hash change) after the http request is successful. Then I would change the redirect function like: redirect location = Cmd.batch [formR

Re: [elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Nicolas Artman
Is there a good reason (other than a defect) that the cursor jumps at all? It seems to me that the correct behavior is for the cursor to stay right after the text that was just typed. On Wed, Dec 21, 2016 at 10:09 AM Wouter In t Velt wrote: > Thanks all for sharing your approach to this! > > Op

[elm-discuss] What up with elm-mdl?

2016-12-21 Thread Rex van der Spuy
Hi Everyone, I'm just starting to bump my Elm projects to 0.18 and found out that my beloved elm-mdl is still at 0.17. But there's there's a MichealCombs28 fork of elm-mdl for 0.18. Should I use that instead? I'm confused! :) I gingerly pryed open the #elm-mdl Slack channel to try and figure out

[elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Wouter In t Velt
Thanks all for sharing your approach to this! Op woensdag 21 december 2016 17:33:28 UTC+1 schreef Bernardo: > > For me the solution would be to perform a form.reset() before rendering > the new view. > Interesting: Could you elaborate on how you do that? Re-render the form with a one-time reset

[elm-discuss] Re: fold function argument order

2016-12-21 Thread Kasey Speakman
Here is a minimal function for a fold which operates the standard way. fold : (b -> a -> b) -> b -> List a -> b fold f = List.foldl (flip f) Example use: fold (++) "" ["a", "b", "c"] -- result: (("" ++ "a") ++ "b") ++ "c" -- == "" ++ "a" ++ "b" ++ "c" -- == "abc" Additionally, he

Re: [elm-discuss] Re: Patterns for sum and product types

2016-12-21 Thread Mark Hamburg
Looking at my update code again, I see how I could further reduce the number of cases by combining two of the SetCountry cases as a default with careful sorting of the cases. That gain in brevity doesn't seem worth the increase in sensitivity to how exactly the code is written. It might be wort

[elm-discuss] Re: How to prevent input field values persisting in new views?

2016-12-21 Thread Bernardo
When dealing with forms in SPAs I perform certain actions on form submission to mimic the expected behavior, like scrolling to the top of the page. For me the solution would be to perform a form.reset() before rendering the new view. On Tuesday, 20 December 2016 18:03:28 UTC-3, Wouter In t Velt

Re: [elm-discuss] Re: Patterns for sum and product types

2016-12-21 Thread Mark Hamburg
Per your Medium post and the search for Elm "patterns", let me suggest casing on tuples. This is useful in update functions for state machines but it is also useful in this case. I also broke things apart into slightly smaller functions to keep them simpler. type Destination = NotChosen |

[elm-discuss] Re: How to structure Elm with multiple models?

2016-12-21 Thread Daniel Mueller
Hi There are several possibilites. First and simplest: Get all your data in the one and only main model, work with one list of messages. Second: Structure your data over modules, e.g. one model and all internal messages per page/view Those are good examples to start with bigger projects: https

Re: [elm-discuss] Decoder headache.

2016-12-21 Thread Brian Hicks
In the simpler cases you can use `oneOf` with the subtypes first, but I get your point. Plus, `andThen` will be much faster. ;) On 21 Dec 2016, at 8:53, 'Rupert Smith' via Elm Discuss wrote: On Wednesday, December 21, 2016 at 2:44:13 PM UTC, Brian Hicks wrote: A previous version of the `andT

Re: [elm-discuss] Decoder headache.

2016-12-21 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, December 21, 2016 at 2:44:13 PM UTC, Brian Hicks wrote: > > A previous version of the `andThen` documentation actually used circles > and rectangles as the motivating example. It's since switched to versioned > objects, which are maybe a little more realistic. Did you choose circles

Re: [elm-discuss] Decoder headache.

2016-12-21 Thread Brian Hicks
A previous version of the `andThen` documentation actually used circles and rectangles as the motivating example. It's since switched to versioned objects, which are maybe a little more realistic. Did you choose circles and rectangles as your example here for that reason, or are you really work

Re: [elm-discuss] Decoder headache.

2016-12-21 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, December 21, 2016 at 1:18:52 PM UTC, Peter Damoc wrote: > > shapeDecoder = > field "@type" string > |> andThen toShape > > toShape str = > case str of > "Circle" -> > map CircleAsShape circleDecoder > "Rectangle" -> > map RectangleAsShape rectangleDec

[elm-discuss] Re: Decoder headache.

2016-12-21 Thread Simon
Use andThen http://package.elm-lang.org/packages/elm-lang/core/5.0.0/Json-Decode#andThen On Wednesday, 21 December 2016 13:38:14 UTC+1, Rupert Smith wrote: > > Struggling to figure this out, but it may be because I'm in an open plan > office and its just too noisy to concentrate... > > Suppose

Re: [elm-discuss] Decoder headache.

2016-12-21 Thread Peter Damoc
Isn't this supposed to be implemented like this: import Html exposing (text) import Json.Decode exposing (..) type alias Circle = { radius : Float } type alias Rectangle = { width: Float, height: Float } type Shape = CircleAsShape Circle | RectangleAsShape Rectangle circleDecoder = map

[elm-discuss] Decoder headache.

2016-12-21 Thread 'Rupert Smith' via Elm Discuss
Struggling to figure this out, but it may be because I'm in an open plan office and its just too noisy to concentrate... Suppose I have decoders for two records: type alias Circle = { radius : Float } type alias Rectangle = { width: Float, height: Float } On the server side though, these are a

Re: [elm-discuss] How to prevent input field values persisting in new views?

2016-12-21 Thread Karol Samborski
I always used "lazy" for not updating value in rendered input after every key press. It is equivalent of react's "shouldComponentUpdate". śr., 21 gru 2016 o 12:28 użytkownik Simon napisał: > Yes, I have the same type of issue, but with the data attached to Blur > messages attached arbitrarily t

Re: [elm-discuss] How to prevent input field values persisting in new views?

2016-12-21 Thread Simon
Yes, I have the same type of issue, but with the data attached to Blur messages attached arbitrarily to messages in new views. The way I solved it so far was to use Html.Keyed on the form page. Simon On Tuesday, 20 December 2016 22:33:26 UTC+1, Duane Johnson wrote: > > > On Tue, Dec 20, 2016 at