> The example is simplified, but I need it. 

Can you email me all your code (directly, not to the list)?  I'd like
to have a look and see if I can see a solution.

> You justify the error but I think that the Hugs interpreter should 
> not crash. IMO, It would be better that the system could detect the 
> circular declarations and report the error to the programmer. 

Yes, but Hugs 1.3c is explicitly marked `experimental'.  Detecting
circular declarations is non-trivial exercise, as my recent note
exemplifies
(http://www.dcs.gla.ac.uk/~keithw/research/misc/undec.html).

> By the way, P. Azero has suggested to add:
> 
> > parserFN :: HasParser (Fix N) => Parser FN
> 
> Now, the program type checks but Hugs crashes when I call:
> 
> ? parserFN

Here you are simply deferring the erroneous bit of type checking until
later on.

> PS. I have been able to bypass the problem adding a new class:
> 
> >class HasParserF f where
> > parserF::Parser x -> Parser (f x)
> >
> >instance (HasParser x) => HasParser (N x) where 
> > parser = parserN parser
> >
> >instance HasParserF N where parserF parser = ...
> >
> >instance (HasParserF f) => HasParser (Fix f) where
> > parser = map In (parserF parser)
> >
> >parserFN::Parser (Fix N)
> >parserFN = parser
> 
> But it looks a little ugly :(

I can't tell what this does without the "..." you left out: what is
the type of the argument `parser' to parserF?

--KW 8-)
-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) -------------------------:
: PhD Student, Computing Science, University of Glasgow, Scotland.     :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.     :
: http://www.dcs.gla.ac.uk/~keithw/  mailto:[EMAIL PROTECTED]       :
:----------------------------------------------------------------------:

Reply via email to