[Haskell-cafe] Parsing error in Haskell2010

Henk-Jan van Tuyl hjgtuyl at chello.nl
Tue Nov 18 22:55:16 UTC 2014


On Tue, 18 Nov 2014 17:45:55 +0100, Stuart A. Kurtz  
<stuart at cs.uchicago.edu> wrote:

[...]
> where Model is a monadic type, and then my main was
>
> 	main :: IO ()
> 	main = do
> 	    gen <- getStdGen
>           let log = runModel gen $ do
> 	        initialize 72
> 	        report
> 	        replicateM_ 50 $ do
> 	            replicateM_251 migrate
> 	            report
> 	    putStr . format $ log
>
> Haskell 2010 doesn't like the additional level of indentation after the  
> "let log" line.
[...]
> 2) Can this code be formatted in a way to make Haskell 2010 happy?

The lines after the let must be indented more:

main :: IO ()
main = do
     gen <- getStdGen
     let log = runModel gen $ do
           initialize 72
           report
           replicateM_ 50 $ do
               replicateM_251 migrate
               report
     putStr . format $ log

Regards,
Henk-Jan van Tuyl


-- 
Folding at home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--


More information about the Haskell-Cafe mailing list