ghc-simple 0.1.2.0 → 0.1.2.1
raw patch · 2 files changed
+12/−6 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ghc-simple.cabal +1/−1
- src/Language/Haskell/GHC/Simple.hs +11/−5
ghc-simple.cabal view
@@ -1,5 +1,5 @@ name: ghc-simple-version: 0.1.2.0+version: 0.1.2.1 synopsis: Simplified interface to the GHC API. description: The GHC API is a great tool for working with Haskell code. Unfortunately, it's also fairly opaque and hard to get
src/Language/Haskell/GHC/Simple.hs view
@@ -163,7 +163,7 @@ warns <- newIORef [] runGhc (maybe (Just libdir) Just (cfgGhcLibDir cfg)) $ do (_, files2) <- setDFS cfg (discardStaticFlags (cfgGhcFlags cfg)) warns- ecode <- genCode ghcPipeline comp acc (files ++ files2)+ ecode <- genCode cfg ghcPipeline comp acc (files ++ files2) ws <- liftIO $ readIORef warns case ecode of Right (finaldfs, code) ->@@ -188,12 +188,13 @@ -- | Map a compilation function over each 'ModSummary' in the dependency graph -- of a list of targets. genCode :: GhcMonad m- => (ModSummary -> m a)+ => CompConfig t+ -> (ModSummary -> m a) -> (b -> a -> IO b) -> b -> [String] -> m (Either [Error] (DynFlags, b))-genCode comp usercomp acc files = do+genCode cfg comp usercomp acc files = do dfs <- getSessionDynFlags merrs <- handleSourceError (maybeErrors dfs) $ do ts <- mapM (flip guessTarget Nothing) files@@ -210,8 +211,13 @@ -- We logged everything when we did @load@, we don't want to do it twice. noLog m = m {ms_hspp_opts = (ms_hspp_opts m) {log_action = \_ _ _ _ _ -> return ()}}- maybeErrors dfs =- return . Just . map (fromErrMsg dfs) . bagToList . srcErrorMessages+ maybeErrors dfs+ | cfgUseGhcErrorLogger cfg = \srcerr -> liftIO $ do+ let msgs = srcErrorMessages srcerr+ printBagOfErrors dfs msgs+ return . Just . map (fromErrMsg dfs) $ bagToList msgs+ | otherwise =+ return . Just . map (fromErrMsg dfs) . bagToList . srcErrorMessages fromErrMsg :: DynFlags -> ErrMsg -> Error fromErrMsg dfs e = Error {