Does Haskell have variables?

前端 未结 5 1069
鱼传尺愫
鱼传尺愫 2020-12-03 01:05

I\'ve frequently heard claims that Haskell doesn\'t have variables; in particular, this answer claims that it doesn\'t, and it was upvoted at least nine times and accepted.<

5条回答
  •  再見小時候
    2020-12-03 01:26

    The simple answer is: yes, Haskell has variables as defined in Section 3.2 of the Haskell Report. Variables can appear in patterns and can thus be bound to a value using constructs like let, case, and list comprehensions.

    Perhaps implicit in your questions is whether a variable is properly called a variable if it is immutable. I think the other answers cover mutability sufficiently.

提交回复
热议问题