Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

God damn Haskell

Name: Anonymous 2008-07-13 8:35


import IO

main :: IO ()
main = do
        putStr "Name: "
        n <- getLine
        putStrLn n


/prog/, why doesn't this code work? I understand laziness, so "n" won't be evaluated until it's needed in "putStrLn", but why does "n" get evaluated, then "putStr" and "putStrLn" get evaulated?

tl;dr How the hell do you prompt for information in Haskell?

Name: Anonymous 2008-07-13 13:14

Your age doesn't matter on the Internet. Your life has no impact on how people perceive you here. You might lead a successful life, you might be a beggar. You're not how much money you have in the bank. You're not the car you drive. You're not the contents of your wallet. If you act like a kid, you are kid.

Grow up, kid.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List