[Haskell-cafe] Convert IO Int to Int
Tobias Olausson
tobsan at gmail.com
Tue Jun 9 06:33:09 EDT 2009
You can not convert an IO Int to Int, or at least, you shouldn't.
However, you can do as follows:
test :: IO ()
test = do
int <- randomRIO -- or whatever it is called
print $ useInt int
useInt :: Int -> Int
useInt x = x+10
//Tobias
2009/6/9 ptrash <ptrash at web.de>:
>
> Hi,
>
> I am using the System.Random method randomRIO. How can I convert its output
> to an Int?
>
> Thanks...
> --
> View this message in context: http://www.nabble.com/Convert-IO-Int-to-Int-tp23940249p23940249.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Tobias Olausson
tobsan at gmail.com
More information about the Haskell-Cafe
mailing list