[Haskell-cafe] How to write such a code elegantly ?

J. Waldmann waldmann at imn.htwk-leipzig.de
Mon Jan 10 12:20:34 CET 2011


> why has the following code indentation problem ?
> 
> rollDice n = do
>     let myGen =
>         if doesFileExist "/dev/urandom" 
>             then betterStdGen
>             else (mkStdGen . fromInteger) <$> picoSec

because "if" starts in the same column as "myGen",
so the parser inserts a ";" before the "if".

J.W.





More information about the Haskell-Cafe mailing list