Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: 7stud <bbxx789_05ss <at> yahoo.com>
Subject: Top beginner mistakes
Newsgroups: gmane.comp.lang.haskell.beginners
Date: Wednesday 4th March 2009 21:54:05 UTC (over 8 years ago)
Here are my top three:

1) Putting an equals sign after a function name when using guards:

myfunction x y =
    | x < 2              = "a"
    | y > 20             = "b"
    | otherwise          = "c"


dhask.hs:2:4: parse error on input `|'
Failed, modules loaded: none.



2) Writing "if" in front of the guard conditions:

myfunction x y =
    | if x < 2           = "a"
    | if y > 20          = "b"
    | otherwise          = "c"


dhask.hs:2:25: parse error on input `='
Failed, modules loaded: none.



3) Not putting parentheses around arguments of the form x:xs

dosomething x:xs = head xs

dhask.hs:1:0: Parse error in pattern
Failed, modules loaded: none.


In all three cases, the error messages don't help spot the problem.
 
CD: 3ms