Malcolm Wallace wrote:
> 
> > >     class ShowType a where
> > >         showType :: a -> String
> >
> > Or you can do what hbc has done for donkey's years and
> > include 'showType' in Show.
> 
> Incidentally, nhc98 also has had 'showType' in class Show since the
> year dot - only Hugs and ghc lack it.  (Does anyone know why this
> idea didn't make it into Haskell'98?)
Er, I may be missing something, but for ghc and hugs, why not use
the Typeable class?  If implemented for the type, that will give
you a typeOf :: a -> TypeRep.  TypeRep is an instance of Show so
that you can turn it into a string if you want to.  I like the
idea of having TypeRep not a String, since it means the optimisation
can be optimised, so that for example you can compare TypeRep's very
easily.

Reply via email to