[Haskell-beginners] help me with eroor

Daniel Fischer daniel.is.fischer at googlemail.com
Fri Oct 14 22:08:21 CEST 2011


On Friday 14 October 2011, 21:59:22, kolli kolli wrote:
> import Text.ParserCombinators.Parsec
> 
> csvFile = endBy line eol
> line = sepBy cell (char ',')
> cell = many (noneOf ",\n")
> eol = char '\n'
> 
> parseCSV :: String -> Either ParseError [[String]]
> parseCSV input = parse csvFile "(unknown)" input
> 
> *showing error:
> <interactive>:1:32: Not in scope: `main'
> *

If you don't have a module declaration in your file, it is assumed to be

module Main (main) where

thus, if there's no main function, compilation fails.

Include a module declaration in your file,

module Whatever (parseCSV, csvFile, line, cell, eol) where

(the export list is optional, if you omit it, all top-level declarations 
are exported).



More information about the Beginners mailing list