[Haskell-cafe] Parsec Question

Gerd M gerd_m1977 at hotmail.com
Mon Jan 9 06:52:12 EST 2006


I'm trying to use parsec for parsing a custom input stream. As far as I 
understood the manual correctly I need to define the primitive parser:

type MyParser a   = GenParser (SourcePos,Tok) () a
mytoken :: (Tok -> Maybe a) -> MyParser a
mytoken test
  = token showToken posToken testToken
  where
    showToken (pos,tok)   = show tok
    posToken  (pos,tok)   = pos
    testToken (pos,tok)   = test tok

The problem is, since SourcePos is an abstract datatype, how can I actually 
run this parser without explicitly using values of type SourcePos in the 
input stream?

Many thanks in advance!

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



More information about the Haskell-Cafe mailing list