Re: [elm-discuss] Re: Is there a better way to structure my List types?

2016-08-01 Thread Nick H
I may have oversold it there at the end :-P, but I have been doing some major refactoring lately and am very pleased with the results so far. Please keep sharing your experiences! On Mon, Aug 1, 2016 at 8:49 AM, Ryan W wrote: > Doing pagination in the view after the case

[elm-discuss] Re: Is there a better way to structure my List types?

2016-08-01 Thread OvermindDL1
As another way to think about this, and I am unsure how Elm'ish this is (but it is very functional), you could invert your lists into being functions, then pass in commands to operate on the internal lists. This is how some functional list implementations are developed especially when missing

Re: [elm-discuss] Re: Is there a better way to structure my List types?

2016-08-01 Thread Ryan W
I was thinking I might want List.take and List.drop for pagination purposes but in seems like the easiest way in this particular case is to do all that generic list manipulation ahead of time when I have the plain lists, before I add the types. But if dynamic pagination was a hard requirement then

Re: [elm-discuss] Re: Is there a better way to structure my List types?

2016-08-01 Thread Nick H
I don't mean to gloss over the fact that the length function you had to write is a little verbose. But I don't think there are a lot of other operations that would be applicable to every type of list in ThingList. For instance, folding and mapping wouldn't work, because the fold/map function would

Re: [elm-discuss] Re: Is there a better way to structure my List types?

2016-08-01 Thread Nick H
The semantics are relevant because we want to avoid an XY scenario , which tend to come up a lot on this mailing list. Rest assured, Soren is only asking because he wants you to get the best help possible. :-) It sounds to me like the approach you describe in the OP is

Re: [elm-discuss] Re: Is there a better way to structure my List types?

2016-08-01 Thread Søren Debois
I meant, what are you trying to model? What's the /actual/ application you're doing? -- Søren Debois Sent with Airmail Den 1. august 2016 kl. 13.20.47, ryan1...@gmail.com (ryan1...@gmail.com) skrev: > Records, where each type has a different set of fields. > > On Aug 1, 2016, at 4:08 AM,

Re: [elm-discuss] Re: Is there a better way to structure my List types?

2016-08-01 Thread debois
What actually goes in the lists? (As opposed to Foo, Bar etc.) -- 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

[elm-discuss] Re: Is there a better way to structure my List types?

2016-08-01 Thread Wouter In t Velt
How about this? type Thing = Foo | Bar | Baz type ThingList = List Thing That way, you can simply do: List.length ThingList -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails