[Haskell-cafe] Making MVar and Chan Instances of Typeable

Tomasz Zielonka tomasz.zielonka at gmail.com
Fri Nov 5 09:51:04 EST 2004

On Fri, Nov 05, 2004 at 01:57:53PM +0100, Benjamin Franksen wrote:
> Hello Experts,
> I need MVar and Chan to be instances of Typeable. Any hint on how this is most 
> easily done would be greatly appreciated. I could change the libraries and 
> add 'deriving Typeable' but I hesitate to do so.

The easiest way is to hide type constructor Chan:

  import Control.Concurrent
  import Data.Generics

  newtype MyChan a = MyChan (Chan a) deriving Typeable

Of course, you can also write the instance for Chan by hand.

Best regards,

.signature: Too many levels of symbolic links

More information about the Haskell-Cafe mailing list