[Haskell-cafe] Re: Type classes and type equality

Stefan O'Rear stefanor at cox.net
Tue Apr 17 21:25:07 EDT 2007


On Wed, Apr 18, 2007 at 01:47:04AM +0100, Neil Mitchell wrote:
> >- If we permit undecidable instances, one may assign numerals to
> >types. This gives us total order and hence comparison on types.
> >In this approach, we only need N instances to cover N types. This is
> >still better than Typeable because the equality is decided and can be
> >acted upon at compile time.
> 
> In my particular case whether I act at compile time or run time is
> unimportant, but obviously this is an important advantage in general.
> Unfortunately a cost of one instance per type is still higher than I'd
> like to pay :-)

Now, it requires one line of code:

{-# OPTIONS_DERIVE --derive=TTypeable #-}

Stefan


More information about the Haskell-Cafe mailing list