[Haskell-cafe] Parsec question

Erik de Castro Lopo mle+cl at mega-nerd.com
Tue Dec 23 04:12:20 EST 2008

Hi all,

I'm rather new  to  Haskell and I'm diving right into the deep end
writing a parser using Parsec.

In particular I'm using Text.ParserCombinators.Parsec.Language to do
some of the heavy lifting and have this:

    import qualified Text.ParserCombinators.Parsec.Language as L
    import qualified Text.ParserCombinators.Parsec.Token as T

    lexer = T.makeTokenParser L.emptyDef
	{	L.identStart = letter <|> char '_',
		L.identLetter = alphaNum <|> char '_',


    identifier :: CharParser st String
    identifier = T.identifier lexer

and now I need to parse things "this.that.the.other". I'd like to have
a function with the following signature:

    qualifiedIdentifier :: CharParser st [ String ]

which should return [ "this", "that", "the", "other" ] and write it in
terms of identifier and thats where I'm stuck.

Anyone care to whack me with the cluestick?

Erik de Castro Lopo
"If you don't have freedom as a principle, you can never see a reason not
to make an exception." -- Richard Stallman.

More information about the Haskell-Cafe mailing list