From 62070c7f5bb3f4248557c30a0a9afa96c4f31799 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Thu, 28 May 2009 16:44:36 +0000 Subject: [PATCH] Move getMainFun to TcRnDriver, trim DynFlags imports --- compiler/main/DynFlags.hs | 12 +----------- compiler/typecheck/TcRnDriver.lhs | 7 ++++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index b71712b..d764b6d 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -31,7 +31,6 @@ module DynFlags ( dopt_set, dopt_unset, -- DynFlags -> DynFlag -> DynFlags getOpts, -- DynFlags -> (DynFlags -> [a]) -> [a] getVerbFlag, - getMainFun, updOptLevel, setTmpDir, setPackageName, @@ -69,9 +68,7 @@ import Platform #endif import Module import PackageConfig -import PrelNames ( mAIN, main_RDR_Unqual ) -import RdrName ( RdrName, mkRdrUnqual ) -import OccName ( mkVarOccFS ) +import PrelNames ( mAIN ) #if defined(i386_TARGET_ARCH) || (!defined(mingw32_TARGET_OS) && !defined(darwin_TARGET_OS)) import StaticFlags ( opt_Static ) #endif @@ -2104,13 +2101,6 @@ setMainIs arg where (main_mod, main_fn) = splitLongestPrefix arg (== '.') --- | Get the unqualified name of the function to use as the \"main\" for the main module. --- Either returns the default name or the one configured on the command line with -main-is -getMainFun :: DynFlags -> RdrName -getMainFun dflags = case (mainFunIs dflags) of - Just fn -> mkRdrUnqual (mkVarOccFS (mkFastString fn)) - Nothing -> main_RDR_Unqual - ----------------------------------------------------------------------------- -- Paths & Libraries diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs index 98279c4..7a3eb1d 100644 --- a/compiler/typecheck/TcRnDriver.lhs +++ b/compiler/typecheck/TcRnDriver.lhs @@ -34,7 +34,6 @@ import DynFlags import StaticFlags import HsSyn import RdrHsSyn - import PrelNames import RdrName import TcHsSyn @@ -944,6 +943,12 @@ check_main dflags tcg_env pp_main_fn | main_fn == main_RDR_Unqual = ptext (sLit "function") <+> quotes (ppr main_fn) | otherwise = ptext (sLit "main function") <+> quotes (ppr main_fn) +-- | Get the unqualified name of the function to use as the \"main\" for the main module. +-- Either returns the default name or the one configured on the command line with -main-is +getMainFun :: DynFlags -> RdrName +getMainFun dflags = case (mainFunIs dflags) of + Just fn -> mkRdrUnqual (mkVarOccFS (mkFastString fn)) + Nothing -> main_RDR_Unqual \end{code} Note [Root-main Id] -- 1.7.10.4