
What other imports must I add to get this to run. I can't seem to get it right. Michael ========= import Text.ParserCombinators.Parsec.Prim main = case (parse numbers "" "11, 2, 43") of Left err -> print err Right xs -> print (sum xs) numbers = commaSep integer ============== [michael@sabal ~]$ ghc --make parsetest.hs[1 of 1] Compiling Main ( parsetest.hs, parsetest.o ) parsetest.hs:7:11: Not in scope: `commaSep' parsetest.hs:7:20: Not in scope: `integer'[michael@sabal ~]$

I suggest you install hoogle or use the web interface as it can easily
answer such questions for you:
http://www.haskell.org/hoogle/?hoogle=commaSep
http://www.haskell.org/hoogle/?hoogle=integer+%2bparsec
Cheers,
Thomas
On Sun, Aug 7, 2011 at 11:44 AM, michael rice
What other imports must I add to get this to run. I can't seem to get it right.
Michael
=========
import Text.ParserCombinators.Parsec.Prim
main = case (parse numbers "" "11, 2, 43") of Left err -> print err Right xs -> print (sum xs)
numbers = commaSep integer
==============
[michael@sabal ~]$ ghc --make parsetest.hs [1 of 1] Compiling Main ( parsetest.hs, parsetest.o )
parsetest.hs:7:11: Not in scope: `commaSep'
parsetest.hs:7:20: Not in scope: `integer' [michael@sabal ~]$
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 11-08-07 02:44 PM, michael rice wrote:
What other imports must I add to get this to run. I can't seem to get it right. [...] import Text.ParserCombinators.Parsec.Prim
main = case (parse numbers "" "11, 2, 43") of Left err -> print err Right xs -> print (sum xs)
numbers = commaSep integer
The problem is deeper than imports. import Text.Parsec.Prim(parse) import Text.Parsec.Token(makeTokenParser, GenTokenParser(TokenParser, commaSep, integer)) import Text.Parsec.Language(emptyDef) main = case (parse numbers "" "11, 2, 43") of Left err -> print err Right xs -> print (sum xs) numbers = c i where TokenParser{commaSep=c, integer=i} = makeTokenParser emptyDef

Thanks, Albert.
The code is from this page, just below the definition of parse:
http://hackage.haskell.org/packages/archive/parsec/latest/doc/html/Text-Pars...
Michael
--- On Sun, 8/7/11, Albert Y. C. Lai
What other imports must I add to get this to run. I can't seem to get it right. [...] import Text.ParserCombinators.Parsec.Prim
main = case (parse numbers "" "11, 2, 43") of Left err -> print err Right xs -> print (sum xs)
numbers = commaSep integer
The problem is deeper than imports. import Text.Parsec.Prim(parse) import Text.Parsec.Token(makeTokenParser, GenTokenParser(TokenParser, commaSep, integer)) import Text.Parsec.Language(emptyDef) main = case (parse numbers "" "11, 2, 43") of Left err -> print err Right xs -> print (sum xs) numbers = c i where TokenParser{commaSep=c, integer=i} = makeTokenParser emptyDef _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Albert Y. C. Lai
-
michael rice
-
Thomas DuBuisson