git.iko.soy/distributed-process
on master help sign in
Drop conditional compilation in Control.Distributed.Process.Serializable.
fb57da3Facundo Domínguez
src/Control/Distributed/Process/Serializable.hs+3−20
@@ -3,7 +3,6 @@
3{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE ScopedTypeVariables #-}
4{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE GADTs #-}
5{-# LANGUAGE GADTs #-}
6−{-# LANGUAGE CPP #-}
7module Control.Distributed.Process.Serializable
6module Control.Distributed.Process.Serializable
8 ( Serializable
7 ( Serializable
9 , encodeFingerprint
8 , encodeFingerprint
@@ -18,17 +17,7 @@ module Control.Distributed.Process.Serializable
18
17
19import Data.Binary (Binary)
18import Data.Binary (Binary)
20
19
21−#if MIN_VERSION_base(4,10,0)
22−import Data.Typeable (Typeable)
20+import Data.Typeable (Typeable, typeRepFingerprint, typeOf)
23−import Type.Reflection (typeRep)
24−import Type.Reflection.Unsafe (TypeRep, typeRepFingerprint)
25−#elif MIN_VERSION_base(4,7,0)
26−import Data.Typeable (Typeable)
27−import Data.Typeable.Internal (TypeRep(TypeRep), typeOf)
28−#else
29−import Data.Typeable (Typeable(..))
30−import Data.Typeable.Internal (TypeRep(TypeRep))
31−#endif
32
21
33import Numeric (showHex)
22import Numeric (showHex)
34import Control.Exception (throw)
23import Control.Exception (throw)
@@ -75,14 +64,8 @@ sizeOfFingerprint :: Int
75sizeOfFingerprint = sizeOf (undefined :: Fingerprint)
64sizeOfFingerprint = sizeOf (undefined :: Fingerprint)
76
65
77-- | The fingerprint of the typeRep of the argument
66-- | The fingerprint of the typeRep of the argument
78−fingerprint :: forall a. Typeable a => a -> Fingerprint
67+fingerprint :: Typeable a => a -> Fingerprint
79−#if MIN_VERSION_base(4,10,0)
80−fingerprint _ = typeRepFingerprint (typeRep :: TypeRep a)
68+fingerprint = typeRepFingerprint . typeOf
81−#elif MIN_VERSION_base(4,8,0)
82−fingerprint a = let TypeRep fp _ _ _ = typeOf a in fp
83−#else
84−fingerprint a = let TypeRep fp _ _ = typeOf a in fp
85−#endif
86
69
87-- | Show fingerprint (for debugging purposes)
70-- | Show fingerprint (for debugging purposes)
88showFingerprint :: Fingerprint -> ShowS
71showFingerprint :: Fingerprint -> ShowS