THRIFT-901. hs: Allow the bindings to compile without -fglasgow-exts and with -Wall -Werror

This patch makes the bindings compile with pedantic warning levels, and individually declares each required language extension.

Patch: Christian Lavoie

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@998955 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/hs/src/Thrift/Protocol/Binary.hs b/lib/hs/src/Thrift/Protocol/Binary.hs
index fa9a207..308ab48 100644
--- a/lib/hs/src/Thrift/Protocol/Binary.hs
+++ b/lib/hs/src/Thrift/Protocol/Binary.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE MagicHash #-}
 --
 -- Licensed to the Apache Software Foundation (ASF) under one
 -- or more contributor license agreements. See the NOTICE file
@@ -37,7 +39,10 @@
 
 import qualified Data.ByteString.Lazy.Char8 as LBS
 
+version_mask :: Int
 version_mask = 0xffff0000
+
+version_1 :: Int
 version_1    = 0x80010000
 
 data BinaryProtocol a = Transport a => BinaryProtocol a
@@ -58,7 +63,7 @@
     writeFieldEnd _ = return ()
     writeFieldStop p = writeType p T_STOP
     writeMapBegin p (k, v, n) = writeType p k >> writeType p v >> writeI32 p n
-    writeMapEnd p = return ()
+    writeMapEnd _ = return ()
     writeListBegin p (t, n) = writeType p t >> writeI32 p n
     writeListEnd _ = return ()
     writeSetBegin p (t, n) = writeType p t >> writeI32 p n
@@ -141,7 +146,7 @@
 getByte i n = 255 .&. (i `shiftR` (8 * n))
 
 getBytes :: (Bits a, Integral a) => a -> Int -> LBS.ByteString
-getBytes i 0 = LBS.empty
+getBytes _ 0 = LBS.empty
 getBytes i n = (toEnum $ fromIntegral $ getByte i (n-1)) `LBS.cons` (getBytes i (n-1))
 
 floatBits :: Double -> Word64