Strange error in show for datatype

Simon Peyton-Jones [email protected]
Thu, 4 Oct 2001 06:05:16 -0700


| > My claim was that
| >=20
| >         forall a. Show a =3D> T
| >=20
| > could be implemented by passing a bottom dictionary for Show.
|=20
| Excuse me, but Jan-Willem Maessen has already shown that this=20
| implementation can give unexpected results.=20

Yes, I was quite wrong about that.  How embarassing.

But there's still something lurking there.  Consider:

	data T a =3D T1 Int | T2 a

It's clear that (T1 Int) has no a's in it, not even bottom.  Mark
Shields
and ruminated in the corridor about a kind system to make this apparent.
That is, T1 would have type

	T1 :: forall a::Pure .  Int -> T a

Then if we see (forall a::Pure. Show a =3D> <type>)
we're justified in fixing a to Empty.   You need a sub-kinding system to
make
this work, so the cost has just gone up.  My implemention mood has
suddenly past.

Isn't laziness wonderful?

Simon