Haskell Data.Bifunctor基本上是:
class Bifunctor f where
bimap :: (a -> c) -> (b -> d) -> f a b -> f c d
Run Code Online (Sandbox Code Playgroud)
我也能找到一个Biapply.我的问题是,为什么不存在完整的双层次结构(层次结构?),如:
class Bifunctor f => Biapplicative f where
bipure :: a -> b -> f a b
biap :: f (a -> b) (c -> d) -> f a c -> f b d
class Biapplicative m => Bimonad m where
bibind :: m a b -> (a -> b -> m c d) …Run Code Online (Sandbox Code Playgroud)