Closed mitchellwrosen closed 8 years ago
Interesting? I stole the idea and implementation from your comment about Cofree
! :)
This is how @ekmett compliments himself.
Amusingly, I realized after the fact that I'd already written the more general statement elsewhere. I just hadn't really considered the consequences here.
Note: Mealy is also distributive (it is represented by a NonEmpty a
).
(and both should be instances of the profunctor equivalents as well)
For the categorically uninclined who happen upon this ticket, can you clarify what you mean by
using Moore as a representable functor, represented by a list of inputs
My understanding is you're saying there's an isomorphism
to :: Moore a b -> ([a] -> b)
to (Moore b _) [] = b
to (Moore _ f) (x:xs) = to (f x) xs
from :: ([a] -> b) -> Moore a b
from f = Moore (f []) (\a -> from (\as -> f (a:as)))
but I don't see what it has to do with this Distributive
instance.
The short version is this: Every distributive functor is representable, Distributive
is constrained by Haskell 98 though to not actually tell you what the representation is.
Can this be made an instance of Representable? On Dec 2, 2015 1:59 AM, "Edward Kmett" notifications@github.com wrote:
The short version is this: Every distributive functor is representable, Distributive is constrained by Haskell 98 though to not actually tell you what the representation is.
— Reply to this email directly or view it on GitHub https://github.com/ekmett/machines/pull/72#issuecomment-161202252.
Since this pull request I've already gone ahead and done so in HEAD.
Interesting. This is effectively using it as a representable functor, represented by a list of inputs.