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

2004-11-08 Thread Simon Peyton-Jones
| instance Typeable a = Typeable (MVar a) where | typeOf x = | mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::a)] As I think you now know, the above declaration is fine if you use -fglasgow-exts. Haskell 98 does not support lexically scoped type variables, but GHC

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

2004-11-05 Thread Benjamin Franksen
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. Cheers, Ben ___ Haskell-Cafe

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

2004-11-05 Thread Tomasz Zielonka
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

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

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 15:51, you wrote: 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

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

2004-11-05 Thread MR K P SCHUPKE
nstance Typeable a = Typeable (MVar a) where typeOf (x::x) = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::x)] Keean. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 16:20, MR K P SCHUPKE wrote: nstance Typeable a = Typeable (MVar a) where typeOf (x::x) = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::x)] I may be missing something but this look like an open recursion to me. The type 'x' is 'MVar a',

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

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 13:57, 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. Ok, I found a

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

2004-11-05 Thread Koji Nakahara
On Fri, 5 Nov 2004 14:43:55 +0100 Benjamin Franksen [EMAIL PROTECTED] wrote: snip the instances by hand. My first attempt was: instance Typeable a = Typeable (MVar a) where typeOf x = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::a)] but unfortunately this

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

2004-11-05 Thread MR K P SCHUPKE
My mistake: instance Typeable a = Typeable (MVar a) where typeOf (x::MVar x) = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf (undefined::x)] Keean. ___ Haskell-Cafe mailing list [EMAIL PROTECTED]

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

2004-11-05 Thread Benjamin Franksen
On Friday 05 November 2004 15:07, Benjamin Franksen wrote: instance Typeable a = Typeable (MVar a) where typeOf x = mkAppTy (mkTyCon Control.Concurrent.MVar.MVar) [typeOf y] where y = unsafePerformIO $ do z - newEmptyMVar = readMVar return (z `asTypeOf` x)

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

2004-11-05 Thread Remi Turk
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.