4 ms·
I don't think anything in that Reddit thread was conclusive, nor did they capture all of their properties (early termination, cleanup step).
by swannodette 12y ago
I don't think anything in that Reddit thread was conclusive, nor did they capture all of their properties (early termination, cleanup step).
- deleted 12y ago[deleted]
- bkirwi 12y agoYep, that's right. There seem to be a few factors involved: - Most of that discussion happened before a full description of transducers was up anywhere, so a lot of these details are just completely missing. - Haskell's type system is not expressive enough to capture certain interesting properties, like linearity. (To be clear, it's quite possible to translate any arbitrary transducer into Haskell -- but the type system will not prevent all the mistakes it is possible to make.) - There are different classes of transducers that Haskell people actively would not want to have identical types. (ie. stateful vs. stateless, early-terminating vs. unbounded) Many of the discussions revolve only one or a few of these classes -- typically the stateless unbounded version, which turns out to have a particularly simple encoding, but it definitely varies.
- tel 12y agoThose, I believe, are fairly easy to capture in the `Moore b r -> Moore a r` formulation. It also captures linearity. That said, I think the more general formulation is something like Fold or Traversal in Lens which operates polymorphically over the whole thing with a type that a refinement of Profunctor p => p a b -> p s t where such a type generalizes all of the concrete Haskell formulations.