ekmett / machines

Networks of composable stream transducers
Other
339 stars 46 forks source link

Generalize machines to address #39 #93

Closed alang9 closed 6 years ago

alang9 commented 6 years ago

Just want to request comments on this change. The most important changes are in Data.Machine.Type

alang9 commented 6 years ago

I want to point out 2 things:

  1. the performance seems worse in the benchmark. In particular, the scan, fold and zip benchmarks look quite bad
  2. With this definition of MachineT:
    type MachineT m k o = TranslateT m (Is o) k

    We are not able to write instances for Functor, Monad, Applicative, Foldable. We could newtype MachineT to allow for these instances, but that seems more annoying.

alang9 commented 6 years ago

Another thing I want to mention is that I chose the type argument order for TranslateT so that it can allow Profunctor-like functions

lmap1 :: (forall t. j t -> i t) -> TranslateT m i k -> TranslateT m j k
rmap1 :: (forall t. k t -> l t) -> TranslateT m j k -> TranslateT m j l

But this means that it's kind of flipped compared to the order in MachineT. Also, when composing 2 TranslateTs, like f . g. g is the more downstream TranslateT, which is kind of opposite from the direction of function composition.

Any thoughts about whether the order should be flipped?

YoEight commented 6 years ago

Is this PR still ongoing?

YoEight commented 6 years ago

I'm closing. Feel free to ping if you need that MR to move forward.