On 17-Mar-2000, Malcolm Wallace <[EMAIL PROTECTED]> wrote:
> > 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.
I would suggest that it is not trying hard enough ;-)
Clearly Hugs manages to find a representation for such types.
Why does nhc98 have such difficulty finding a representation
for them? Indeed, pretty much any representation will do.
> 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.
There's a big difference between there being no representation for a type,
and the representation for a type being unspecified. In this case,
the representation is the same as itself, i.e. unspecified.
Note that the Haskell report does not specify how the unit type `()' is
represented either. Does nhc98 reject that too?
--
Fergus Henderson <[EMAIL PROTECTED]> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED] | -- the last words of T. S. Garp.