> Using Hugs1.3c with p1, the system crashes typechecking the
> following program.
[..]
> >type FN = Fix N
[..]
> >instance (HasParser x) => HasParser (N x) where
> > parser = [Num 3]
> >
> >instance HasParser (f (Fix f)) => HasParser (Fix f) where
> > parser = map In parser
[..]
> >parserFN::Parser FN
> >parserFN = parser
And so it should. Let's see what happens:
1. parserFN typechecks if there's an instance (HasParser FN); this is
a type synonym so we're really looking for (HasParser (Fix N)).
2. This matches the second rule; so we are now looking for the context
to that rule, namely (HasParser (N (Fix N))).
3. *This* in turn matches the first rule, and so we are now looking
for its context, namely (HasParser (Fix N)).
4. Repeat from step 2 until the system crashes.
I don't see why you need the context in the first rule... you never
use (HasParser x) in the definition of parser. If you delete this
context, then the example should work fine.
--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] :
:----------------------------------------------------------------------: