<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The answer is very simple ;-} The report says that after a do the first symbol to encounter determines the indentation level; so putStrLn “done” is part of the else branch. Obvious, isn’t it.<div class=""><br class=""></div><div class="">Se also <a href="https://wiki.haskell.org/Common_Misunderstandings" class="">https://wiki.haskell.org/Common_Misunderstandings</a></div><div class=""><br class=""></div><div class=""> Doaitse<br class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">Op 15 nov. 2016, om 13:31  heeft Norbert Melzer <<a href="mailto:timmelzer@gmail.com" class="">timmelzer@gmail.com</a>> het volgende geschreven:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I'm not quite sure, but I'd guess either one of<div class=""><br class=""></div><div class="">1.) It does not compile at all because of suspicious indentation</div><div class="">2.) It will just print "A" but not "done" because that is considered beeing in the else-branch.</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">Johannes Waldmann <<a href="mailto:johannes.waldmann@htwk-leipzig.de" class="">johannes.waldmann@htwk-leipzig.de</a>> schrieb am Di., 15. Nov. 2016 um 13:11 Uhr:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Cafe -<br class="gmail_msg">
<br class="gmail_msg">
Sometimes, a comment can change the meaning of a program.<br class="gmail_msg">
No? Well, but "commenting out" a line of code certainly does.<br class="gmail_msg">
So, can you guess what this program will output?<br class="gmail_msg">
<br class="gmail_msg">
main = do<br class="gmail_msg">
  if True<br class="gmail_msg">
    then do<br class="gmail_msg">
      putStrLn "A"<br class="gmail_msg">
    else do<br class="gmail_msg">
      -- putStrLn "B"<br class="gmail_msg">
  putStrLn "done"<br class="gmail_msg">
<br class="gmail_msg">
I nominate this for inclusion in a hypothetical<br class="gmail_msg">
Haskell equivalent of <a href="http://www.javapuzzlers.com/" rel="noreferrer" class="gmail_msg" target="_blank">http://www.javapuzzlers.com/</a><br class="gmail_msg">
<br class="gmail_msg">
- J.<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Haskell-Cafe mailing list<br class="gmail_msg">
To (un)subscribe, modify options or view archives go to:<br class="gmail_msg">
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" class="gmail_msg" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br class="gmail_msg">
Only members subscribed via the mailman list are allowed to post.</blockquote></div>
_______________________________________________<br class="">Haskell-Cafe mailing list<br class="">To (un)subscribe, modify options or view archives go to:<br class=""><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br class="">Only members subscribed via the mailman list are allowed to post.</div></blockquote></div><br class=""></div></div></div></body></html>