
4 Mar
2009
4 Mar
'09
4:54 p.m.
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.