Open Quelklef opened 3 years ago
Recording this here since it's been a question multiple times: the reason Batched
is defined as
data BatchedF f a ≅ Array (f a)
instead of
data BatchedA a ≅ Array a
is because to transform the contained a
s we need only one map
:
map :: forall f. Functor f => (a -> b) -> BatchedF f a -> BatchedF f b
instead of two:
(map >>> map) :: forall f. Functor f => (a -> b) -> BatchedA (f a) -> BatchedA (f b)
That is, it's convenience
What about
data BatchedA a ≅ Array a
and then using Compose
for the nested case?
Hypothesis:
can become
We made this change and followed the type errors and were able to compile without anything suspicious coming up.
Mysterious...
Runtime behaviour was not tested.