While just writing 33 instead of length [1..33] saves an awful lot of bother, the function you'd probably want in similar circumstances is `fromIntegral`
See the Prelude. Also, you can use Data.ByteString.head instead of unpack and then Data.List.head rollDice :: Word8 -> IO Word8 rollDice n = do bracket (openFile "/dev/random" ReadMode) hClose (\hd -> do v <- fmap B.head $ B.hGet hd 1 return $ (v `mod` n) + 1) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe