ekmett / machines

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

Fix the Representable instance of Moore. #107

Closed arkeet closed 4 years ago

arkeet commented 5 years ago

The current instance doesn't satisfy the law index . tabulate ≡ id:

>>> index (tabulate id :: Moore Int [Int]) [1,2,3]
[3,2,1]

I think index is correct, so tabulate needs to be fixed.

treeowl commented 5 years ago

The only change is to the Corepresentable instance. Which thing is wrong?

arkeet commented 5 years ago

The Representable instance defines tabulate = cotabulate, so really this fixes both (the corresponding law for Profunctor.Corepresentable is cosieve . cotabulate ≡ id).

YoEight commented 5 years ago

I'm fine merging that PR however I'm not well versed into Representable instances. Could someone jump in and confirm that patch isn't breaking anything?

arkeet commented 4 years ago

Bumping this :-)