[Haskell-cafe] [Haskell-beginners] ghc --make Vs runhaskell
Kim-Ee Yeoh
ky3 at atamo.com
Wed Feb 4 03:45:07 UTC 2015
Hey Madhu,
Right, this is another gotcha -- haskell has a bunch of them.
As Tristan and Brandon have remarked, the runhaskell interpreter and
compiled programs handle output buffering differently.
Here are changes to make your game work:
On Wed, Feb 4, 2015 at 10:23 AM, Madhu Babu <madhub.bits at gmail.com> wrote:
> import System.Random
> import Control.Monad(when)
>
import System.IO
> main = do
> ranGen <- getStdGen
> let (rand,_) = randomR (1,10) ranGen :: (Int,StdGen)
>
hSetBuffering stdout NoBuffering
> putStr "Guess a number between 1 and 10 : "
>
You might want to take a look at the "Summing Two Numbers" section here:
https://www.haskell.org/onlinereport/io.html
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20150204/0544d3eb/attachment.html>
More information about the Haskell-Cafe
mailing list