[commit: packages/binary] master: Use applicative form in 'get' for Version. (67ccd53)

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


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

On branch  : master
Link       : http://git.haskell.org/packages/binary.git/commitdiff/67ccd5398f199f3e92cc7c34dcf0fa47d41c3011

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

commit 67ccd5398f199f3e92cc7c34dcf0fa47d41c3011
Author: Lennart Kolmodin <kolmodin at google.com>
Date:   Wed Nov 11 16:05:39 2015 +0100

    Use applicative form in 'get' for Version.


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

67ccd5398f199f3e92cc7c34dcf0fa47d41c3011
 src/Data/Binary/Class.hs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs
index 5aacb5f..eb11cb4 100644
--- a/src/Data/Binary/Class.hs
+++ b/src/Data/Binary/Class.hs
@@ -47,6 +47,9 @@ import Data.Int
 import Data.Binary.Put
 import Data.Binary.Get
 
+#if ! MIN_VERSION_base(4,8,0)
+import Control.Applicative
+#endif
 import Control.Monad
 
 import Data.ByteString.Lazy (ByteString)
@@ -614,8 +617,5 @@ instance Binary Fingerprint where
 
 -- | /Since: binary-0.8/
 instance Binary Version where
-    get = do
-        br <- get
-        tags <- get
-        return $ Version br tags
+    get = Version <$> get <*> get
     put (Version br tags) = put br >> put tags



More information about the ghc-commits mailing list