(Maybe a, b) 转换为 Maybe (a,b) 是否容易(无需重新发明轮子)。我查看了 Traversable 但无法使其工作。

最佳答案

您也可以使用 Bitraversable :

bitraverse id pure :: (Bitraversable t, Applicative f) => t (f c) d -> f (t c d)

专门用于
bitraverse id pure :: (Maybe a, b) -> Maybe (a, b)

关于function - 将 (Maybe a, b) 转换为 Maybe (a,b),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31101071/

10-11 22:50