[Haskell-beginners] Re: Top beginner mistakes

Benjamin L.Russell DekuDekuplex at Yahoo.com
Thu Mar 5 06:08:08 EST 2009


Those are excellent examples!

I have just added them to HaskellWiki on the following page, and
credited them to you:

Common Misunderstandings - HaskellWiki
http://www.haskell.org/haskellwiki/Common_Misunderstandings

Good work!

-- Benjamin L. Russell

On Wed, 4 Mar 2009 21:54:05 +0000 (UTC), 7stud
<bbxx789_05ss at yahoo.com> wrote:

>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.
-- 
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
"Furuike ya, kawazu tobikomu mizu no oto." 
-- Matsuo Basho^ 



More information about the Beginners mailing list