packages feed

ghc-syb-utils 0.2.3 → 0.2.3.1

raw patch · 3 files changed

+71/−4 lines, 3 filesdep +directorydep +filepathdep +ghc-pathsdep ~basedep ~ghcPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: directory, filepath, ghc-paths, ghc-syb-utils

Dependency ranges changed: base, ghc

API changes (from Hackage documentation)

- GHC.SYB.Utils: instance Eq Stage
- GHC.SYB.Utils: instance Ord Stage
- GHC.SYB.Utils: instance Show Stage
+ GHC.SYB.Utils: instance GHC.Classes.Eq GHC.SYB.Utils.Stage
+ GHC.SYB.Utils: instance GHC.Classes.Ord GHC.SYB.Utils.Stage
+ GHC.SYB.Utils: instance GHC.Show.Show GHC.SYB.Utils.Stage

Files

GHC/SYB/Utils.hs view
@@ -185,7 +185,9 @@ import Bag(Bag,bagToList) import Var(Var) import FastString(FastString)-#if __GLASGOW_HASKELL__ >= 709+#if __GLASGOW_HASKELL__ >= 800+import NameSet(NameSet,nameSetElemsStable)+#elif __GLASGOW_HASKELL__ >= 709 import NameSet(NameSet,nameSetElems) #else import NameSet(NameSet,nameSetToList)@@ -198,7 +200,10 @@ import Control.Monad import Data.List -#if __GLASGOW_HASKELL__ < 709+#if __GLASGOW_HASKELL__ >= 800+nameSetElems :: NameSet -> [Name]+nameSetElems = nameSetElemsStable+#elif __GLASGOW_HASKELL__ < 709 nameSetElems :: NameSet -> [Name] nameSetElems = nameSetToList #endif
ghc-syb-utils.cabal view
@@ -1,5 +1,5 @@ name:            ghc-syb-utils-version:         0.2.3+version:         0.2.3.1 license:         BSD3 license-file:    LICENSE author:          Claus Reinke@@ -11,7 +11,7 @@ category:        Development stability:       provisional build-type:      Simple-cabal-version:   >= 1.6+cabal-version:   >= 1.8 tested-with:     GHC ==7.8.3, GHC ==7.10.0  library@@ -31,3 +31,15 @@   ghc-options:    -Wall    exposed-modules: GHC.SYB.Utils++test-suite regression-tests+  type: exitcode-stdio-1.0+  hs-source-dirs: test+  main-is: Regression.hs+  build-depends:+                base,+                directory,+                filepath,+                ghc,+                ghc-paths,+                ghc-syb-utils
+ test/Regression.hs view
@@ -0,0 +1,50 @@+module Main where++import GHC.Paths ( libdir )+import qualified GhcMake as Ghc+import qualified GHC as Ghc+import qualified HscTypes as Ghc+import           MonadUtils ( liftIO )+import System.Directory ( getCurrentDirectory )+import System.FilePath ( (</>) )+import System.Exit ( exitWith, ExitCode(..) )+import Control.Monad ( when )++import GHC.SYB.Utils++main :: IO ()+main = do+  pkg_dir <- getCurrentDirectory+  let ex1 = pkg_dir </> "test" </> "test-cases" </> "GithubIssue9.hs"+  Ghc.runGhc (Just libdir) $ do+    dflags0 <- Ghc.getSessionDynFlags+    let dflags = dflags0+          { Ghc.ghcLink = Ghc.NoLink+          , Ghc.hscTarget = Ghc.HscAsm+          }+    Ghc.setSessionDynFlags dflags+    env <- Ghc.getSession+    Ghc.handleSourceError printErrorAndExit $ do+      target <- Ghc.guessTarget ex1 Nothing+      Ghc.setTargets [target]+      ok <- Ghc.load Ghc.LoadAllTargets+      when (not (Ghc.succeeded ok)) $ die+      let mn = Ghc.mkModuleName "GithubIssue9"+      msum <- Ghc.getModSummary mn+      parsed <- Ghc.parseModule msum+      liftIO $ do+        putStrLn "===== Parsed Source =================================="+        putStrLn $ showData Parser 1 (Ghc.parsedSource parsed)+      typechecked <- Ghc.typecheckModule parsed+      liftIO $ do+        putStrLn "===== Renamed Source ================================="+        putStrLn $ showData Renamer 1 (Ghc.renamedSource typechecked)+        putStrLn "===== Type-checked Source ============================"+        putStrLn $ showData TypeChecker 1 (Ghc.typecheckedSource typechecked)+      return ()++printErrorAndExit :: Ghc.SourceError -> Ghc.Ghc ()+printErrorAndExit err = Ghc.printException err >> die++die :: Ghc.Ghc ()+die = liftIO $ exitWith (ExitFailure 1)