[Haskell-cafe] What does "1 = 2" mean in Haskell?

Taeer Bar-Yam taeer at necsi.edu
Fri Feb 24 07:08:25 UTC 2017

I think the usefulness of numeric / string literals as pattern matches is as
part of larger matches (as someone mentioned), not by itself. But since (I
assume) these things are defined recursively, it makes sense just to add it as a
base-level pattern match.

Furthermore, you would not want
main = let 1 = 2 in print "foo"
to error, since the pattern match is unused, and haskell is a lazy language.
Really, though, we probably shouldn't be putting incomplete pattern matches in
our code :P


More information about the Haskell-Cafe mailing list