From ef993c503ad58a18b7c2589a29f94c547b1c55f2 Mon Sep 17 00:00:00 2001 From: Thomas Schilling Date: Mon, 10 Nov 2008 17:56:14 +0000 Subject: [PATCH] Documentation only. Clarify that 'load*' may indeed throw SourceErrors. I don't think errors during dependency analysis should be passed to the logger. --- compiler/main/GHC.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index ce3fe76..6f4108b 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -659,6 +659,10 @@ data LoadHowMuch -- | Try to load the program. Calls 'loadWithLogger' with the default -- compiler that just immediately logs all warnings and errors. +-- +-- This function may throw a 'SourceError' if errors are encountered before +-- the actual compilation starts (e.g., during dependency analysis). +-- load :: GhcMonad m => LoadHowMuch -> m SuccessFlag load how_much = loadWithLogger defaultWarnErrLogger how_much @@ -676,7 +680,11 @@ defaultWarnErrLogger (Just e) = printExceptionAndWarnings e -- -- The first argument is a function that is called after compiling each -- module to print wanrings and errors. - +-- +-- While compiling a module, all 'SourceError's are caught and passed to the +-- logger, however, this function may still throw a 'SourceError' if +-- dependency analysis failed (e.g., due to a parse error). +-- loadWithLogger :: GhcMonad m => WarnErrLogger -> LoadHowMuch -> m SuccessFlag loadWithLogger logger how_much = do -- Dependency analysis first. Note that this fixes the module graph: -- 1.7.10.4