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 it seems like I'd be stuck filling out functions for every type.
On 1 August 2016 at 07:59, Nick H <[email protected]> wrote: > 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 only work for one of the component types. > > On Mon, Aug 1, 2016 at 6:51 AM, Nick H <[email protected]> wrote: > >> The semantics are relevant because we want to avoid an XY scenario >> <http://xyproblem.info/>, 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 the best way >> to model the data. >> >> Sure, your "reduce" function doesn't compile. But I don't think it would >> be that useful anyway. How many 1-arity functions are there that can >> operate on a list of *unspecified* type and return a value of a *specified >> *type? The only one I can think of is List.length. >> >> On Mon, Aug 1, 2016 at 4:49 AM, Ryan W <[email protected]> wrote: >> >>> I'm using this package >>> <http://package.elm-lang.org/packages/evancz/elm-sortable-table/latest/> >>> to display several different types of tables, with different sets of >>> columns. The actual number of tables and the data within them is dynamic, >>> but the types of tables are all definable ahead of time. Only one type of >>> table needs to be visible at one time, but users should be able to switch >>> back and forth between different tables. So, in my model I have a ThingList >>> called currentThingList which is rendered in the view, and a Dict that >>> holds all the ThingLists so the currentThingList can be set according to >>> the users' wishes. >>> >>> I don't see how the semantics of the data is relevant. >>> >>> On 1 August 2016 at 05:27, Søren Debois <[email protected]> wrote: >>> >>>> 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, [email protected] ([email protected]) >>>> skrev: >>>> >>>>> Records, where each type has a different set of fields. >>>>> >>>>> On Aug 1, 2016, at 4:08 AM, debois <[email protected]> wrote: >>>>> >>>>> What actually goes in the lists? (As opposed to Foo, Bar etc.) >>>>> >>>>> -- >>>>> You received this message because you are subscribed to a topic in the >>>>> Google Groups "Elm Discuss" group. >>>>> To unsubscribe from this topic, visit >>>>> https://groups.google.com/d/topic/elm-discuss/8FNvfSguIq8/unsubscribe. >>>>> >>>>> To unsubscribe from this group and all its topics, send an email to >>>>> [email protected]. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to a topic in the >>>>> Google Groups "Elm Discuss" group. >>>>> To unsubscribe from this topic, visit >>>>> https://groups.google.com/d/topic/elm-discuss/8FNvfSguIq8/unsubscribe. >>>>> >>>>> To unsubscribe from this group and all its topics, send an email to >>>>> [email protected]. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "Elm Discuss" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/elm-discuss/8FNvfSguIq8/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> 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 [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Elm Discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elm-discuss/8FNvfSguIq8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
