[Haskell-beginners] A problem with a simple csv file parser

Aleksandar Dimitrov aleks.dimitrov at googlemail.com
Sat Oct 16 04:59:10 EDT 2010


On Sat, 16 Oct 2010 07:23:04 +0200, Andy Elvey  
<andy.elvey at paradise.net.nz> wrote:

> --  A simple csv parser Module parseCSV where
> import Text.ParserCombinators.Parsec

That's your problem. I'm assuming the newline got chomped up, so your  
source file reads
--A simple csv parser
Module parseCSV where

That's wrong. Module is *not* to be capitalized, the module *name*,  
however, *is*. Change it to:

module ParseCsv where

Runhaskell should be absolutely fine running it that way, no need to  
remove the module name. GHC (the compiler itself) on the other hand, will  
just not produce a binary as long as your module name isn't "Main."

% runhaskell Test.hs                                                   ~
"Hello"
% ghc --make -O2 -o Test Test.hs                                       ~
Warning: output was redirected with -o, but no output will be generated
because there is no Main module.
% cat Test.hs                                                          ~
module Test where

main = print "Hello"


Most programs will typically have a File "Main.hs" which does all the  
duties of a main executable.

Best wishes,
Aleks


More information about the Beginners mailing list