Clojure 猫追加 nil 行为

Clojure cats append nil behaviour

我正在使用 funcool/cats,使用以下代码附加幺半群:

(m/mappend (maybe/just [1 2 3])
             nil
             (maybe/just [4 5 6])
             (maybe/nothing)) ;;=> #<Just [1 2 3 4 5 6]>

nil 视为 maybe/nothing 的理由是什么?

注:版本为[funcool/cats "1.2.1"]

commit log来看,好像是

just for (sic) avoid accidental null pointer exceptions

这也记录在这里:http://funcool.github.io/cats/latest/#nil

Given the fact that nil is both a value and a type, we have extended the nil type to be equivalent to Maybe monad’s Nothing.