git.iko.soy/distributed-process
on master help sign in
Compatibility with ghc-7.10: support new TH.
commit7c233d1dec4473ae512a3ae61f33269b21df2783 authorAlexander Vershilov <alexander.vershilov@gmail.com> dateWed 1 Apr 2015, 14:57 (12 years ago) parent3417155
2 files changed+17−9
distributed-process.cabal+1−1 src/Control/Distributed/Process/Internal/Closure/TH.hs+16−8
distributed-process.cabal+1−1
@@ -103,7 +103,7 @@ Library
103103 if impl(ghc <= 7.4.2)
104104 Build-Depends: template-haskell >= 2.7 && < 2.8
105105 else
106− Build-Depends: template-haskell >= 2.6 && < 2.10
106+ Build-Depends: template-haskell >= 2.6 && < 2.11
107107 Exposed-modules: Control.Distributed.Process.Internal.Closure.TH
108108 CPP-Options: -DTemplateHaskellSupport
109109
src/Control/Distributed/Process/Internal/Closure/TH.hs+16−8
@@ -1,5 +1,5 @@
11-- | Template Haskell support
2−{-# LANGUAGE TemplateHaskell #-}
2+{-# LANGUAGE TemplateHaskell, CPP #-}
33module Control.Distributed.Process.Internal.Closure.TH
44 ( -- * User-level API
55 remotable
@@ -29,7 +29,11 @@ import Language.Haskell.TH
2929 , Type(AppT, ForallT, VarT, ArrowT)
3030 , Info(VarI)
3131 , TyVarBndr(PlainTV, KindedTV)
32− , Pred(ClassP)
32+#if ! MIN_VERSION_template_haskell(2,10,0)
33+ , Pred
34+#endif
35+ , varT
36+ , classP
3337 -- Lifted constructors
3438 -- .. Literals
3539 , stringL
@@ -67,6 +71,10 @@ import Control.Distributed.Process.Serializable
6771 )
6872import Control.Distributed.Process.Internal.Closure.BuiltIn (staticDecode)
6973
74+#if MIN_VERSION_template_haskell(2,10,0)
75+type Pred = Type
76+#endif
77+
7078--------------------------------------------------------------------------------
7179-- User-level API --
7280--------------------------------------------------------------------------------
@@ -244,16 +252,16 @@ generateStatic :: Name -> [TyVarBndr] -> Type -> Q [Dec]
244252generateStatic n xs typ = do
245253 staticTyp <- [t| Static |]
246254 sequence
247− [ sigD (staticName n) $
255+ [ sigD (staticName n) $ do
256+ txs <- sequence $ map typeable xs
248257 return (ForallT xs
249− (map typeable xs)
250− (staticTyp `AppT` typ)
251− )
258+ txs
259+ (staticTyp `AppT` typ))
252260 , sfnD (staticName n) [| staticLabel $(showFQN n) |]
253261 ]
254262 where
255− typeable :: TyVarBndr -> Pred
256− typeable tv = ClassP (mkName "Typeable") [VarT (tyVarBndrName tv)]
263+ typeable :: TyVarBndr -> Q Pred
264+ typeable tv = classP (mkName "Typeable") [varT (tyVarBndrName tv)]
257265
258266-- | Generate a serialization dictionary with name 'n' for type 'typ'
259267generateDict :: Name -> Type -> Q [Dec]