haskellmode-emacs: Ticket #19: indentation of if..then..else in do block is brokenhttp://trac.haskell.org/haskellmode-emacs/ticket/19
<p>
I was working through the Yet Another Haskell Tutorial, and I noticed that the haskell-mode indentation for one of their examples forces me into making a syntax error.
</p>
<p>
The code in question is seen on this page <a class="ext-link" href="http://en.wikibooks.org/wiki/Haskell/YAHT/Language_basics"><span class="icon">http://en.wikibooks.org/wiki/Haskell/YAHT/Language_basics</span></a> (search for Guess.hs). I will reproduce it here, with its original indentation:
</p>
<pre class="wiki">module Main
where
import IO
import Random
main = do
hSetBuffering stdin LineBuffering
num &lt;- randomRIO (1::Int, 100)
putStrLn "I'm thinking of a number between 1 and 100"
doGuessing num
doGuessing num = do
putStrLn "Enter your guess:"
guess &lt;- getLine
let guessNum = read guess
if guessNum &lt; num
then do putStrLn "Too low!"
doGuessing num
else if guessNum &gt; num
then do putStrLn "Too high!"
doGuessing num
else do putStrLn "You Win!"
</pre><p>
haskell-mode is of the opinion that the 'sole indentation' for the "then" following the "if" in doGuessing is aligned with the "if". However, this indentation results in a syntax error.
</p>
en-ushaskellmode-emacshttp://trac.haskell.org/haskellmode-emacs/chrome/common/trac_banner.pnghttp://trac.haskell.org/haskellmode-emacs/ticket/19
Trac 0.11.1