Re: DoAndIfThenElse
S. Doaitse Swierstra schrieb: [..] \begin{code} main = do if True then putStrLn 1; else putStrLn 2 \end{code} This does also not work with hugs (; at the end) This does not work since now you have two ;'s; one because you wrote one and one because you did not indent the else. Allowing this additional ; was done to prevent confusion, and as you can see even more confusion pops up now;-{{ That is why I expressed my concerns about this grammar patch. Doaitse Indeed, these semicolons are confusing. I think it should be possible to allow then and else starting in the same column as if without these ;s (in a do block). Christian ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
DoAndIfThenElse
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 ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
Re: DoAndIfThenElse
On Thu, Nov 26, 2009 at 10:29 AM, Christian Maeder christian.mae...@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} Isn't the proposal about : \begin{code} main = do if True then putStrLn 1 ;else putStrLn 2 \end{code} ? David. ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
Re: DoAndIfThenElse
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 ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime
Re: DoAndIfThenElse
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 ___ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime