diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2020-08-07 22:56:51 +0100 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2020-08-07 22:56:51 +0100 |
commit | d89c8965369e2c264653128521a4a0112c243302 (patch) | |
tree | 632d86d439d874a50d8583f0741ce9ca7be391f0 /dev-haskell/test-framework-th-prime | |
parent | app-portage/fquery: tweak for cabal-3 (diff) | |
download | gentoo-d89c8965369e2c264653128521a4a0112c243302.tar.gz gentoo-d89c8965369e2c264653128521a4a0112c243302.tar.bz2 gentoo-d89c8965369e2c264653128521a4a0112c243302.zip |
dev-haskell/test-framework-th-prime: port to ghc-8
Reported-by: Agostino Sarubbo
Closes: https://bugs.gentoo.org/736252
Package-Manager: Portage-3.0.1, Repoman-2.3.23
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'dev-haskell/test-framework-th-prime')
3 files changed, 103 insertions, 0 deletions
diff --git a/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.8-ghc-8.patch b/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.8-ghc-8.patch new file mode 100644 index 000000000000..b3cbf27a28fe --- /dev/null +++ b/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.8-ghc-8.patch @@ -0,0 +1,25 @@ +diff --git a/Test/Framework/TH/Prime.hs b/Test/Framework/TH/Prime.hs +index 75b0798..0bed643 100644 +--- a/Test/Framework/TH/Prime.hs ++++ b/Test/Framework/TH/Prime.hs +@@ -1,2 +1,3 @@ + {-# LANGUAGE QuasiQuotes, TemplateHaskell #-} ++{-# LANGUAGE CPP #-} + +@@ -119,3 +120,7 @@ isDefined :: String -> Q Bool + isDefined n = return False `recover` do ++#if MIN_VERSION_template_haskell(2,11,0) ++ VarI (Name _ flavour) _ _ <- reify (mkName n) ++#else + VarI (Name _ flavour) _ _ _ <- reify (mkName n) ++#endif + modul <- loc_module <$> location +diff --git a/Test/Framework/TH/Prime/Parser.hs b/Test/Framework/TH/Prime/Parser.hs +index 7f541c4..fef60f1 100644 +--- a/Test/Framework/TH/Prime/Parser.hs ++++ b/Test/Framework/TH/Prime/Parser.hs +@@ -78,3 +78,3 @@ parseTest file = do + #if MIN_VERSION_haskell_src_exts(1, 14, 0) +- extensions = nub $ EnableExtension TemplateHaskell : exts raw ++ extensions = nub $ EnableExtension Language.Haskell.Exts.Extension.TemplateHaskell : exts raw + #else diff --git a/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.9-hse-1.18.patch b/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.9-hse-1.18.patch new file mode 100644 index 000000000000..359d5ea4f6a9 --- /dev/null +++ b/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.9-hse-1.18.patch @@ -0,0 +1,76 @@ +diff --git a/Test/Framework/TH/Prime/Parser.hs b/Test/Framework/TH/Prime/Parser.hs +index 87553a6..f188390 100644 +--- a/Test/Framework/TH/Prime/Parser.hs ++++ b/Test/Framework/TH/Prime/Parser.hs +@@ -10,2 +10,5 @@ import Language.Haskell.Exts.Extension + import Language.Haskell.Exts.Parser ++#if MIN_VERSION_haskell_src_exts(1, 18, 0) ++import Language.Haskell.Exts.SrcLoc ++#endif + import Language.Haskell.Exts.Syntax hiding (VarName, Exp) +@@ -14,2 +17,11 @@ import Language.Preprocessor.Cpphs hiding (Ident) + ++#if MIN_VERSION_haskell_src_exts(1, 18, 0) ++-- location field for haskell-src-exts-1.18 ++#define L SrcSpanInfo ++#define loc _ ++#else ++#define L ++#define loc ++#endif ++ + ---------------------------------------------------------------- +@@ -45,3 +57,7 @@ getTests :: FilePath -> IO ([String], [String]) + getTests file = do ++#if MIN_VERSION_haskell_src_exts(1, 18, 0) ++ ParseOk (Module _ _ _ _ decls) <- parseTest file ++#else + ParseOk (Module _ _ _ _ _ _ decls) <- parseTest file ++#endif + let funs = map fromFunBind $ filter isFunBind decls +@@ -54,3 +70,3 @@ getTests file = do + +-parseTest :: FilePath -> IO (ParseResult Module) ++parseTest :: FilePath -> IO (ParseResult (Module L)) + parseTest file = do +@@ -74,4 +90,4 @@ parseTest file = do + #endif +- toStr (Ident str) = str +- toStr (Symbol str) = str ++ toStr (Ident loc str) = str ++ toStr (Symbol loc str) = str + opt raw = defaultParseMode { +@@ -88,7 +104,7 @@ parseTest file = do + +-isFunBind :: Decl -> Bool +-isFunBind (FunBind _) = True +-isFunBind _ = False ++isFunBind :: Decl L -> Bool ++isFunBind (FunBind loc _) = True ++isFunBind _ = False + +-isPatBind :: Decl -> Bool ++isPatBind :: Decl L -> Bool + isPatBind PatBind{} = True +@@ -96,6 +112,6 @@ isPatBind _ = False + +-fromPatBind :: Decl -> String ++fromPatBind :: Decl L -> String + #if MIN_VERSION_haskell_src_exts(1, 16, 0) +-fromPatBind (PatBind _ (PVar (Ident name)) _ _) = name +-fromPatBind (PatBind _ (PVar (Symbol name)) _ _) = name ++fromPatBind (PatBind _ (PVar loc (Ident loc name)) _ _) = name ++fromPatBind (PatBind _ (PVar loc (Symbol loc name)) _ _) = name + #else +@@ -106,5 +122,10 @@ fromPatBind _ = error "fromPatBind" + +-fromFunBind :: Decl -> String ++fromFunBind :: Decl L -> String ++#if MIN_VERSION_haskell_src_exts(1, 18, 0) ++fromFunBind (FunBind _floc (Match _ (Ident _iloc name) _ _ _:_)) = name ++fromFunBind (FunBind _floc (Match _ (Symbol _sloc name) _ _ _:_)) = name ++#else + fromFunBind (FunBind (Match _ (Ident name) _ _ _ _:_)) = name + fromFunBind (FunBind (Match _ (Symbol name) _ _ _ _:_)) = name ++#endif + fromFunBind _ = error "fromFunBind" diff --git a/dev-haskell/test-framework-th-prime/test-framework-th-prime-0.0.9.ebuild b/dev-haskell/test-framework-th-prime/test-framework-th-prime-0.0.9.ebuild index fd0bfb0801c0..ab54c1b6765a 100644 --- a/dev-haskell/test-framework-th-prime/test-framework-th-prime-0.0.9.ebuild +++ b/dev-haskell/test-framework-th-prime/test-framework-th-prime-0.0.9.ebuild @@ -25,3 +25,5 @@ RDEPEND=">=dev-haskell/cpphs-0.2.1:=[profile?] DEPEND="${RDEPEND} >=dev-haskell/cabal-1.6 " + +PATCHES=("${FILESDIR}"/${P}-hse-1.18.patch) |