haskell-src-meta 0.8.0.1 → 0.8.0.2
raw patch · 2 files changed
+44/−9 lines, 2 filesdep ~basedep ~haskell-src-extsdep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, haskell-src-exts, template-haskell
API changes (from Hackage documentation)
- Language.Haskell.Meta.Syntax.Translate: type DerivClause = Pred
+ Language.Haskell.Meta.Syntax.Translate: instance Language.Haskell.Meta.Syntax.Translate.ToDerivClauses a => Language.Haskell.Meta.Syntax.Translate.ToDerivClauses [a]
+ Language.Haskell.Meta.Syntax.Translate: toDerivStrategy :: (DerivStrategy l) -> DerivStrategy
- Language.Haskell.Meta.Syntax.Translate: toGuard :: GuardedRhs t -> (Guard, Exp)
+ Language.Haskell.Meta.Syntax.Translate: toGuard :: () => GuardedRhs l -> (Guard, Exp)
- Language.Haskell.Meta.Utils: renameThings :: (t2 -> t1 -> t -> (a, t2, t1)) -> t2 -> t1 -> [a] -> [t] -> ([a], t2, t1)
+ Language.Haskell.Meta.Utils: renameThings :: () => (t1 -> t2 -> a1 -> (a2, t1, t2)) -> t1 -> t2 -> [a2] -> [a1] -> ([a2], t1, t2)
Files
haskell-src-meta.cabal view
@@ -1,5 +1,5 @@ name: haskell-src-meta-version: 0.8.0.1+version: 0.8.0.2 cabal-version: >= 1.8 build-type: Simple license: BSD3@@ -18,7 +18,7 @@ library build-depends: base >= 4.6 && < 4.11,- haskell-src-exts >= 1.17 && < 1.20,+ haskell-src-exts >= 1.18 && < 1.21, pretty >= 1.0 && < 1.2, syb >= 0.1 && < 0.8, template-haskell >= 2.8 && < 2.13,@@ -41,7 +41,7 @@ build-depends: HUnit >= 1.2 && < 1.7, base >= 4.5 && < 4.11,- haskell-src-exts >= 1.17 && < 1.20,+ haskell-src-exts >= 1.17 && < 1.21, haskell-src-meta, pretty >= 1.0 && < 1.2, template-haskell >= 2.7 && < 2.13,
src/Language/Haskell/Meta/Syntax/Translate.hs view
@@ -344,7 +344,12 @@ toType (Hs.TyCon _ qn) = ConT (toName qn) toType (Hs.TyParen _ t) = toType t -- XXX: need to wrap the name in parens!- toType (Hs.TyInfix _ a o b) = AppT (AppT (ConT (toName o)) (toType a)) (toType b)+#if MIN_VERSION_haskell_src_exts(1,20,0)+ toType (Hs.TyInfix _ a (Hs.UnpromotedName _ o) b) =+#else+ toType (Hs.TyInfix _ a o b) =+#endif+ AppT (AppT (ConT (toName o)) (toType a)) (toType b) toType (Hs.TyKind _ t k) = SigT (toType t) (toKind k) toType t@Hs.TyBang{} = nonsense "toType" "type cannot have strictness annotations in this context" t@@ -399,19 +404,39 @@ #if MIN_VERSION_template_haskell(2,12,0) instance ToDerivClauses (Hs.Deriving l) where+#if MIN_VERSION_haskell_src_exts(1,20,0)+ toDerivClauses (Hs.Deriving _ strat irules) = [DerivClause (fmap toDerivStrategy strat) (map toType irules)]+#else toDerivClauses (Hs.Deriving _ irules) = [DerivClause Nothing (map toType irules)]-#elif MIN_VERSION_template_haskell(2,11,0)-instance ToDerivClauses (Hs.Deriving l) where- toDerivClauses (Hs.Deriving _ irules) = map toType irules+#endif #else instance ToDerivClauses (Hs.Deriving l) where- toDerivClauses (Hs.Deriving _ irules) = concatMap toNames irules+#if MIN_VERSION_haskell_src_exts(1,20,0)+ toDerivClauses (Hs.Deriving _ _ irules) =+#else+ toDerivClauses (Hs.Deriving _ irules) = #endif+#if MIN_VERSION_template_haskell(2,11,0)+ map toType irules+#else+ concatMap toNames irules+#endif+#endif instance ToDerivClauses a => ToDerivClauses (Maybe a) where toDerivClauses Nothing = [] toDerivClauses (Just a) = toDerivClauses a +instance ToDerivClauses a => ToDerivClauses [a] where+ toDerivClauses = concatMap toDerivClauses++#if MIN_VERSION_template_haskell(2,12,0) && MIN_VERSION_haskell_src_exts(1,20,0)+toDerivStrategy :: (Hs.DerivStrategy l) -> DerivStrategy+toDerivStrategy (Hs.DerivStock _) = StockStrategy+toDerivStrategy (Hs.DerivAnyclass _) = AnyclassStrategy+toDerivStrategy (Hs.DerivNewtype _) = NewtypeStrategy+#endif+ foldAppT :: Type -> [Type] -> Type foldAppT t ts = foldl' AppT t ts @@ -565,7 +590,12 @@ toNames (Just a) = toNames a instance ToNames (Hs.Deriving l) where- toNames (Hs.Deriving _ irules) = concatMap toNames irules+#if MIN_VERSION_haskell_src_exts(1,20,0)+ toNames (Hs.Deriving _ _ irules) =+#else+ toNames (Hs.Deriving _ irules) =+#endif+ concatMap toNames irules instance ToNames (Hs.InstRule l) where toNames (Hs.IParen _ irule) = toNames irule toNames (Hs.IRule _ _mtvbs _mcxt mihd) = toNames mihd@@ -633,6 +663,7 @@ hsMatchesToFunD :: [Hs.Match l] -> Dec hsMatchesToFunD [] = FunD (mkName []) [] -- errorish hsMatchesToFunD xs@(Hs.Match _ n _ _ _ : _) = FunD (toName n) (fmap hsMatchToClause xs)+hsMatchesToFunD xs@(Hs.InfixMatch _ _ n _ _ _ : _) = FunD (toName n) (fmap hsMatchToClause xs) hsMatchToClause :: Hs.Match l -> Clause@@ -640,6 +671,10 @@ (fmap toPat ps) (hsRhsToBody rhs) (toDecs bnds)+hsMatchToClause (Hs.InfixMatch _ p _ ps rhs bnds) = Clause+ (fmap toPat (p:ps))+ (hsRhsToBody rhs)+ (toDecs bnds)