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

2016-11-22 Thread Austin Bingham
This article really opened my eyes to the possibilities of lenses and their interaction with the Return monad: https://toast.al/posts/2016-10-20-optical-swordplay-with-components.html Definitely worth a read. On Tue, Nov 22, 2016 at 8:17 PM Nick H wrote: > You might

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

2016-11-22 Thread Nick H
> > You might look at lenses (e.g. elm-monocle) to see one approach that might > appeal to you. This is pretty cool. I've often made setter functions for my records, wrapping around Elm's regular update syntax. I didn't realize that it's part of a larger class of patterns. On Tue, Nov 22, 2016

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

2016-11-22 Thread Rex van der Spuy
Thanks so much for explaining that. -- 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] Re: Passing properties as arguments to messages?

2016-11-22 Thread Austin Bingham
You might look at lenses (e.g. elm-monocle) to see one approach that might appeal to you. Lenses are apparently frowned upon by some, but I think they capture the essence of what you're asking. On Tue, Nov 22, 2016 at 4:04 PM Wouter In t Velt wrote: > Op dinsdag 22

[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

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

2016-11-22 Thread Rex van der Spuy
Thanks for all your replies everyone!! I'm glad to have confirmation that this really is impossible and it's not just me. I think for now I'm just going to leave it as is. It's nice and simple and I understand it :) But, can anyone explain why Elm doesn't let us do this? -- You received this

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] Re: Passing properties as arguments to messages?

2016-11-22 Thread Thomas Coopman
You can also extract getting the model property in a separate function, so that you don't have to duplicate it completely. On Mon, 21 Nov 2016 at 23:59 'Rupert Smith' via Elm Discuss < elm-discuss@googlegroups.com> wrote: > On Monday, November 21, 2016 at 6:27:40 PM UTC, Rex van der Spuy wrote:

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

2016-11-21 Thread 'Rupert Smith' via Elm Discuss
On Monday, November 21, 2016 at 6:27:40 PM UTC, Rex van der Spuy wrote: > > Is it possible to pass model properties as message arguments and use those > arguments to construct a new model? > Could use a Dict instead of properties? -- You received this message because you are subscribed to the