Created
January 2, 2015 11:55
-
-
Save shigemk2/7bb941136a1485bfa82d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE UnboxedTuples #-} | |
import GHC.Base | |
import System.Random | |
dice = getStdRandom $ randomR (1, 6) :: IO Int | |
main = IO $ \s -> | |
let (# s1, d #) = unIO (dice) s | |
(# s2, r #) = unIO (print d) s1 | |
in (# s2, r #) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment