Skip to content

Instantly share code, notes, and snippets.

@jmikkola
Created May 1, 2019 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmikkola/2df51178bda7f04f463950098fb751a4 to your computer and use it in GitHub Desktop.
Save jmikkola/2df51178bda7f04f463950098fb751a4 to your computer and use it in GitHub Desktop.
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