[commit: packages/binary] master: Only support Void for >= GHC 7.10. (0adaed9)
git at git.haskell.org
git at git.haskell.org
Wed Dec 16 09:43:25 UTC 2015
Repository : ssh://git@git.haskell.org/binary
On branch : master
Link : http://git.haskell.org/packages/binary.git/commitdiff/0adaed92127dde38d5fd9ad584b0e2215f0eb09a
>---------------------------------------------------------------
commit 0adaed92127dde38d5fd9ad584b0e2215f0eb09a
Author: Lennart Kolmodin <kolmodin at google.com>
Date: Wed Nov 11 11:12:14 2015 +0100
Only support Void for >= GHC 7.10.
>---------------------------------------------------------------
0adaed92127dde38d5fd9ad584b0e2215f0eb09a
binary.cabal | 4 ----
src/Data/Binary/Class.hs | 5 +++++
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/binary.cabal b/binary.cabal
index 503e588..37ed51c 100644
--- a/binary.cabal
+++ b/binary.cabal
@@ -50,10 +50,6 @@ library
-- prior to ghc-7.4 generics lived in ghc-prim
build-depends: ghc-prim
- if impl(ghc <= 7.8)
- -- Data.Void was moved to base for 7.10
- build-depends: void
-
ghc-options: -O2 -Wall -fliberate-case-threshold=1000
-- Due to circular dependency, we cannot make any of the test-suites or
diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs
index 9984a93..a022a42 100644
--- a/src/Data/Binary/Class.hs
+++ b/src/Data/Binary/Class.hs
@@ -8,6 +8,7 @@
#if MIN_VERSION_base(4,8,0)
#define HAS_NATURAL
+#define HAS_VOID
#endif
#if __GLASGOW_HASKELL__ >= 704
@@ -43,7 +44,9 @@ module Data.Binary.Class (
import Data.Word
import Data.Bits
import Data.Int
+#ifdef HAS_VOID
import Data.Void
+#endif
import Data.Binary.Put
import Data.Binary.Get
@@ -129,11 +132,13 @@ class Binary t where
------------------------------------------------------------------------
-- Simple instances
+#ifdef HAS_VOID
-- Void never gets written nor reconstructed since it's impossible to have a
-- value of that type
instance Binary Void where
put = absurd
get = mzero
+#endif
-- The () type need never be written to disk: values of singleton type
-- can be reconstructed from the type alone
More information about the ghc-commits
mailing list