I've had quite often needs for doing some computation (mapping) on ecto
result, but having a flexible function similar to `Repo.preload` currently
needs a whole bunch of boilerplate in terms of differenciating collections
from single items and especially returning the same type afterwards (e.g.
keep it a collection or single item). I know that Enumerable and
Collectable were split consciously, but it would be great to have something
like `Collectable.empty/1`, so one could do some work using `Enum`
functions and in the end do: `Enum.into(changed,
Collectable.empty(initial))` and it would empty the collectable and fill it
up again using the changed data. This way the `Repo.preload` could e.g.
additionally support custom enumerable and collectable collections as first
argument like e.g. `%Scrivener.Page{}`.
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/19c24b83-fc2a-4af3-950e-eba7f767db14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.