为什么 pointfree.io 选择 liftM2 而不是 liftA2?

Why did pointfree.io choose liftM2 instead of liftA2?

我最近正在为 ISBN Verifier exercise at Exercism, and when I ran this function through pointfree.io:

写一个解决方案
\c -> isDigit c || c == 'X'

我回来了:

liftM2 (||) isDigit ('X' ==)

为什么 pointfree.io 从 Control.Monad 选择 liftM2 而不是从 Control.Applicative 选择 liftA2

事实是 Control.MonadControl.Applicative 大很多。

Monads 已经在 Haskell 98 年,而关于 applicative functors 的论文是在 2007 年介绍的。Hackage 中的包从 2005 年就存在了。

Wikipedia:

Due to historical accident, applicative functors were not implemented as a superclass of Monad, but as a separate type class. It turned out that, in practice, there was very little demand for such a separation, so in 2014, it was proposed to make Applicative retroactively a superclass of Monad.

所以liftM{N}仍然有效。