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

Brandon Allbery allbery.b at gmail.com
Fri Feb 24 02:07:42 UTC 2017


On Thu, Feb 23, 2017 at 9:05 PM, Harendra Kumar <harendra.kumar at gmail.com>
wrote:

> Kids have this amazing ability to break any toy in minutes. I gave my
> seven year old daughter ghci to play with and in a little while she said it
> is broken:
>
> >> let 1 = 2
>
> >> 1
>
> 1
>
> >>
>
> Earlier, I had explained to her about symbols and assigning values to
> symbols, and I said numbers are not symbols. But when she came up with this
> I could not explain what's going on. How can "1 = 2" be a valid equation?
> Am I missing something fundamental here, or it is just broken?
>
It's a pattern match. The match fails, but as it produced no bindings it
cannot be observed and its success or failure is irrelevant.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170223/2ecd3191/attachment.html>


More information about the Haskell-Cafe mailing list