bug in 6.8.2?

Bulat Ziganshin bulat.ziganshin at gmail.com
Sun May 18 11:33:02 EDT 2008

Hello glasgow-haskell-users,

i've rather complicated class structure:

class BufferData a where
instance (FastBufferData a) => BufferData a where

class FastBufferData a where
instance (Storable a) => FastBufferData a where

of course, it's compiled with -fallow-undecidable-instances
-fallow-overlapping-instances -fallow-incoherent-instances

BufferData class includes procedure `write`:

class BufferData a where
  write :: OutStream -> a -> IO ()

there is writeAll procedure which uses this `write` and therefore
should be able to write any BufferData instance:

writeAll receiveBuf sendBuf cleanup x =
  bracket (create receiveBuf sendBuf cleanup) (closeOut)
    (\buf -> write buf x)

it works great in 6.6.1 but in 6.8.2 GHC infers that writeAll can
write only Storable instances, so i was forced to add signature to

writeAll :: (BufferData a) =>  RecvBuf -> SendBuf -> Cleanup -> a -> IO ()

the same problems raised many times when i switched from 6.6.1 to
6.8.2 - lots of procedures need to add signatures because by default
6.8.2 decided that they are restricted to Storable

does GHC developers interested in minimal test case for this problem?

Best regards,
 Bulat                          mailto:Bulat.Ziganshin at gmail.com

More information about the Glasgow-haskell-users mailing list