[Haskell-beginners] Parse error in pattern

Florian Duret flo.morphe at gmail.com
Fri Feb 26 11:29:34 EST 2010


I try to set up a verification on the number of arguments given to my
program, but keep on getting "Parse error in pattern"

Here is what my code looks like:

main :: IO()
main = do
    -- On commence par ouvrir le fichier SAC en mode binaire
    argsList <- getArgs
    if (length (argsList) == 0)
       then do
             putStrLn $ "No filename given to the program.\n $ ProgramName
             return ()
             sacFile1 <- openBinaryFile fileToOpen ReadMode

ghci complains, and tells "Parse error in pattern", indicating the 'if' line

Can you please help ?
Thank you very much,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100226/7dd881a8/attachment.html

More information about the Beginners mailing list