import Control.Comonad
import Control.Arrow
import Data.List.NonEmpty (NonEmpty(..))
f :: (Comonad w) => Cokleisli w a (w a)
f = Cokleisli id
arg :: NonEmpty Int
arg = 1 :| [2, 3, 4]
main :: IO ()
main = do
putStrLn "f >>> arr Left:"
print $ runCokleisli (f >>> arr Left) arg
putStrLn "arr Left >>> left f:"
print $ runCokleisli (arr Left >>> left f) arg
-- f >>> arr Left:
-- Left (1 :| [2,3,4])
-- arr Left >>> arr f:
-- Left (1 :| [1,1,1])
So is there a definition of ArrowChoice for Cokleisli that satisfies the laws?
EDIT: It appears that it breaks an ArrowApply law, too:
So is there a definition of ArrowChoice for Cokleisli that satisfies the laws?
EDIT: It appears that it breaks an ArrowApply law, too:
So that's probably why setting
left = leftApp
didn't work.