[commit: packages/binary] master: Add Binary Version instance (48c1250)

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


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

On branch  : master
Link       : http://git.haskell.org/packages/binary.git/commitdiff/48c12500ae34ad6e0d8e23edf81a8d3564bfdb48

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

commit 48c12500ae34ad6e0d8e23edf81a8d3564bfdb48
Author: Oleg Grenrus <oleg.grenrus at iki.fi>
Date:   Fri Oct 2 13:10:49 2015 +0300

    Add Binary Version instance


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

48c12500ae34ad6e0d8e23edf81a8d3564bfdb48
 src/Data/Binary/Class.hs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs
index 37117f7..5aacb5f 100644
--- a/src/Data/Binary/Class.hs
+++ b/src/Data/Binary/Class.hs
@@ -86,6 +86,8 @@ import qualified Data.Foldable as Fold
 import GHC.Fingerprint
 #endif
 
+import Data.Version (Version(..))
+
 ------------------------------------------------------------------------
 
 #ifdef GENERICS
@@ -606,3 +608,14 @@ instance Binary Fingerprint where
         x2 <- get
         return $! Fingerprint x1 x2
 #endif
+
+------------------------------------------------------------------------
+-- Version
+
+-- | /Since: binary-0.8/
+instance Binary Version where
+    get = do
+        br <- get
+        tags <- get
+        return $ Version br tags
+    put (Version br tags) = put br >> put tags



More information about the ghc-commits mailing list