[Haskell-cafe] Ghc: -O harmful?

Daniel Fischer daniel.is.fischer at web.de
Mon Apr 6 16:30:23 EDT 2009


Am Montag 06 April 2009 20:37:46 schrieb Don Stewart:
> -fno-state-hack?

That, or

{-# LANGUAGE BangPatterns #-}

main = do
  n <- read `liftM` getLine
  !pole <- liftM (build n . map read . words) getLine
  replicateM_ 100 $ do
    getLine
    print $ best pole 42 420

if the state-hack is beneficial in other places of the programme.
The bang on pole tells GHC to calculate it only once, not inline it.


More information about the Haskell-Cafe mailing list