5
4

1 回答 1

2

chi writes

One could argue that

f :: Int -> Int -> [Int]
f x y = [x+y]

is commutative, non-strict, and non-constant. This relies on [ _|_ ] being distinct from _|_. If you for some reason consider this to be strict, you should more precisely define your strictness notion.

Indeed, this is the case! Given any non-constant, commutative function f, you can write a non-strict, non-constant, commutative function by wrapping an application of f in one or more lazy constructors.

于 2020-08-04T22:06:04.963 回答