Suppose I have some parser 'p'. I want to parse it as well as get its
span in the text. So I could write

\begin{code]
pWithLocation = do
  loc_start <- getPosition
  pval <- p
  loc_end <- getPosition
  return (pval,loc_start,loc_end)
\end{code}

except that loc_end gives me the location _after_ 'p'. In case when 'p'
has consumed trailing newline I see no way to recover the end location
of 'p' (it is the last column of the previous line).

So, can I do anything with this without patching parsec?

I use parsec3 if it matters.

-- 
Roman I. Cheplyaka :: http://ro-che.info/
"Don't let school get in the way of your education." - Mark Twain
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to