Haskell 如何向幺半群添加应用效果?

Haskell 如何向幺半群添加应用效果?,haskell,Haskell,我如何更改下面的代码,使Maybemonoid元素中的每个元素也接受两个参数(因此它将成为“double”reader applicative) 我想我可以举起两次: > :t (liftA2 $ liftA2 (<>)) (liftA2 $ liftA2 (<>)) :: (Monoid c, Applicative f1, Applicative f) => f (f1 c) -> f (f1 c) -> f (f1 c) :t

我如何更改下面的代码,使
Maybe
monoid元素中的每个元素也接受两个参数(因此它将成为“double”reader applicative)

我想我可以举起
两次:

> :t (liftA2 $ liftA2 (<>))
(liftA2 $ liftA2 (<>))
  :: (Monoid c, Applicative f1, Applicative f) =>
     f (f1 c) -> f (f1 c) -> f (f1 c)
:t(liftA2$liftA2())
(liftA2$liftA2())
:(幺半群c,应用f1,应用f)=>
f(f1 c)->f(f1 c)->f(f1 c)

但是我一直在尝试用
foldr
来编写它,以获得我想要的类型签名。

我就是这样做的

g2 x y = g $ ($ y) <$> ($ x) <$> theList
g2 x y=g$($y)($x)列表

你只是想把
[b->c->a]
变成
[a]
,方法是将
b
c
应用到每个元素上,然后对其进行
foldr()(只是“)
?如果是这样的话,为什么不仅仅是
g2xsbc=g$map(($(b,c)).uncurry)xs
?或者目标是
(monoida,IsString a,Applicative f,Applicative g)=>g(b->c->fa)->b->c->f(ga)
?获得相同的签名并不能告诉我们预期的功能是什么
g2xsbc=travel(($c)。($b))xs
g2'xsbc=foldr()(Just”“)$map(($c)。($b))xs
的行为不同。
> :t (liftA2 $ liftA2 (<>))
(liftA2 $ liftA2 (<>))
  :: (Monoid c, Applicative f1, Applicative f) =>
     f (f1 c) -> f (f1 c) -> f (f1 c)
g2 x y = g $ ($ y) <$> ($ x) <$> theList