am I going to post things I made in Haskell frequently now?

import System.Random

ask :: Int -> IO ()
ask x = getLine >>= lessOrMore x . read
    where
    lessOrMore :: Int -> Int -> IO ()
    lessOrMore x inp
        | x < inp = do
            putStrLn "Your number is smaller than mine."
            ask x
        | x > inp = do
            putStrLn "Your number is larger than mine."
            ask x
        | otherwise = putStrLn "You got it!"

main = do
    rng <- getStdGen
    let number = fst $ randomR (1, 10) rng
    putStrLn "Think of a number around 1 to 10."
    ask number

oh well.

comments