Hi.
The following code compiles "A.hs" with GHC API:
{{{
import GHC
import Outputable
import DynFlags ( defaultDynFlags )
libdir = "/usr/lib/ghc-6.12.1"
targetFile = "A.hs"
main = defaultErrorHandler defaultDynFlags $ do
    runGhc (Just libdir) $ do
dflags <- fmap (\dflags -> dflags {optLevel = 2}) getSessionDynFlags
        setSessionDynFlags dflags
        c <- compileToCoreSimplified targetFile
        print (showSDoc (ppr c))
}}}
A.hs: {{{
import Data.Maybe
main = print (show (maybe False (\_ -> True) (Just False)))
}}}
When "A.hs" is compiled with GHC API, output contains a reference to 'maybe'. When "A.hs" is compiled with "ghc -O2 -ddump-simpl", 'maybe' is inlined and simplified. Why do outputs differ?

--
Best regards,
  Roman Beslik.

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to