[Haskell-cafe] what's the definition of "satisfy" and "" ?

2009-05-20 Thread z_a...@163.com
I cannot understand the following code very well as i donot know the definition of "satisfy" and "". -- | Case-insensitive variant of Parsec's 'char' function. caseChar:: Char -> GenParser Char a Char caseChar c = satisfy (\x -> toUpper x == toUpper c) -- | Case-insensitive varian

[Haskell-cafe] How i use GHC.Word.Word8 wit Int ?

2009-05-19 Thread z_a...@163.com
Hi, friends rollDice :: Word8 -> IO Word8 rollDice n = do bracket (openFile "/dev/random" ReadMode) (hClose) (\hd -> do v <- fmap B.unpack (B.hGet hd 1) let v1 = Data.List.head v return $ (v1 `mod` n) + 1) . blueIdx <- rollDice $ length [1..33]