[Haskell-cafe] Problem about pattern matching.

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu Apr 29 05:00:05 EDT 2010


On Apr 29, 2010, at 04:48 , Magicloud Magiclouds wrote:
> Sorry folks, I did not make it clear. The firstDayOfMonth and
> lastDayOfMonth was defined earlier in let ... in structure.

Doesn't matter.  Pattern matches *create* local bindings; they don't  
pay any attention to existing ones. So you have a match-anything-and- 
bind-to-"firstDayOfMonth" pattern and a match-anything-and-discard  
pattern; the original firstDayOfMonth is hidden by the new one created  
by the pattern match, and since both patterns match the same thing  
(that is, anything) they overlap.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100429/30edff2c/PGP.bin


More information about the Haskell-Cafe mailing list