[Haskell-cafe] what is wrong w my IORef Word32 ?

2013-07-18 Thread Joerg Fritsch
All, what is wrong w the below code? I get an type error related to the operation shiftL import Data.Bits import Data.Word import Data.IORef data Word32s = Word32s { x :: IORef Word32 } bitfield :: Word32 bitfield = 0 mkbitfield :: Word32 -> IO Word32s mkbitfield i = do the_bf <- newIORef i

Re: [Haskell-cafe] what is wrong w my IORef Word32 ?

2013-07-18 Thread Edward Z. Yang
shiftL has the wrong type: Bits a => a -> Int -> a so it is expecting the value in the IORef to be an Int. Edward Excerpts from Joerg Fritsch's message of Thu Jul 18 10:08:22 -0700 2013: > All, what is wrong w the below code? > > I get an type error related to the operation shiftL > > import D

Re: [Haskell-cafe] what is wrong w my IORef Word32 ?

2013-07-18 Thread Joerg Fritsch
Can I easily fix the modifyIORef statement by swapping "something" ? --Joerg On Jul 18, 2013, at 7:19 PM, "Edward Z. Yang" wrote: > shiftL has the wrong type: Bits a => a -> Int -> a > so it is expecting the value in the IORef to be an Int. > > Edward > > Excerpts from Joerg Fritsch's message

Re: [Haskell-cafe] what is wrong w my IORef Word32 ?

2013-07-18 Thread Taylor Hedberg
Joerg Fritsch, Thu 2013-07-18 @ 19:22:46+0200: > Can I easily fix the modifyIORef statement by swapping "something" ? > --Joerg Replace `shiftL` with `flip shiftL` and change the type signature of `sLbitfield` to take an Int instead of an Integer. signature.asc Description: Digital signature ___