ekmett / profunctors

Haskell 98 Profunctors
http://hackage.haskell.org/package/profunctors
Other
70 stars 43 forks source link

Explain laws for Cochoice? #36

Closed Zemyla closed 7 years ago

Zemyla commented 8 years ago

Does Cochoice have laws? Am I right in assuming that its gist is basically "If you get a value on the wrong side, pass it back in again until you get one on the correct side"? If so, then wouldn't any ArrowChoice also be a Cochoice, with:

unright :: (ArrowChoice p) => p (Either a c) (Either b c) -> p a b
unright a = let go = ((go . arr Left) ||| id) . a in go . arr Right

That seems to be equivalent to the instance definition for Cochoice (->).

phadej commented 7 years ago

Isn't this done as part of solving #38?

image

ekmett commented 7 years ago

Fixed.