THRIFT-906. hs: Improve type mappings

This patch fixes the type mappings to be more sane. It *will* break existing code, but the breakages should be well worth it.

Patch: Christian Lavoie

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@999700 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/hs/src/Thrift.hs b/lib/hs/src/Thrift.hs
index 182df3f..71957c4 100644
--- a/lib/hs/src/Thrift.hs
+++ b/lib/hs/src/Thrift.hs
@@ -82,7 +82,7 @@
         writeFieldEnd pt
 
     writeFieldBegin pt ("type", T_I32, 2);
-    writeI32 pt (fromEnum (ae_type ae))
+    writeI32 pt (fromIntegral $ fromEnum (ae_type ae))
     writeFieldEnd pt
     writeFieldStop pt
     writeStructEnd pt
@@ -107,7 +107,7 @@
                                   readAppExnFields pt rec
                  2 -> if ft == T_I32 then
                           do i <- readI32 pt
-                             readAppExnFields pt rec{ae_type = (toEnum  i)}
+                             readAppExnFields pt rec{ae_type = (toEnum $ fromIntegral i)}
                           else do skip pt ft
                                   readAppExnFields pt rec
                  _ -> do skip pt ft