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: 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

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: Patterns for sum and product types

2016-12-18 Thread Rafał Cieślak
Oh, I'd forget that there's this post "Writing Friendly Elm Code" written by Tessa Kelly. http://tech.noredink.com/post/146963432518/writing-friendly-elm-code It also discusses how to model data in the app. On Sunday, December 11, 2016 at 8:01:09 PM UTC+1, Brian Marick wrote: > > I’m repeatedly

[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 https

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

2016-12-13 Thread Wouter In t Velt
Those are great posts Rafael! 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, visi

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

2016-12-13 Thread Rafał Cieślak
I'd love to see those "patterns" written down, too! For now, other than Richard Feldman's talk "Making Impossible States Impossible", I have only found two F# resources: * The "Designing with types" series on F# for fun and profit https://fsharpforfunandprofit.com/series/designing-with-types.ht

[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 this