[commit: packages/binary] master: Instance for GHC.Fingerprint, which is part of base. (551515e)

git at git.haskell.org git at git.haskell.org
Wed Dec 16 09:42:16 UTC 2015


Repository : ssh://git@git.haskell.org/binary

On branch  : master
Link       : http://git.haskell.org/packages/binary.git/commitdiff/551515ec34daf416b69a17eb843a202662b5b0a1

>---------------------------------------------------------------

commit 551515ec34daf416b69a17eb843a202662b5b0a1
Author: Mathieu Boespflug <m at tweag.io>
Date:   Sat May 23 23:08:57 2015 +0200

    Instance for GHC.Fingerprint, which is part of base.


>---------------------------------------------------------------

551515ec34daf416b69a17eb843a202662b5b0a1
 src/Data/Binary/Class.hs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs
index 2477056..1cba18a 100644
--- a/src/Data/Binary/Class.hs
+++ b/src/Data/Binary/Class.hs
@@ -77,6 +77,10 @@ import qualified Data.Sequence as Seq
 import qualified Data.Foldable as Fold
 #endif
 
+#if __GLASGOW_HASKELL__ >= 704
+import GHC.Fingerprint
+#endif
+
 ------------------------------------------------------------------------
 
 #ifdef GENERICS
@@ -577,3 +581,17 @@ instance (Binary i, Ix i, Binary e, IArray UArray e) => Binary (UArray i e) wher
         n  <- get
         xs <- getMany n
         return (listArray bs xs)
+
+------------------------------------------------------------------------
+-- Fingerprints
+
+#if __GLASGOW_HASKELL__ >= 704
+instance Binary Fingerprint where
+    put (Fingerprint x1 x2) = do
+        put x1
+        put x2
+    get = do
+        x1 <- get
+        x2 <- get
+        return (Fingerprint x1 x2)
+#endif



More information about the ghc-commits mailing list