[Haskell-cafe] Re: Lazy Parsing
stephen.tetley at gmail.com
Sun May 31 08:41:47 EDT 2009
I suspect the problem you were having is that there are various
'parsers' (more correctly 'parser types') defined in
Text.ParserCombinators.UU.Parsing and the code you had in your running
example didn't always have enough information to allow GHC to pick a
The /test/ function in Examples demands the parser to be of type 'P_m
state a' , so if you were running your parsers with /test/ in your
main function this would be give the parsers a concrete, inferable
type (if you hadn't given then a type signature). Once you comment out
main, the parsers have a more general type than 'P_m state a', which
can't be inferred due to class constraints.
Maybe the 'haskeller's inituition' in this instance is to define the
type signatures and the functions at the same time, admittedly this
can be difficult for functions with heavy use of type classes.
 I'm afraid I don't know the intricacies of the particular types in
the new UU parsing library, until this morning I'd only used the
previous version in uulib.
2009/5/31 Guenther Schmidt <gue.schmidt at web.de>:
> Dear Doaitse,
> thank you very much for your help.
>> I am curious to know what made you go wrong with the tutorial, and caused
>> that you could not find the solution below?
> Well let's first agree that I'm not very bright. I hate to admit it, but
> it's a simple fact ;-).
> Second let's agree that the uu-parsinglib is a *very* sophisticated beast, I
> have not seen anything else like it out there, my sincere congratulations
> for it. Thirdly the tutorial is also a very sophisticated beast, and
> forthly, well just see point 1 :-).
> And I just figured out why I was unable to write even that simple parser.
> The code you sent me works just fine, I copied and pasted it, no problems.
> But, as soon as I comment out the "main" function the type checker
> complains, because now the ghci's type checker can no longer infer the types
> of pDate or pDot. And this is exactly what happened. I kept getting error
> messages from ghci, eventhough I had defined my parsers possible correctly,
> but, *minus* the type signatures *and* minus any main function that called
> In hindsight I realize that this is a trap I have walked into many times
> before, I guess I still have not acquired a Haskellers intuition.
> I promise to do better next time :)
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe