-
Notifications
You must be signed in to change notification settings - Fork 39
Conversation
@rossabaker I wonder if your GDecomp Comonad failure can be fixed by my fix here: #26 |
Thanks! I merged #26 into my branch, and it's still failing for me on two laws introduced by Cats that aren't in Scalaz:
The Order instances I needed to introduce to get a Cogen make me uneasy. I've not yet had enough time to concentrate on whether I created bad instances, or whether the fact we need Orders on Sets and Maps at all is responsible for this problem. The laws that are present in Scalaz pass on the Cats port with or without #26. |
I suppose an easy way of making your Order instances ever so slightly less sketchy is to sort them before returning. |
I think I have identified the problems revealed by the comonad laws (there's quite a few of them):
|
I sketched the quick and dirty solution to 4. (iv.) and the comonad laws are satisfied here: joroKr21/quiver@3606546 |
@rossabaker Feel free to do that. But maybe we should open a separate issue about |
Okay, finally getting back to this. I'd like to get this working on cats-1.0 and release quickly after cats' 1.0 release next week. I've rebased to get the latest from master, and cherry-picked @joroKr21's change to restore the Comonad. I'm out of energy for tonight, but for cats-1.0, it looks like |
Looks like those methods were moved to the companion objects in typelevel/cats#1997 but other than that they should be the same. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be in good shape here to release when cats-1.0 is available.
Are we all comfortable with the current solution to the ordering, or does someone want to make a late push for option i or ii?
implicit def cogenMap[K: Cogen: Ordering, V: Cogen]: Cogen[Map[K, V]] = | ||
Cogen.it(_.toVector.sortBy(_._1).iterator) | ||
implicit def cogenContext[V: Cogen: Ordering, A: Cogen, B: Cogen: Ordering]: Cogen[Context[V, A, B]] = | ||
Cogen[(V, GrContext[V, A, B])].contramap(c => c.vertex -> c.toGrContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are falsely getting flagged as unused in certain versions of Scala. I believe they will be unnecessary after a new release of scalacheck.
This is sloppy, but since it doesn't affect the public API, I'm content to live with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cogenMap
won't be necessary, but cogenContext
will be because of the no-ordering assumption
👍 for the current solution, even if it means being somewhat hand-wavy. Option I. would trigger a cascade of API changes because of the pervasive use of I don't like option II. either, because it means constraining graphs only to elements with a defined |
Okay, this is upgraded to cats-1.0.0-RC2. I propose releasing this as quiver-7, and we'll follow with a patch next week when cats-1.0.0 is available. |
Two issues that need to be sorted through, but this can start the discussion:
GDecomp[N,?,B]
does not satisfy Cats' Comonad laws.Cats doesn't have a
Tree
. Not sure if we can replace this withCofree[Stream,?]
. None of the functions that useTree
have test coverage, so everything is commented for now.Fixes #19.