git.iko.soy/distributed-process
on master help sign in
Compatibility with ghc-7.10: support new TH.
7c233d1Alexander Vershilov
distributed-process.cabal+1−1
@@ -103,7 +103,7 @@ Library
103 if impl(ghc <= 7.4.2)
103 if impl(ghc <= 7.4.2)
104 Build-Depends: template-haskell >= 2.7 && < 2.8
104 Build-Depends: template-haskell >= 2.7 && < 2.8
105 else
105 else
106− Build-Depends: template-haskell >= 2.6 && < 2.10
106+ Build-Depends: template-haskell >= 2.6 && < 2.11
107 Exposed-modules: Control.Distributed.Process.Internal.Closure.TH
107 Exposed-modules: Control.Distributed.Process.Internal.Closure.TH
108 CPP-Options: -DTemplateHaskellSupport
108 CPP-Options: -DTemplateHaskellSupport
109
109
src/Control/Distributed/Process/Internal/Closure/TH.hs+16−8
@@ -1,5 +1,5 @@
1-- | Template Haskell support
1-- | Template Haskell support
2−{-# LANGUAGE TemplateHaskell #-}
2+{-# LANGUAGE TemplateHaskell, CPP #-}
3module Control.Distributed.Process.Internal.Closure.TH
3module Control.Distributed.Process.Internal.Closure.TH
4 ( -- * User-level API
4 ( -- * User-level API
5 remotable
5 remotable
@@ -29,7 +29,11 @@ import Language.Haskell.TH
29 , Type(AppT, ForallT, VarT, ArrowT)
29 , Type(AppT, ForallT, VarT, ArrowT)
30 , Info(VarI)
30 , Info(VarI)
31 , TyVarBndr(PlainTV, KindedTV)
31 , TyVarBndr(PlainTV, KindedTV)
32− , Pred(ClassP)
32+#if ! MIN_VERSION_template_haskell(2,10,0)
33+ , Pred
34+#endif
35+ , varT
36+ , classP
33 -- Lifted constructors
37 -- Lifted constructors
34 -- .. Literals
38 -- .. Literals
35 , stringL
39 , stringL
@@ -67,6 +71,10 @@ import Control.Distributed.Process.Serializable
67 )
71 )
68import Control.Distributed.Process.Internal.Closure.BuiltIn (staticDecode)
72import Control.Distributed.Process.Internal.Closure.BuiltIn (staticDecode)
69
73
74+#if MIN_VERSION_template_haskell(2,10,0)
75+type Pred = Type
76+#endif
77+
70--------------------------------------------------------------------------------
78--------------------------------------------------------------------------------
71-- User-level API --
79-- User-level API --
72--------------------------------------------------------------------------------
80--------------------------------------------------------------------------------
@@ -244,16 +252,16 @@ generateStatic :: Name -> [TyVarBndr] -> Type -> Q [Dec]
244generateStatic n xs typ = do
252generateStatic n xs typ = do
245 staticTyp <- [t| Static |]
253 staticTyp <- [t| Static |]
246 sequence
254 sequence
247− [ sigD (staticName n) $
255+ [ sigD (staticName n) $ do
256+ txs <- sequence $ map typeable xs
248 return (ForallT xs
257 return (ForallT xs
249− (map typeable xs)
258+ txs
250− (staticTyp `AppT` typ)
259+ (staticTyp `AppT` typ))
251− )
252 , sfnD (staticName n) [| staticLabel $(showFQN n) |]
260 , sfnD (staticName n) [| staticLabel $(showFQN n) |]
253 ]
261 ]
254 where
262 where
255− typeable :: TyVarBndr -> Pred
263+ typeable :: TyVarBndr -> Q Pred
256− typeable tv = ClassP (mkName "Typeable") [VarT (tyVarBndrName tv)]
264+ typeable tv = classP (mkName "Typeable") [varT (tyVarBndrName tv)]
257
265
258-- | Generate a serialization dictionary with name 'n' for type 'typ'
266-- | Generate a serialization dictionary with name 'n' for type 'typ'
259generateDict :: Name -> Type -> Q [Dec]
267generateDict :: Name -> Type -> Q [Dec]