You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The instance instance Comonad w => Choice (Cokleisli w) doesn't follow the Choice laws. It would have been if Cokleisli w was a conforming ArrowChoice, but it isn't (although it has the instance.)
To copy it out here, this is an alternate, explicit implementation:
left (Cokleisli f) = Cokleisli (\fac ->
case extract fac of
Right c -> Right c
Left a -> Left . f $ fmap (either id (const a)) fac)
which has also been mentioned in a few other forums. I have previously verified that it meets the definition for co-cartesian co-strength manually, and it appears that these could be equivalent to the laws for Choice at first glance, and likewise this should meet the laws, although it would be a breaking change in the implementation.
It's not clear why the implementation would appear to not be the same, if the linked issue is to be believed.
The instance
instance Comonad w => Choice (Cokleisli w)
doesn't follow theChoice
laws. It would have been ifCokleisli w
was a conformingArrowChoice
, but it isn't (although it has the instance.)ekmett/comonad#36
Maybe it's already alarmed by the notice
'extract' approximates 'costrength'
attached to theChoice
instance, but it wasn't clear for me.The text was updated successfully, but these errors were encountered: