haskell-src-meta 0.8.3 → 0.8.4
raw patch · 5 files changed
+58/−46 lines, 5 filesdep ~HUnitdep ~basedep ~haskell-src-extsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: HUnit, base, haskell-src-exts, pretty, template-haskell, th-orphans
API changes (from Hackage documentation)
Files
- ChangeLog +5/−1
- haskell-src-meta.cabal +11/−11
- src/Language/Haskell/Meta/Syntax/Translate.hs +5/−11
- src/Language/Haskell/Meta/Utils.hs +0/−20
- tests/Splices.hs +37/−3
ChangeLog view
@@ -1,3 +1,7 @@+0.8.4:+- Bump base and template-haskell library to versions shipped with GHC 7.10+- Compatibility with haskell-src-exts 1.22+ 0.8.3: - Compatibility with GHC 8.8, by fixing MonadFail issues @@ -6,7 +10,7 @@ - Added parseDecsWithMode and parseHsDeclsWithMode 0.8.1:-- Compatible with GHC 8.6, haskell-src-exts 1.22+- Compatibility with GHC 8.6, haskell-src-exts 1.21 0.8.0.1: - Bump base and template-haskell library to versions shipped with GHC 7.6.
haskell-src-meta.cabal view
@@ -1,5 +1,5 @@ name: haskell-src-meta-version: 0.8.3+version: 0.8.4 cabal-version: >= 1.8 build-type: Simple license: BSD3@@ -9,7 +9,7 @@ copyright: (c) Matt Morrow maintainer: danburton.email@gmail.com bug-reports: https://github.com/DanBurton/haskell-src-meta/issues-tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1+tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1 synopsis: Parse source to template-haskell abstract syntax. description: The translation from haskell-src-exts abstract syntax to template-haskell abstract syntax isn't 100% complete yet.@@ -17,12 +17,12 @@ extra-source-files: ChangeLog README.md library- build-depends: base >= 4.6 && < 5,- haskell-src-exts >= 1.18 && < 1.22,+ build-depends: base >= 4.8 && < 5,+ haskell-src-exts >= 1.18 && < 1.23, pretty >= 1.0 && < 1.2, syb >= 0.1 && < 0.8,- template-haskell >= 2.8 && < 2.16,- th-orphans >= 0.9.1 && < 0.14+ template-haskell >= 2.10 && < 2.16,+ th-orphans >= 0.12 && < 0.14 if impl(ghc < 7.8) build-depends: safe <= 0.3.9@@ -39,12 +39,12 @@ main-is: Main.hs build-depends:- HUnit >= 1.2 && < 1.7,- base >= 4.5 && < 5,- haskell-src-exts >= 1.17 && < 1.22,+ HUnit >= 1.2,+ base >= 4.5,+ haskell-src-exts >= 1.17, haskell-src-meta,- pretty >= 1.0 && < 1.2,- template-haskell >= 2.7,+ pretty >= 1.0,+ template-haskell >= 2.10, tasty, tasty-hunit
src/Language/Haskell/Meta/Syntax/Translate.hs view
@@ -402,11 +402,7 @@ Exts.PromotedList _ _q ts -> foldr (\t pl -> TH.PromotedConsT `TH.AppT` toType t `TH.AppT` pl) TH.PromotedNilT ts Exts.PromotedTuple _ ts -> foldr (\t pt -> pt `TH.AppT` toType t) (TH.PromotedTupleT $ length ts) ts Exts.PromotedUnit _ -> TH.PromotedT ''()-#if MIN_VERSION_template_haskell(2,10,0) toType (Exts.TyEquals _ t1 t2) = TH.EqualityT `TH.AppT` toType t1 `TH.AppT` toType t2-#else- toType t@Exts.TyEquals{} = noTHyet "toType" "2.10.0" t-#endif toType t@Exts.TySplice{} = noTH "toType" t toType t@Exts.TyBang{} = nonsense "toType" "type cannot have strictness annotations in this context" t@@ -446,18 +442,16 @@ a .->. b = TH.AppT (TH.AppT TH.ArrowT a) b instance ToPred (Exts.Asst l) where-#if MIN_VERSION_template_haskell(2,10,0)+#if MIN_VERSION_haskell_src_exts(1,22,0)+ toPred (Exts.TypeA _ t) = toType t+#else toPred (Exts.ClassA _ n ts) = List.foldl' TH.AppT (TH.ConT (toName n)) (fmap toType ts) toPred (Exts.InfixA _ t1 n t2) = List.foldl' TH.AppT (TH.ConT (toName n)) (fmap toType [t1,t2]) toPred (Exts.EqualP _ t1 t2) = List.foldl' TH.AppT TH.EqualityT (fmap toType [t1,t2])-#else- toPred (Exts.ClassA _ n ts) = TH.ClassP (toName n) (fmap toType ts)- toPred (Exts.InfixA _ t1 n t2) = TH.ClassP (toName n) (fmap toType [t1, t2])- toPred (Exts.EqualP _ t1 t2) = TH.EqualP (toType t1) (toType t2)-#endif- toPred (Exts.ParenA _ asst) = toPred asst toPred a@Exts.AppA{} = todo "toPred" a toPred a@Exts.WildCardA{} = todo "toPred" a+#endif+ toPred (Exts.ParenA _ asst) = toPred asst toPred a@Exts.IParam{} = noTH "toPred" a -- Pattern match is redundant. -- TODO: Is there a way to turn off this warn for catch-alls?
src/Language/Haskell/Meta/Utils.hs view
@@ -67,15 +67,6 @@ instance Show (Q String) where show = unsafeRunQ instance Show (Q Doc) where show = show . unsafeRunQ -#if !MIN_VERSION_th_orphans(0,12,0)-#if MIN_VERSION_base(4,7,0)-deriving instance Typeable Q-#else-deriving instance Typeable1 Q-#endif-deriving instance Typeable QuasiQuoter-#endif- -- | @unsafeRunQ = unsafePerformIO . runQ@ unsafeRunQ :: Q a -> a unsafeRunQ = unsafePerformIO . runQ@@ -173,18 +164,7 @@ unVarT (VarT n) = PlainTV n unVarT ty = error $ "renameT: unVarT: TODO for" ++ show ty renamePreds = renameThings renamePred-#if MIN_VERSION_template_haskell(2,10,0) renamePred = renameT-#else- renamePred env new (ClassP n ts) = let- (ts', env', new') = renameTs env new [] ts- in (ClassP (normaliseName n) ts', env', new')-- renamePred env new (EqualP t1 t2) = let- (t1', env1, new1) = renameT env new t1- (t2', env2, new2) = renameT env1 new1 t2- in (EqualP t1' t2', env2, new2)-#endif renameT _ _ t = error $ "renameT: TODO for " ++ show t -- | Remove qualification, etc.
tests/Splices.hs view
@@ -1,11 +1,17 @@ {-# OPTIONS_GHC -fno-warn-type-defaults #-}-{-# LANGUAGE CPP #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE TemplateHaskell #-} #if MIN_VERSION_template_haskell(2,12,0)-{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeApplications #-} #endif +#if MIN_VERSION_template_haskell(2,14,0)+{-# LANGUAGE ExplicitForAll #-}+{-# LANGUAGE QuantifiedConstraints #-}+#endif+ -- | Tests stuff mostly by just compiling correctly import qualified Language.Haskell.Exts.Extension as Extension import qualified Language.Haskell.Exts.Parser as Parser@@ -58,7 +64,33 @@ ,"tenStr = show (10 :: Int)"]) #endif +#if MIN_VERSION_template_haskell(2,14,0)+$(either error return $ Meta.parseDecsWithMode+ (Parser.defaultParseMode { Parser.extensions = [Extension.EnableExtension Extension.QuantifiedConstraints, Extension.EnableExtension Extension.ExplicitForAll] })+ $ unlines+ ["class (forall a. Eq a => Eq (f a)) => Eq1 f where"+ ," eq1 :: f Int -> f Int -> Bool"+ ," eq1 = (==)"+ ,""+ ,"instance Eq1 []"])+#else+$(either error return $ Meta.parseDecs $ unlines+ ["eq1 :: [Int] -> [Int] -> Bool"+ ,"eq1 = (==)"])+#endif +$(either error return $ Meta.parseDecsWithMode+ (Parser.defaultParseMode { Parser.extensions = [Extension.EnableExtension Extension.GADTs] })+ $ unlines+ [+-- Not sure why but ghc 7.10 complains that "type var a is not in scope"+#if MIN_VERSION_template_haskell(2,11,0)+ "intConstraint :: (a ~ Int) => a"+#else+ "intConstraint :: Int"+#endif+ ,"intConstraint = 3"])+ -- Just to check that it works as intended main :: IO () main = do@@ -68,4 +100,6 @@ (1,2) <- return pair (True,1) <- return $ mymethod True 1 "10" <- return tenStr+ 3 <- return intConstraint+ True <- return $ eq1 [1] [1] return ()