[elm-discuss] Re: Elm Routing with Navigation in 0.18

2017-02-06 Thread Wouter In t Velt
Op zondag 5 februari 2017 20:51:03 UTC+1 schreef Kingsley Hendrickse: > > I'm struggling a bit to get what I want out of the Route and Navigation > libraries. > Some time ago, I wrote a couple of posts diving into Navigation and Routing in Elm:

Re: [elm-discuss] Mutually dependent types

2017-01-13 Thread Wouter In t Velt
Op vrijdag 13 januari 2017 09:13:25 UTC+1 schreef Marco Perone: > > Coming back to my original question, supposing we have two mutually > recursive types, they must be in the same module and hence in the same > file, right? > Yes, that is what I would think too. I would argue that it would be

[elm-discuss] Re: Type Alias Question

2017-01-06 Thread Wouter In t Velt
My guess is that this has to do with the strange way in which your "Foo" - like in any record type alias - *Foo is at the same time a Type as well as constructor*. So Foo is a type, that you can use in type annotations and signatures, but also a function with the signature "String -> Foo",

[elm-discuss] Re: How do I open a URL?

2017-01-06 Thread Wouter In t Velt
There is this somewhat dirty hack you could use: Supply a one-liner of javascript to an Elm style attribute. Using `attribute` from the `Html.Attributes` library. You could make your own helper that does the redirect: redirectTo : String -> Attribute msg redirectTo destinationUrl =

Re: [elm-discuss] Mutually dependent types

2017-01-04 Thread Wouter In t Velt
Somewhat late, but there is a nice exposition on this by Evan over here: https://github.com/elm-lang/elm-compiler/blob/master/hints/recursive-alias.md -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop

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

[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

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

2016-12-20 Thread Wouter In t Velt
Over on Slack the other day, there was some dialogue about input fields going on. One was about an issue when you set the value in your elm code like this: input [ type_ "text", onInput HandleInput, value model.fieldValue ] [] Issue: when user types really fast, the cursor jumps to the end of

[elm-discuss] Re: Which problems did you solve using the Elm debugger?

2016-12-19 Thread Wouter In t Velt
Op maandag 19 december 2016 15:06:28 UTC+1 schreef Jeff Horemans: > > Can anyone give (concrete) examples wherein the debugger proved to be > useful, even crucial, in resolving the problem or bug? > The debugger for me is very useful to find out if Msg fired and in which order. When interacting

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

2016-12-13 Thread Wouter In t Velt
Great resources Rafal! Thanks for sharing! -- 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

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

2016-12-13 Thread Wouter In t Velt
Op zondag 11 december 2016 20:01:09 UTC+1 schreef Brian Marick: > > Since FP has been around for a long time, too, I’m hoping that those > idioms and patterns have been written down, with a good effort toward > explaining them (with examples!) Where? > As it happens, I just wrote a post on

[elm-discuss] Re: Design concepts. Too many Msg's?

2016-12-13 Thread Wouter In t Velt
Op dinsdag 13 december 2016 15:28:50 UTC+1 schreef Manu Rosa: > > ...I am curious as to what's the (communitie's) best practice to tackle > this. > Hi Manu, One of the bigger examples (and my favorite) out there is the Time Tracker app: https://github.com/knewter/time-tracker They use nested

[elm-discuss] Re: onClick while shift key pressed

2016-12-13 Thread Wouter In t Velt
Here's how I would do it: onShiftClick : msg -> Attribute msg onShiftClick message = let hasShift shiftKey = if shiftKey then JD.succeed message else JD.fail "No shift key" in on "click" <| JD.andThen

[elm-discuss] How to use Dict.empty?

2016-12-11 Thread Wouter In t Velt
The error message from the compiler says that the third thing in your SomeRecordType should be a SomeOtherRecordType. But you are passing it an empty Dict. Which suggests that you have defined "SomeOtherRecordType" as something other than a Dict -- You received this message because you are

[elm-discuss] Re: launchaco built in Elm

2016-12-09 Thread Wouter In t Velt
Op vrijdag 9 december 2016 06:55:07 UTC+1 schreef Marc Laventure: > > Hey! I am the author, great to hear your satisfaction with Launchaco. I am > also super excited to play around with elm on server side rendering! Fun > tidbit, we used golang to generate the html and assets when you click the

Re: [elm-discuss] `Case of` branches grouping

2016-12-09 Thread Wouter In t Velt
Op vrijdag 9 december 2016 16:57:48 UTC+1 schreef Nick H: > > This only works if your type values aren't storing any data. > The equality test can be done if you are *not trying to pattern match* on the data in the type. So -- will work if someValue == Just 42 then doStuffWith 42 is fine,

Re: [elm-discuss] Why not components?

2016-12-06 Thread Wouter In t Velt
Thanks for solving this mystery for us David. It probably is sensible to avoid anyway: if someMaybe == ... then And use case someMaybe of (Or .map) instead. Gives us more protection from the compiler to get all branches covered... -- You received this message because you are

Re: [elm-discuss] Why not components?

2016-12-05 Thread Wouter In t Velt
Op maandag 5 december 2016 22:51:02 UTC+1 schreef Peter Damoc: > > You cannot use comparison on tags. > I can see your version is cleaner. Do you mean a comparison with a maybe is not allowed? Like this? -- is this not allowed? if someMaybe == Just 42 then ... The original change I made did

[elm-discuss] Re: One month with Elm, two questions

2016-12-05 Thread Wouter In t Velt
Op maandag 5 december 2016 21:00:35 UTC+1 schreef Frankie Sardo: > > Why does the update syntax accept just a new value instead of accepting a > function that updates (or creates) the new value? > Don't know about Clojure, but Elm likes you to be explicit and consistent about functions,

Re: [elm-discuss] Why not components?

2016-12-05 Thread Wouter In t Velt
Peter, did you deliberately choose to put everything (including items) in a single config record? Just curious. -- 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

Re: [elm-discuss] Why not components?

2016-12-05 Thread Wouter In t Velt
Op maandag 5 december 2016 16:58:34 UTC+1 schreef Peter Damoc: > > I just pushed the latest changes and the functionality should be > equivalent. > https://github.com/pdamoc/polymer-exploration > Looks great! I would suggest a small change in the country update: to only reset the city selector

Re: [elm-discuss] Why not components?

2016-12-05 Thread Wouter In t Velt
This looks very promising! I really like the fact that the web components solution takes care of the blur stuff, so it makes model cleaner and we can do away with the subscription. I have to do some more digging, but I like the fact that there's a ton of event handlers, that you can simply

Re: [elm-discuss] Why not components?

2016-12-05 Thread Wouter In t Velt
Wow you guys are fast! Hopefully I can dive into it tonight (@work right now). I think it would be really interesting to see a webcomponents version of the same example and compare it with the other two versions. In the meantime, do let me know if there's anything I could improve about my

Re: [elm-discuss] Web Components with Elm - an introduction

2016-12-05 Thread Wouter In t Velt
Good stuff Josh! After Peter's feedback on my earlier posts, I actually used your Daily Drip post yesterday to dip into Polymer + Elm myself. And for a webcomponents-noob like myself, it was easy to follow and really helped me get started quickly. With the basis from your article, I actually

Re: [elm-discuss] Why not components?

2016-12-04 Thread Wouter In t Velt
Op zondag 4 december 2016 15:43:40 UTC+1 schreef Peter Damoc: > > You're trading one set of boilerplate for another. > Fair enough. I could have pointed that out in the conclusions. Both your versions are almost as bad as you are forcing internal details of > the functioning of the dropdown

[elm-discuss] Re: Why not components?

2016-12-04 Thread Wouter In t Velt
Op zondag 4 december 2016 15:02:02 UTC+1 schreef Rex van der Spuy: > > I found both Evan's sortable table example and your (excellent!) dropdown > menu just a few levels too advanced for my poor beginner's brain to fully > grok. > Glad you liked it! Were there any particular sections in the

[elm-discuss] Why not components?

2016-12-04 Thread Wouter In t Velt
Hi All, To explore and explain (in a beginner-friendly way) why making stateful reusable components in Elm is not always a good idea, I have made a demo + write-up in 2 articles over on Medium. Here are the links to the drafts:

[elm-discuss] Re: Inter triplets communication.

2016-11-30 Thread Wouter In t Velt
This is a very educational discussion! Thank you for sharing links and examples. As perhaps a minor point, I believe the elm-sortable-table does NOT belong in the list of "encapsulated state", "components", "triplets". It does have a State type defined. But a notable difference with various

Re: [elm-discuss] Re: Elm post: feedback requested

2016-11-29 Thread Wouter In t Velt
Op dinsdag 29 november 2016 10:25:50 UTC+1 schreef John Orford: > > Just a note - sometimes a little repetition is helpful when learning or > teaching... At least that's what I tell myself when I find I am repeating > myself :) > Fully agree! Hope I made that clear by adding the workflow

[elm-discuss] Re: Elm post: feedback requested

2016-11-29 Thread Wouter In t Velt
Thanks Max. I've taken out the somewhat repetitive paragraphs, to make the article itself also more compact and readable :) As for using Dict, the exercise basically shows how to extract functions by rolling your own List equivalent of Dict.update. Using Dict from the start would be less clear

[elm-discuss] Elm post: feedback requested

2016-11-28 Thread Wouter In t Velt
Over on Medium, I've written an article to share some beginner/ intermediate experiences in Elm. About extracting helper functions. https://medium.com/@wintvelt/making-elm-code-more-compact-and-more-readable-935067f81829 Any feedback (here on over on medium) would be highly appreciated! Thanks.

[elm-discuss] Re: How to use Navigation library

2016-11-27 Thread Wouter In t Velt
Thanks Erik, I think I got it. In case of not found, I prefer the not found message over not found page. With your explanations in this thread, I'll probably be able to do that. If not, I'll be back here :) -- You received this message because you are subscribed to the Google Groups "Elm

[elm-discuss] The Elm Architecture and Html.beginnerProgram

2016-11-26 Thread Wouter In t Velt
The `model` function is called only once, when your app is started. Then your `view` function is called, to render the model to the DOM. After that, every time your `view` function produces and `Msg`, your `update` function is called, and the resulting model is passed on to another call of

[elm-discuss] Re: How to use Navigation library

2016-11-26 Thread Wouter In t Velt
Thank you for the explanation Erik! With the upgrade to 0.18 and the changes in navigation, I was wondering which route (pun intended) to follow with the upgrade. Not sure I follow completely though. In option 1, could you deal with redirect-like scenario's inside the SPA? Like 1. user is

Re: [elm-discuss] What Elm needs to move forward

2016-11-25 Thread Wouter In t Velt
Maybe the Elm Weekly newsletter, the ElmTown podcast, and the remote meetups would be useful additions to the http://elm-lang.org/community page? -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving

Re: [elm-discuss] What Elm needs to move forward

2016-11-24 Thread Wouter In t Velt
My learning curve has been similar to what Oliver describes. IMHO, there still a large gap between The Official Guide and the community platforms, that needs to be filled. The Official Guide is a great doc, but it has very few examples, and mostly entry-level and small. Outside the guide, the

[elm-discuss] Re: Using Navigation - is Events.onWithOptions required?

2016-11-23 Thread Wouter In t Velt
Op woensdag 23 november 2016 23:52:54 UTC+1 schreef Brian Marick: > > So I suspect I’m doing something wrong. Am I? > Not wrong, I guess, but it is kind of a peculiar setup. I also use elm-lang/navigation, and never ran into this issue. After checking my code: - Either I use an `a [ href

[elm-discuss] Re: Dynamic Unsubscribing to subscriptions?

2016-11-23 Thread Wouter In t Velt
Your subscriptions also take model as input, so you could do something like this: subscriptions : Model -> Sub Msg subscriptions model = if model.followMouse then Mouse.moves MyMsg else Sub.none You could look at the drag-and-drop example elm-lang.org examples to see how

[elm-discuss] Re: Passing properties as arguments to messages?

2016-11-22 Thread Wouter In t Velt
Op dinsdag 22 november 2016 15:55:25 UTC+1 schreef Rex van der Spuy: > > But, can anyone explain why Elm doesn't let us do this? > My impression is that it has to do with the enforced strong typing and type safety of elm. A record is intended for key-value type info where each value could be of

Re: [elm-discuss] Proposed addition for Task package

2016-11-22 Thread Wouter In t Velt
For those interested: here is the example I refered to: import Html exposing (..) import Html.Events exposing (onClick) import Time exposing (Time, second) import Task main = Html.program { init = init , view = view , update = update , subscriptions = subscriptions } --

Re: [elm-discuss] Proposed addition for Task package

2016-11-22 Thread Wouter In t Velt
Op dinsdag 22 november 2016 14:49:47 UTC+1 schreef Charlie Koster: > > My assumption is a race condition here wouldn't be possible since calling > `sendMsg MyMsg` is a synchronous action > I have tried it out in elm-lang.org/try, which suggests that it is asynchronous, in a simple setup -

Re: [elm-discuss] Proposed addition for Task package

2016-11-22 Thread Wouter In t Velt
Op dinsdag 22 november 2016 13:47:55 UTC+1 schreef Charlie Koster: > > I respectfully disagree. Depending on the application, this either may not > be possible or would be a terrible code smell. I honestly think the above > suggestion would be worse than chaining another Cmd msg. Sending another

Re: [elm-discuss] Re: Passing properties as arguments to messages?

2016-11-22 Thread Wouter In t Velt
PS: the function definition should not be capitalized, but should be called "animateProperty" of course -- 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

Re: [elm-discuss] Re: Passing properties as arguments to messages?

2016-11-22 Thread Wouter In t Velt
There is a way to make it work, but it will be a lot more verbose/ ugly/ overengineered. Your signature would need to look something like this: AnimateProperty : Model -> (Model -> Style) -> (Style -> Model -> Model) -> Msg -> (Model, Msg) AnimateProperty = model funcToExtractStyle

Re: [elm-discuss] Proposed addition for Task package

2016-11-22 Thread Wouter In t Velt
My 2c: I kind of like it that there is NOT such a function in the core. Because it *prevents me from grabbing it when I really shouldn't*. Especially if the `Cmd` has no side effects, it is better to do a recursive call to the `update` function, or better yet: call the function that your

Re: [elm-discuss] Re: Edit Table Cell

2016-11-20 Thread Wouter In t Velt
To get decent styling of tables I always use CSS flexbox, as classes for plane and tags. I'm sure there are ways to work too, but for me, they also tend to jump around and behave in unexpected ways. For elm specifically, you could look at devoid/elm-mdl, Or use material design light CSS

Re: [elm-discuss] Re: Edit Table Cell

2016-11-20 Thread Wouter In t Velt
Op zondag 20 november 2016 20:17:04 UTC+1 schreef Thomas Shelton: > > I'm not sure onInput will work with TD's though. I'm not seeing any > messages logged in the console. > Yeah, you are right. `onInput` does not fire on TDs. I have changed my example to include your custom `on` handler for

[elm-discuss] Re: Edit Table Cell

2016-11-20 Thread Wouter In t Velt
Your Msg is the type you use to send data back. You actually send it to the Elm runtime. The Elm runtime then sends it to your update function, together with a model. The nice thing is, you can pass more than one parameter in your message. If you define your message as: type Msg = Input Int

[elm-discuss] Re: Ho to work with the DOM of element where Elm is 'embed'ed.

2016-11-18 Thread Wouter In t Velt
I tried this once with the idea to have some sort of "Elm is initializing" static HTML, to be replaced after my elm app loaded and ran. So for me this behavior wasn't what I needed at the time. (By now my elm app loads and runs in 1600ms first load, and 250ms with caching, so fortunately don't

Re: [elm-discuss] Issue a command after view update

2016-11-18 Thread Wouter In t Velt
Op vrijdag 18 november 2016 11:22:51 UTC+1 schreef Tim Bezhashvyly: > > That's the issue. By the time load command is sent the HTML markup must be > already present at the page. > I am not to familiar with Google maps integration, but it looks like the actual update of the map in the DOM is

[elm-discuss] Ho to work with the DOM of element where Elm is 'embed'ed.

2016-11-17 Thread Wouter In t Velt
I tried that in 0.17, and the embedded elm stuff was placed after the last existing child of the node where I embedded elm. So: ... Elm stuff -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To

[elm-discuss] Re: Suggested edit to Json.Decode docs

2016-11-17 Thread Wouter In t Velt
Thank you all for clearing that up. I discovered the elm-decode-pipeline through this, so that's also valuable. -- 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] Suggested edit to Json.Decode docs

2016-11-16 Thread Wouter In t Velt
In the Json.Decode docs I ran into unfamiliar functions in an example in the lazy section. comment : Decoder Commentcomment = object Comment

Re: [elm-discuss] Help for article review for SPA applications in Elm 0.18

2016-11-15 Thread Wouter In t Velt
Great article! I really like the way that you take the reader step by step through building a basic SPA, which even includes navigation and url parsing. Personally, I think it is fine to let the reader "play along" by making a local copy and work on that. It would be useful if you point out

Re: [elm-discuss] Re: Correct use of port subscriptions in a submodule reused multiple times?

2016-11-14 Thread Wouter In t Velt
Op maandag 14 november 2016 02:24:16 UTC+1 schreef Witold Szczerba: > > Can you provide some real-life example of "moving away from components"? > That could be helpful… > Sure. My background is in React, where everything there is components too. No examples of my own to share just yet. My app

[elm-discuss] Re: Correct use of port subscriptions in a submodule reused multiple times?

2016-11-08 Thread Wouter In t Velt
In your design, the port has a 1-to-1 connection to the Part. The port does not communicate for which Part the incoming message is intended, because it "expects" that their is only 1 Part. Your batch function in the subscriptions in the Group.elm passes on the port message on to all your Parts.

[elm-discuss] Re: Proposal: rename foldl til foldLeft and foldr to foldRight

2016-10-26 Thread Wouter In t Velt
Op woensdag 26 oktober 2016 13:21:03 UTC+2 schreef Rupert Smith: > > Also worth pointing out that these libraries (and possibly others) have > adopted the convention of using a single 'l' or 'r' to mean from-the-left > and from-the-right: > And the List library also has a scanl function (no

Re: [elm-discuss] why no more primes on 0.18 ?

2016-10-26 Thread Wouter In t Velt
Op woensdag 26 oktober 2016 13:51:03 UTC+2 schreef Andrew Radford: > > Yeah but it does beg the question whether > > type'' > > should become type__ > The type' variable was in the 0.17 Html.Attributes package. I don't think double primes are an issue there. For other variables, that we define,

Re: [elm-discuss] tictactoe game with elm (newbie)

2016-10-26 Thread Wouter In t Velt
Op woensdag 26 oktober 2016 13:36:18 UTC+2 schreef Did: > > But It seems that, in the update function, currentBox always return > something because it doesn't update my model... I'm obviously doing > something wrong. But, for me, as all cells are unoccupied, this test should > return Nothing.

Re: [elm-discuss] why no more primes on 0.18 ?

2016-10-26 Thread Wouter In t Velt
Never mind my question: type' will be type_ -- 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

Re: [elm-discuss] why no more primes on 0.18 ?

2016-10-26 Thread Wouter In t Velt
The primes I currently use mostly in msg' and in model' in update functions. It will take some getting used to, but not too bad I guess. I agree that newModel or similar is easier to read, so probably an improvement. The backticks like in `andThen` I won't miss. It is probably more consistent

Re: [elm-discuss] Proposal: rename foldl til foldLeft and foldr to foldRight

2016-10-25 Thread Wouter In t Velt
Op dinsdag 25 oktober 2016 02:20:29 UTC+2 schreef Max Goldstein: > > Changing things makes upgrading harder, invalidates old code, and gives > the larger community the impression that Elm is not stable. > The question is whether different naming for "foldl" and "foldr" would bring enough

[elm-discuss] Re: Naming functions

2016-10-24 Thread Wouter In t Velt
Op maandag 24 oktober 2016 13:18:59 UTC+2 schreef Lars Jacobsson: > > Any thinking going out there on around naming conventions OOP vs > functional? I'd be grateful for any input on this matter of life or death! > I always try to keep my naming conventions close to the Core functions. E.g. in my

Re: [elm-discuss] Structure for large Elm apps

2016-10-22 Thread Wouter In t Velt
Op vrijdag 21 oktober 2016 21:01:29 UTC+2 schreef Ed Ilyin: > > Can you, please, provide an example? > In a SPA I am developing, I use a structure like: Helpers.elm Helpers -- folder with more helpers Nav.elm -- helpers for navigation Exam.elm -- helpers for updating the exam Summaries.elm

Re: [elm-discuss] Structure for large Elm apps

2016-10-21 Thread Wouter In t Velt
+1 for the "better flat than nested " approach. I think it was the second elm town podcast where Brian admitted that he actually regretted his post. >From personal experience (admittedly limited) I definitely agree to the "flat >is better than nested". Having one update function with helpers,

Re: [elm-discuss] Proposal: Rename case..of -> match..with

2016-10-21 Thread Wouter In t Velt
Personally I prefer "case ... of" I find it easier to read: "(in) case [this thing] (is) of [this pattern], (do) [this function]". It is a variant of the "if ... then ... else .." syntax. To me, "match ... with" would be less easy to read (although other languages apparently use it), but also

[elm-discuss] Re: Can I use css animations normally in elm?

2016-10-15 Thread Wouter In t Velt
Interesting! Having only discrete state in elm, with animations in CSS will definitely keep code simpler. -- 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] Re: Can I use css animations normally in elm?

2016-10-14 Thread Wouter In t Velt
I have some experience in this, and for basic stuff you can use css. And it keeps your elm code nicely focused on state, without complexity of having to manage state transitions inside state. e.g. for displaying and hiding a sidebar-menu which slides in from the left, or a dropdown-menu,

Re: [elm-discuss] Re: using js library inside elm?

2016-10-13 Thread Wouter In t Velt
> > On Thu, Oct 13, 2016 at 5:46 AM, António Ramos > wrote: > >> any example of calling an external js method ? >> > Another example of calling external JS method is in the Todo.elm example app . Where port to JS

Re: [elm-discuss] http "middleware" options

2016-10-12 Thread Wouter In t Velt
Personally, I like the setup for as it is used in the time tracker SPA example (here) . They have a separate file (Util.elm) with the following function: cmdForRoute : Model -> List (Cmd Msg) (This function is called inside

Re: [elm-discuss] Pattern matching on aliased types

2016-10-12 Thread Wouter In t Velt
Op dinsdag 11 oktober 2016 23:35:27 UTC+2 schreef Duane Johnson: > > toString is a bit magical in Elm, and can convert any type to a string. > Also note that if you apply toString to something that is already a String, it will add double quotes at the start and end. -- You received this

[elm-discuss] Re: Another documentation item I think is needed

2016-10-12 Thread Wouter In t Velt
Op dinsdag 11 oktober 2016 23:36:49 UTC+2 schreef J. E. Marca: > > On first read I laughed out loud --- I don't know what <| does, and it > seems a random application of head and drop. Reading closer, it *is* > straightforward as you say... drop first n items (one based count), then > get the

[elm-discuss] Re: Subscribe to a model value then call update function when condition is met

2016-10-12 Thread Wouter In t Velt
Op woensdag 12 oktober 2016 06:17:37 UTC+2 schreef hoang...@gmail.com: > > But if I do it this way, it's gonna return both the player's move and the > AI's move at the same time. What I want to have is that the game displays > the player's move THEN call minimax function on current model and

[elm-discuss] Re: Another documentation item I think is needed

2016-10-11 Thread Wouter In t Velt
The comparison page you refer to is more a high-level comparison between javascript and elm syntax. It does not look like it is intended to be in-depth. I agree it would be useful to have some docs at some time summing up the pros and cons of List vs Array vs Set vs Dict. But I am not sure that

[elm-discuss] Re: Subscribe to a model value then call update function when condition is met

2016-10-11 Thread Wouter In t Velt
PS: The subscription to time is useful if you want some sort of timeout or delay between the user move and the AI move. If you want to do the AI move immediately after the user move (without delay), a pattern with a recursive update call (and without subscription) is probably more suited.

[elm-discuss] Re: list of types is missing from docs page at http://elm-lang.org/docs

2016-10-11 Thread Wouter In t Velt
In the standard docs, there is some explanation of types here . But no exhaustive list. In practice, I found that I did not need to learn any of the standard types. In contrast to any other language I know, Elm's compiler is really helpful

[elm-discuss] Re: How to insert an object into a list from a form

2016-10-11 Thread Wouter In t Velt
Op dinsdag 11 oktober 2016 09:45:57 UTC+2 schreef Did: > > Thanks for your reply! Is there a better way to do this or this is a > common solution in elm? > Well, this is the best way I can think of :) But seriously, as soon as your app grows, some functions in this setup may become big and

[elm-discuss] Re: How to insert an object into a list from a form

2016-10-10 Thread Wouter In t Velt
Op maandag 10 oktober 2016 14:58:56 UTC+2 schreef Ambrose Laing: > > I would modify the model to also contain a name, description and price, at > the top level. These are uncommitted values. By uncommitted I mean that > it should be possible to change any one of these without changing the >

[elm-discuss] Re: Subscribe to a model value then call update function when condition is met

2016-10-10 Thread Wouter In t Velt
(disclaimer: I am also quite new to Elm) I always try to avoid creating my own Cmd: there is usually a better, less bug-prone way to achieve this (e.g. with resursive update calls). That said: I can see the logic in having a Msg originating from a "real" player, and another Msg from your AI

Re: [elm-discuss] Functional programming, or why should I use Elm instead of vanilla javaScript?

2016-10-06 Thread Wouter In t Velt
This react-conf 2016 video on Elm (which was when I first heard of Elm) is a great explanation of the many things which are possible in javascript, but not necesserily good. Javascript is like an irresponsible parent. You can do pretty much

[elm-discuss] Re: Modeling a domain with complex data access constraints

2016-10-03 Thread Wouter In t Velt
Hi Spencer, In an Elm app I am building I ran into similar challenges. The principles which work well for me in model design: - Flat is better than nested (for relational stuff, such as your courses) - One source of truth = a normalized model without duplication of data - Connect data

[elm-discuss] Re: Routing, authentication etc. still on my 3rd Elm project.

2016-09-29 Thread Wouter In t Velt
Very useful to read your experiences with Elm. I am in a more-or-less similar point on the learning curve. Small aside: The Elm Exts (extentions) package has a simple function called catMaybes to filter out Nothings: catMaybes : List (Maybe a) -> List a Link here:

Re: [elm-discuss] Does CSS model the right problem?

2016-09-27 Thread Wouter In t Velt
Gss and Slalom are very impressive indeed! Would be great if to use with Elm. Thanks for sharing Peter and Duane! -- 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] Re: Confused by error (inline function, >, tagged type)

2016-09-25 Thread Wouter In t Velt
It looks like the error you get is because you redefine the '>' function by using the same function: - You redefine '>' to take 2 DropsPerSecond types - Inside this function you want to use the "old" '>' function to compare 2 Floats The compiler - I think - is ahead of you: it uses

[elm-discuss] Re: Modeling cross-references

2016-09-25 Thread Wouter In t Velt
> > On Sunday, September 25, 2016 at 8:54:50 AM UTC+10, Eric G wrote: >> >> - Is it better to use Dicts as the basic 'table' structure, if frequently >> rendering lists of items filtered and sorted in various ways? In short, is >> it better to convert a `List (ID, Item)` to a Dict for finding

[elm-discuss] Re: html-to-elm

2016-09-08 Thread Wouter In t Velt
Nice tool! Do you plan on adding "style" and other odd shaped Elm attributes like "disabled" too? -- 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

Re: [elm-discuss] Re: Elm Runtime Exceptions

2016-09-08 Thread Wouter In t Velt
Interesting post, but I tend to disagree on a couple of points: According to the oracle Java tutorial , an exception is > *Definition:* An *exception* is an event, which occurs during the > execution of a program,

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-09-05 Thread Wouter In t Velt
After reading Josh Adams Time tracker SPA example something really clicked for me, and I feel I really "get it" now. I did not know what I needed and how to ask for it, but this was extremely helpful, and got me back on track! Also, I think my OP about the counters can be considered closed now.

Re: [elm-discuss] Re: Basic behavioral composition

2016-09-05 Thread Wouter In t Velt
Hadn't noticed this section in the guide before. Great explanation! Thanks for sharing. Op vrijdag 2 september 2016 18:00:31 UTC+2 schreef suttlecommakevin: > > This new doc helps a ton. Thanks for this! > > http://guide.elm-lang.org/reuse/ > -- You received this message because you are

[elm-discuss] When to use Dict vs. List?

2016-09-03 Thread Wouter In t Velt
List and Dict are good for different things: If most of the interaction with the collection is getting and setting, adding and deleting items 1 at a time: go with Dict. If most of the interaction is going over the list, including sorting, rendering, counting items etc: then go with List. Todo's

[elm-discuss] Re: How to order imports?

2016-09-02 Thread Wouter In t Velt
Good question to raise! The lack of any logic in my own imports had on occasion nagged me too. This is our convention: > > 1) Core modules; > 2) Public modules from elm-lang; > 3) Other public modules; > 4) Project modules. > The one @Simone Vittori suggests looks simple and workable. -- You

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-30 Thread Wouter In t Velt
@Erik Lott, did you mean: view : Msg -> Msg -> Int -> Html Msg Or did I miss something? @Peter Damoc, yeah the flat solution would be simpler (I actually did do a flat counter list before separating out the CounterView ;). -- You received this message because you are subscribed to the

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-29 Thread Wouter In t Velt
> > Here's what I've been working on. The recent git history is all about > refactoring. Haven't introduced 'sub-components with state' or w/e and > don't see it coming soon. It's an Elm-SPA with a Phoenix backend: > https://github.com/knewter/time-tracker > Looks interesting. Thanks for

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-29 Thread Wouter In t Velt
> > I would love to know how to do this! > Can anyone point me to a brain-dead-simple practical and working example > for a non-expert Elm user like myself? OK, so here is my take at an alternative multiple counters approach. {- Model needs to hold a list of counter values Any counter in the

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-29 Thread Wouter In t Velt
> > I would love to know how to do this! > Can anyone point me to a brain-dead-simple practical and working example > for a non-expert Elm user like myself? OK, so here is my take at an alternative multiple counters approach. import Html exposing (Html, div, button, text) import Html.App

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-29 Thread Wouter In t Velt
> > I would love to know how to do this! > Can anyone point me to a brain-dead-simple practical and working example > for a non-expert Elm user like myself? OK, so here is my take at an alternative multiple counters approach. First, putting everything in one (monolithic) module: import Html

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-29 Thread Wouter In t Velt
> > I would love to know how to do this! > Can anyone point me to a brain-dead-simple practical and working example > for a non-expert Elm user like myself? OK, so here is my take at an alternative multiple counters approach. First, putting everything in one (monolithic) module: import Html

[elm-discuss] Re: Do the counters in the Guide teach us a wrong scaling approach?

2016-08-28 Thread Wouter In t Velt
Thanks for the feedback folks. Really helpful and got me thinking. Will definitely dive into the links @NickH shared. And @ErikLott's example of a multi-page SPA (forgive the oxymoron) was also helpful. This is one of the places I run into issues: my top level update is already huge and

Re: [elm-discuss] Should I have a CSS file for my made-with-Elm web app?

2016-08-23 Thread Wouter In t Velt
What works for me is: - Separate CSS file for static styling and basic UI animations, so I only need to add class attributes in view functions. - Layout, fonts, hover and focused states etc etc all go in css file. - So e.g. if I want to make give a "selected" element in a list

Re: [elm-discuss] Re: Basic behavioral composition

2016-08-23 Thread Wouter In t Velt
Thank you for this very clear and concise description @debois! Coming from React+Flux, I've followed much of the discussions on child-parent communication, components etcetera, but I found it really hard to scale in elm. The "everything is a component" from react is a hard habit to break, and

  1   2   >