• code Haskell
    amap :: (Category p, Strong p, Choice p, Profunctor p) => p a b -> p [a] [b]
    amap = make . it . tasty where -- (p ||| amap p) where
      -- make :: Profunctor p => p (Either () (a,[a])) (Either () (b,[b])) -> p [a] [b]
      make = dimap view build
        where
         build = either (const []) (uncurry (:))
         view = maybe (Left ()) Right . uncons
      -- it :: (Choice p, Profunctor p) => p (a,[a]) (b,[b]) -> p (Either () (a,[a])) (Either () (b,[b]))
      it = right'
      -- tasty :: (Choice p, Category p, Strong p) => p a b -> p (a,[a]) (b,[b])
      tasty p = p ||| amap p
      (|||) x y = first' x >>> second' y
    
    меняем it на right' и все перестает компилироваться, почему?

Replies (3)