gampleman / elm-visualization

A data visualization library for Elm
http://package.elm-lang.org/packages/gampleman/elm-visualization/latest/
MIT License
514 stars 48 forks source link

Better version of Interpolation.list #144

Open gampleman opened 1 year ago

gampleman commented 1 year ago

We could make add and delete options to be a -> Interpolator (Maybe a), with Nothing indicating their absence in the resulting list.

We should also make the list ordered by default where order would be interpolated properly.

ListCombiner is kind of dumb, we should just accept a List (Interpolator a) -> Interpolator (List a) function

Finally, we could make all the options (except id) actually optional, since

{ add = \v -> Interpolation.step Nothing [ Just v ]
, remove = \v -> Interpolation.step (Just v) Nothing
, change = \a b -> Interpolation.step a [ b ]
, combine = Interpolation.inParallel
}

would be pretty decent defaults.

Potentially we could make id optional as well and just treat everything as additions and removals without it, but that sort of seems fairly suboptimal. Or have a way to use == to figure out reorder-ing at least...