From: Duncan C. <dun...@wo...> - 2005-05-09 10:35:03
|
On Mon, 2005-05-09 at 08:55 +0100, Axel Simon wrote: > > so it goes wrong. c2hs generates that enum instance code and provides > > C2HSMarsh.extractBitMasks which has the same bug. So it's a c2hs bug > > too. So toFlags/C2HSMarsh.extractBitMasks must have gone unused for the > > last 5 years! > > Oh dear, that's probably my fault since I suggested adding the Flags to > Manuel. How scary that nobody ever used functions that return flags... Well I've fixed it like so (it's comitted to CVS already): toFlags :: Flags a => Int -> [a] toFlags f = testBits f 1 where testBits f n | f == 0 = [] | f `testBit` 0 = toEnum n : testBits (f `shiftR` 1) (n `shiftL` 1) | otherwise = testBits (f `shiftR` 1) (n `shiftL` 1) Which seems ok to me and seems to work. Perhaps we should tell Manuel. Actually, I don't suppose it's so suprising the no-one used a function that returns flags. There are actually very few of them it Gtk. I know I've never used any function which uses flags. And I guess that usually they are attributes that you set but never need to get. And other comments on your TODO list items? I recall that we hadn't quite come to a conclusion about the Pixbuf stuff or onExposeRegion. Duncan |