import Data.Char main = guess 1 10 query ot = do putStr ot ans <- getLine pure (ans == "ano") guess :: Int -> Int -> IO () guess m n = do putStrLn ("Mysli si cele cislo od " ++ show m ++ " do " ++ show n ++ ".") kv m n kv m n = do if m == n then putStrLn ("Je to " ++ show m ++ ".") else do o <- query $ "Je tve cislo vetsi nez " ++ show k ++ "? " if o then kv (k + 1) n else kv m k where k = (m + n) `div` 2