packages feed

haskell-src-exts-qq 0.2.2 → 0.2.3

raw patch · 2 files changed

+49/−7 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Language/Haskell/Exts/Translate.hs view
@@ -24,9 +24,11 @@  class ToName a where toName :: a -> Name class ToLit  a where toLit  :: a -> Lit+#if MIN_VERSION_template_haskell(2,4,0) class ToKind a where toKind :: a -> Kind class ToPred a where toPred :: a -> Pred class ToTyVarBndr a where toTyVarBndr :: a -> TyVarBndr+#endif class ToType a where toType :: a -> Type class ToPat  a where toPat  :: a -> Pat class ToExp  a where toExp  :: a -> Exp@@ -187,6 +189,8 @@  -- * ToType HsType ++#if MIN_VERSION_template_haskell(2,4,0) {- | TH doesn't handle:   * !, the kind of unboxed types@@ -211,7 +215,17 @@ instance ToTyVarBndr Hs.TyVarBind where   toTyVarBndr (Hs.KindedVar n k) = KindedTV (toName n) (toKind k)   toTyVarBndr (Hs.UnkindedVar n) = PlainTV (toName n)+#else+instance ToName Hs.TyVarBind where+  toName (Hs.KindedVar n _) = toName n+  toName (Hs.UnkindedVar n) = toName n +instance ToType Hs.Asst where+  toType (Hs.ClassA n ts) = foldAppT (ConT . toName $ n) (fmap toType ts)+  toType a@(Hs.IParam _ _) = error $ errorMsg "toType" a+  toType a@(Hs.EqualP _ _) = error $ errorMsg "toType" a+#endif+ {- | TH does't handle   * unboxed tuples@@ -220,7 +234,11 @@   * kind signatures -} instance ToType Hs.Type where+#if MIN_VERSION_template_haskell(2,4,0)   toType (Hs.TyForall tvbM cxt t) = ForallT (maybe [] (fmap toTyVarBndr) tvbM) (fmap toPred cxt) (toType t)+#else+  toType (Hs.TyForall tvbM cxt t) = ForallT (maybe [] (fmap toName) tvbM) (fmap toType cxt) (toType t)+#endif   toType (Hs.TyFun a b) = toType a .->. toType b   toType (Hs.TyList t) = ListT `AppT` toType t   toType (Hs.TyTuple _ ts) = foldAppT (TupleT . length $ ts) (fmap toType ts)@@ -257,22 +275,43 @@  instance ToDec Hs.Decl where   toDec (Hs.TypeDecl _ n ns t)+#if MIN_VERSION_template_haskell(2,4,0)     = TySynD (toName n) (fmap toTyVarBndr ns) (toType t)-+#else+    = TySynD (toName n) (fmap toName ns) (toType t)+#endif    toDec a@(Hs.DataDecl  _ dOrN cxt n ns qcds qns)     = case dOrN of-        Hs.DataType -> DataD (fmap toPred cxt)+        Hs.DataType -> DataD+#if MIN_VERSION_template_haskell(2,4,0)+                              (fmap toPred cxt)+#else+                              (fmap toType cxt)+#endif                               (toName n)+#if MIN_VERSION_template_haskell(2,4,0)                               (fmap toTyVarBndr ns)+#else+                              (fmap toName ns)+#endif                               (fmap qualConDeclToCon qcds)                               (fmap (toName . fst) qns)         Hs.NewType  -> let qcd = case qcds of                                   x:_ -> x                                   _   -> error "toDec: Newtype has no constructors!"-                        in NewtypeD (fmap toPred cxt)+                        in NewtypeD+#if MIN_VERSION_template_haskell(2,4,0)+                                    (fmap toPred cxt)+#else+                                    (fmap toType cxt)+#endif                                     (toName n)+#if MIN_VERSION_template_haskell(2,4,0)                                     (fmap toTyVarBndr ns)+#else+                                    (fmap toName ns)+#endif                                     (qualConDeclToCon qcd)                                     (fmap (toName . fst) qns) @@ -306,9 +345,12 @@  qualConDeclToCon :: Hs.QualConDecl -> Con qualConDeclToCon (Hs.QualConDecl _ [] [] cdecl) = conDeclToCon cdecl-qualConDeclToCon (Hs.QualConDecl _ ns cxt cdecl) = ForallC (fmap toTyVarBndr ns)-                                                    (fmap toPred cxt)-                                                    (conDeclToCon cdecl)+qualConDeclToCon (Hs.QualConDecl _ ns cxt cdecl) =+#if MIN_VERSION_template_haskell(2,4,0)+  ForallC (fmap toTyVarBndr ns) (fmap toPred cxt) (conDeclToCon cdecl)+#else+  ForallC (fmap toName ns) (fmap toType cxt) (conDeclToCon cdecl)+#endif  conDeclToCon :: Hs.ConDecl -> Con conDeclToCon (Hs.ConDecl n tys)
haskell-src-exts-qq.cabal view
@@ -1,5 +1,5 @@ Name:           haskell-src-exts-qq-Version:        0.2.2+Version:        0.2.3 Author:         Mathieu Boespflug Maintainer:     Mathieu Boespflug <mboes@tweag.net> Synopsis:       A quasiquoter for haskell-src-exts.