Created
May 1, 2019 04:10
-
-
Save jmikkola/2df51178bda7f04f463950098fb751a4 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
import System.IO (hFlush, stdout) | |
main :: IO () | |
main = do | |
putStr "enter a number> " | |
hFlush stdout | |
line <- getLine | |
runNested (read line) True | |
-- a will be the type Bool wrapped in a List n times by the end | |
runNested :: (Show a) => Int -> a -> IO () | |
runNested 0 val = putStrLn $ show val | |
runNested n val = runNested (n - 1) [val] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment