
14 Oct
2011
14 Oct
'11
4:08 p.m.
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).