> The Haskell report explicitly allows recursive newtype definitions.
> So why is it reasonable for a compiler to reject them?

nhc98 rejects circular newtypes which are semantically bottom, like
    newtype Void = Void Void
    newtype A = A B
    newtype B = B A
because it cannot find a representation for them.

nhc98 accepts recursive newtypes which have semantic content, like
    newtype Inftype b = A (b,Inftype b)
    newtype Alist a = B (Either () (a,Alist a))
because it can find a representation for them.

What is unreasonable about that?

> But I think the issue here is conformance, and I think it is
> clear that nhc98 does not conform to the specification in the
> Haskell 98 Report.

Well, I'm not sure that the specification is entirely clear on this
point.  It states that a newtype uses the same representation as the
type it renames.  nhc98 claims that if there is no representation for
the type, it can't continue.

Regards,
    Malcolm

Reply via email to