
Hi, seeing Haskell 2010 and http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse saying: Compiler support ¶ GHC full (no flag) I wonder why I still get a "parse error (possibly incorrect indentation)" for: \begin{code} main = do if True then putStrLn "1" else putStrLn "2" \end{code} Can I try out this feature somehow? Cheers Christian

On Thu, Nov 26, 2009 at 10:29 AM, Christian Maeder wrote: I wonder why I still get a "parse error (possibly incorrect indentation)" for: \begin{code}
main = do
if True then putStrLn "1"
else putStrLn "2"
\end{code} Isn't the proposal about :
\begin{code}
main = do
if True then putStrLn "1"
;else putStrLn "2"
\end{code}
?
David.

David Virebayre schrieb:
Isn't the proposal about :
\begin{code} main = do if True then putStrLn "1" ;else putStrLn "2" \end{code}
This should go through, too, but also does not for me according to http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse <cite> Change the syntax for conditionals to exp -> if exp1 [;] then exp2 [;] else exp3 i.e., add optional semicolons before then and else, making the above example legal. This has been recently added to jhc, GHC and Hugs, and so far it has not caused any problems. </cite> But the main purpose of the proposal was to support the notation without ";" and the indentation by at least one character. I just do not see that it "has been recently added to GHC" I've checked ghc-6.10.4 and 6.12.0.20091010 Cheers Christian

David Virebayre schrieb:
On Thu, Nov 26, 2009 at 10:29 AM, Christian Maeder
mailto:Christian.Maeder@dfki.de> wrote: I wonder why I still get a "parse error (possibly incorrect indentation)" for:
\begin{code} main = do if True then putStrLn "1" else putStrLn "2" \end{code}
This works with hugs!
Isn't the proposal about :
\begin{code} main = do if True then putStrLn "1" ;else putStrLn "2" \end{code}
This does not work with hugs. ";" must be indented further. \begin{code} main = do if True then putStrLn "1"; else putStrLn "2" \end{code} This does also not work with hugs (";" at the end) C.

On Thu, Nov 26, 2009 at 03:14:13PM +0100, Christian Maeder wrote:
David Virebayre schrieb:
On Thu, Nov 26, 2009 at 10:29 AM, Christian Maeder
mailto:Christian.Maeder@dfki.de> wrote: I wonder why I still get a "parse error (possibly incorrect indentation)" for:
\begin{code} main = do if True then putStrLn "1" else putStrLn "2" \end{code}
This works with hugs!
Isn't the proposal about :
\begin{code} main = do if True then putStrLn "1" ;else putStrLn "2" \end{code}
This does not work with hugs. ";" must be indented further.
\begin{code} main = do if True then putStrLn "1"; else putStrLn "2" \end{code}
This does also not work with hugs (";" at the end)
In both cases you have 2 semi-colons before the else (after the layout rule has been applied). Thanks Ian

Hi Christian, On Thu, Nov 26, 2009 at 10:29:10AM +0100, Christian Maeder wrote:
seeing Haskell 2010 and http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse
saying: Compiler support ¶ GHC full (no flag)
I wonder why I still get a "parse error (possibly incorrect indentation)" for:
\begin{code} main = do if True then putStrLn "1" else putStrLn "2" \end{code}
Can I try out this feature somehow?
I can't see any support for it in GHC, even in the HEAD. The page claims "full (no flag)" for every implementation, so I'd guess it's just a boilerplate table that hasn't been properly filled in. Thanks Ian
participants (3)
-
Christian Maeder
-
David Virebayre
-
Ian Lynagh