haskell-src-meta 0.6.0.8 → 0.6.0.9
raw patch · 6 files changed
+26/−60 lines, 6 filesdep −uniplatedep ~basedep ~template-haskelldep ~th-orphansPVP ok
version bump matches the API change (PVP)
Dependencies removed: uniplate
Dependency ranges changed: base, template-haskell, th-orphans
API changes (from Hackage documentation)
Files
- ChangeLog +6/−0
- haskell-src-meta.cabal +6/−10
- src/Language/Haskell/Meta/Parse.hs +0/−4
- src/Language/Haskell/Meta/Parse/Careful.hs +4/−17
- src/Language/Haskell/Meta/Syntax/Translate.hs +6/−28
- src/Language/Haskell/Meta/Utils.hs +4/−1
ChangeLog view
@@ -1,3 +1,9 @@+0.6.0.8 -> 0.6.0.9:+- Compatibility with GHC 7.10+- Update th-orphans dependency+- Drop GHC < 7.4 support (actually it was already broken, since HSE 1.16+ requires base >= 4.5)+ 0.6.0.7 -> 0.6.0.8: - Move to HSE 1.16
haskell-src-meta.cabal view
@@ -1,5 +1,5 @@ name: haskell-src-meta-version: 0.6.0.8+version: 0.6.0.9 cabal-version: >= 1.6 build-type: Simple license: BSD3@@ -9,8 +9,8 @@ copyright: (c) Matt Morrow maintainer: Ben Millwood <haskell@benmachine.co.uk> bug-reports: https://github.com/bmillwood/haskell-src-meta/issues-stability: experimental-tested-with: GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.2+-- That is to say, "builds with". It's not like we have a testsuite.+tested-with: GHC == 7.4.2, GHC == 7.6.2, GHC == 7.8.2, GHC == 7.10.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.@@ -18,17 +18,13 @@ extra-source-files: ChangeLog README examples/*.hs library- build-depends: base >= 4.2 && < 4.8,+ build-depends: base >= 4.5 && < 4.9, haskell-src-exts == 1.16.*, pretty >= 1.0 && < 1.2, syb >= 0.1 && < 0.5,- th-orphans >= 0.5 && < 0.9+ th-orphans >= 0.9.1 && < 0.12 - if impl(ghc >= 7.4)- Build-depends: template-haskell >= 2.7 && < 2.10- else- Build-depends: template-haskell >= 2.4 && < 2.7,- uniplate >= 1.3 && < 1.7+ Build-depends: template-haskell >= 2.7 && < 2.11 extensions: CPP, RankNTypes,
src/Language/Haskell/Meta/Parse.hs view
@@ -62,11 +62,7 @@ ,extensions = map EnableExtension myDefaultExtensions ,ignoreLinePragmas = False ,ignoreLanguagePragmas = False-#if MIN_VERSION_template_haskell(2,7,0) ,fixities = Nothing}-#else- ,fixities = Just baseFixities}-#endif myDefaultExtensions :: [KnownExtension] myDefaultExtensions = [PostfixOperators
src/Language/Haskell/Meta/Parse/Careful.hs view
@@ -1,4 +1,6 @@ {- |+DEPRECATED: haskell-src-meta now requires GHC >= 7.4, so this module is no longer necessary. It will be GHC-warning deprecated soon.+ This module provides the tools to handle operator fixities in infix expressions correctly. The problem we solve is the following. Consider making a quasiquoter which antiquotes to Haskell - for instance, the quasiquoter in <http://hackage.haskell.org/package/hmatrix-static> allows me to write@@ -34,9 +36,6 @@ import qualified Language.Haskell.Meta.Syntax.Translate as Translate import qualified Language.Haskell.TH as TH import qualified Language.Haskell.Exts.Syntax as Hs-#if !(MIN_VERSION_template_haskell(2,7,0))-import Data.Generics.Uniplate.Data-#endif doChecked parser translater p = case parser p of @@ -56,18 +55,6 @@ parseDecs :: String -> Either String [TH.Dec] parseDecs = doChecked Sloppy.parseHsDecls Translate.toDecs -#if MIN_VERSION_template_haskell(2,7,0)+-- This was more complicated, but since support for GHC pre-7.4 was dropped,+-- it's no longer necessary amb = const False-#else-amb syn = any isAmbExp (universeBi syn) || any isAmbPat (universeBi syn)- where- isAmbExp (Hs.InfixApp Hs.InfixApp{} _ _) = True- isAmbExp (Hs.InfixApp _ _ Hs.InfixApp{}) = True- isAmbExp (Hs.InfixApp Hs.RightSection{} _ _) = True- isAmbExp (Hs.InfixApp _ _ Hs.LeftSection{}) = True- isAmbExp _ = False- - isAmbPat (Hs.PInfixApp Hs.PInfixApp{} _ _) = True- isAmbPat (Hs.PInfixApp _ _ Hs.PInfixApp{}) = True- isAmbPat _ = False-#endif
src/Language/Haskell/Meta/Syntax/Translate.hs view
@@ -180,24 +180,12 @@ FloatPrimL r' -> FloatPrimL (negate r') DoublePrimL r'' -> DoublePrimL (negate r'') _ -> nonsense "toPat" "negating wrong kind of literal" l-#if MIN_VERSION_template_haskell(2,7,0) toPat (Hs.PInfixApp p n q) = UInfixP (toPat p) (toName n) (toPat q) -#else- toPat (Hs.PInfixApp p n q)= InfixP (toPat p) (toName n) (toPat q)-#endif toPat (Hs.PApp n ps) = ConP (toName n) (fmap toPat ps) toPat (Hs.PTuple Hs.Boxed ps) = TupP (fmap toPat ps)-#if MIN_VERSION_template_haskell(2,6,0) toPat (Hs.PTuple Hs.Unboxed ps) = UnboxedTupP (fmap toPat ps)-#else- toPat p@(Hs.PTuple Hs.Unboxed _) = noTHyet "toPat" "2.6.0" p-#endif toPat (Hs.PList ps) = ListP (fmap toPat ps)-#if MIN_VERSION_template_haskell(2,7,0) toPat (Hs.PParen p) = ParensP (toPat p) -#else- toPat (Hs.PParen p) = toPat p-#endif toPat (Hs.PRec n pfs) = let toFieldPat (Hs.PFieldPat n p) = (toName n, toPat p) in RecP (toName n) (fmap toFieldPat pfs) toPat (Hs.PAsPat n p) = AsP (toName n) (toPat p)@@ -234,11 +222,7 @@ toExp e@Hs.IPVar{} = noTH "toExp" e toExp (Hs.Con n) = ConE (toName n) toExp (Hs.Lit l) = LitE (toLit l)-#if MIN_VERSION_template_haskell(2,7,0) toExp (Hs.InfixApp e o f) = UInfixE (toExp e) (toExp o) (toExp f)-#else- toExp (Hs.InfixApp e o f) = InfixE (Just . toExp $ e) (toExp o) (Just . toExp $ f)-#endif toExp (Hs.App e f) = AppE (toExp e) (toExp f) toExp (Hs.NegApp e) = AppE (VarE 'negate) (toExp e) toExp (Hs.Lambda _ ps e) = LamE (fmap toPat ps) (toExp e)@@ -253,18 +237,10 @@ toExp (Hs.Do ss) = DoE (map toStmt ss) toExp e@(Hs.MDo _) = noTH "toExp" e toExp (Hs.Tuple Hs.Boxed xs) = TupE (fmap toExp xs)-#if MIN_VERSION_template_haskell(2,6,0) toExp (Hs.Tuple Hs.Unboxed xs) = UnboxedTupE (fmap toExp xs)-#else- toExp e@(Hs.Tuple Hs.Unboxed _) = noTHyet "toExp" "2.6.0" e-#endif toExp e@Hs.TupleSection{} = noTH "toExp" e toExp (Hs.List xs) = ListE (fmap toExp xs)-#if MIN_VERSION_template_haskell(2,7,0) toExp (Hs.Paren e) = ParensE (toExp e)-#else- toExp (Hs.Paren e) = toExp e-#endif toExp (Hs.LeftSection e o) = InfixE (Just . toExp $ e) (toExp o) Nothing toExp (Hs.RightSection o f) = InfixE Nothing (toExp o) (Just . toExp $ f) toExp (Hs.RecConstr n xs) = RecConE (toName n) (fmap toFieldExp xs)@@ -353,11 +329,7 @@ where tuple = case b of Hs.Boxed -> TupleT-#if MIN_VERSION_template_haskell(2,6,0) Hs.Unboxed -> UnboxedTupleT-#else- Hs.Unboxed -> noTHyet "toType" "2.6.0" (Hs.TyTuple b ts)-#endif toType (Hs.TyApp a b) = AppT (toType a) (toType b) toType (Hs.TyVar n) = VarT (toName n) toType (Hs.TyCon qn) = ConT (toName qn)@@ -384,9 +356,15 @@ toCxt :: Hs.Context -> Cxt toCxt = fmap toPred where+#if MIN_VERSION_template_haskell(2,10,0)+ toPred (Hs.ClassA n ts) = foldl' AppT (ConT (toName n)) (fmap toType ts)+ toPred (Hs.InfixA t1 n t2) = foldl' AppT (ConT (toName n)) (fmap toType [t1,t2])+ toPred (Hs.EqualP t1 t2) = foldl' AppT EqualityT (fmap toType [t1,t2])+#else toPred (Hs.ClassA n ts) = ClassP (toName n) (fmap toType ts) toPred (Hs.InfixA t1 n t2) = ClassP (toName n) (fmap toType [t1, t2]) toPred (Hs.EqualP t1 t2) = EqualP (toType t1) (toType t2)+#endif toPred a@Hs.IParam{} = noTH "toCxt" a foldAppT :: Type -> [Type] -> Type
src/Language/Haskell/Meta/Utils.hs view
@@ -166,6 +166,9 @@ unVarT (VarT n) = PlainTV n 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')@@ -174,7 +177,7 @@ (t1', env1, new1) = renameT env new t1 (t2', env2, new2) = renameT env1 new1 t2 in (EqualP t1' t2', env2, new2)-+#endif -- | Remove qualification, etc. normaliseName :: Name -> Name