[Haskell-cafe] Parsing error in Haskell2010

Matteo Ferrando matteo.ferrando2 at gmail.com
Wed Nov 19 05:16:30 UTC 2014


> This seems to be the issue. Haskell98 didn't require this, Haskell2010
does, and this seems less desirable to me. Isn't it reasonable to assume
that the it's the do that dominates syntactically here, and not the let?

No, so you can do stuff like:

    main = do
        gen <- getStdGen
        let log = runModel gen $ do
                initialize 72
                report
                replicateM_ 50 $ do
                    replicateM_251 migrate
                    report
            log' = runModel gen $ do
                initialize 42
                report
                replicateM_ 50 $ do
                    replicateM_251 migrate
                    report
            log'' = runModel gen $ do
                initialize 42
                report
                replicateM_ 50 $ do
                    replicateM_251 migrate
                    report
        putStr . format $ log
        putStr . format $ log'
        putStr . format $ log''

Defining `log`, `log'` and `log''` with the same `let`.

Cheers,

Matteo


On Tue, Nov 18, 2014 at 3:01 PM, Stuart A. Kurtz <stuart at cs.uchicago.edu>
wrote:

> Dear Andy,
>
> > If that is the actual indentation in the file (and not just one or both
> of our mail clients breaking it), the problem is that the `let` line needs
> to start in the same column as the lines with `gen` and `putStr`.
>
> The gen, let, and putStr were properly aligned. After all, it compiled as
> Haskell98 ;-).
>
> > (Also, the inner do-block needs to be indented strictly further than the
> word `log`, in case it isn't in the original file.)
>
> This seems to be the issue. Haskell98 didn't require this, Haskell2010
> does, and this seems less desirable to me. Isn't it reasonable to assume
> that the it's the do that dominates syntactically here, and not the let?
>
> Peace,
>
> Stu
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141119/261acd7b/attachment.html>


More information about the Haskell-Cafe mailing list