I'm not quite sure, but I'd guess either one of

1.) It does not compile at all because of suspicious indentation
2.) It will just print "A" but not "done" because that is considered beeing in the else-branch.

Johannes Waldmann <johannes.waldmann@htwk-leipzig.de> schrieb am Di., 15. Nov. 2016 um 13:11 Uhr:
Dear Cafe -

Sometimes, a comment can change the meaning of a program.
No? Well, but "commenting out" a line of code certainly does.
So, can you guess what this program will output?

main = do
  if True
    then do
      putStrLn "A"
    else do
      -- putStrLn "B"
  putStrLn "done"

I nominate this for inclusion in a hypothetical
Haskell equivalent of http://www.javapuzzlers.com/

- J.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.