THRIFT-2641 Improvements to Haskell Compiler/Libraries

- test/test.sh integration
- add json and compact protocol

This closes #175

Signed-off-by: Roger Meier <roger@apache.org>
diff --git a/tutorial/hs/HaskellClient.hs b/tutorial/hs/HaskellClient.hs
index 18d72ad..bd29df0 100644
--- a/tutorial/hs/HaskellClient.hs
+++ b/tutorial/hs/HaskellClient.hs
@@ -48,27 +48,27 @@
   printf "1+1=%d\n" sum
 
 
-  let work = Work { f_Work_op = Just DIVIDE,
-                    f_Work_num1 = Just 1,
-                    f_Work_num2 = Just 0,
-                    f_Work_comment = Nothing
+  let work = Work { work_op = DIVIDE,
+                    work_num1 = 1,
+                    work_num2 = 0,
+                    work_comment = Nothing
                   }
 
   Control.Exception.catch (printf "1/0=%d\n" =<< Client.calculate client 1 work)
         (\e -> printf "InvalidOperation %s\n" (show (e :: InvalidOperation)))
 
 
-  let work = Work { f_Work_op = Just SUBTRACT,
-                    f_Work_num1 = Just 15,
-                    f_Work_num2 = Just 10,
-                    f_Work_comment = Nothing
+  let work = Work { work_op = SUBTRACT,
+                    work_num1 = 15,
+                    work_num2 = 10,
+                    work_comment = Nothing
                   }
 
   diff <- Client.calculate client 1 work
   printf "15-10=%d\n" diff
 
   log <- SClient.getStruct client 1
-  printf "Check log: %s\n"  $ fromJust $ unpack `fmap` f_SharedStruct_value log
+  printf "Check log: %s\n" $ unpack $ sharedStruct_value log
 
   -- Close!
   tClose transport
diff --git a/tutorial/hs/HaskellServer.hs b/tutorial/hs/HaskellServer.hs
index 212e722..77f1679 100644
--- a/tutorial/hs/HaskellServer.hs
+++ b/tutorial/hs/HaskellServer.hs
@@ -49,7 +49,7 @@
 instance SharedService_Iface CalculatorHandler where
   getStruct self k = do
     myLog <- readMVar (mathLog self)
-    return $ (myLog ! (fromJust k))
+    return $ (myLog ! k)
 
 
 instance Calculator_Iface CalculatorHandler where
@@ -57,8 +57,8 @@
     print "ping()"
 
   add _ n1 n2 = do
-    printf "add(%d,%d)\n" (fromJust n1) (fromJust n2)
-    return ((fromJust n1)+(fromJust n2))
+    printf "add(%d,%d)\n" n1 n2
+    return (n1 + n2)
 
   calculate self mlogid mwork = do
     printf "calculate(%d, %s)\n" logid (show work)
@@ -74,27 +74,24 @@
                     if num2 work == 0 then
                         throw $
                               InvalidOperation {
-                                 f_InvalidOperation_what = Just $ fromIntegral $ fromEnum $ op work,
-                                 f_InvalidOperation_why = Just "Cannot divide by 0"
+                                 invalidOperation_what = fromIntegral $ fromEnum $ op work,
+                                 invalidOperation_why = "Cannot divide by 0"
                                             }
                     else
                         num1 work `div` num2 work
 
-    let logEntry = SharedStruct (Just logid) (Just (fromString $ show $ val))
+    let logEntry = SharedStruct logid (fromString $ show $ val)
     modifyMVar_ (mathLog self) $ return .(M.insert logid logEntry)
 
     return $! val
 
    where
      -- stupid dynamic languages f'ing it up
-     num1 = fromJust . f_Work_num1
-     num2 = fromJust . f_Work_num2
-     op = fromJust . f_Work_op
-     logid = fromJust mlogid
-     work = fromJust mwork
-
-
-    --return val
+     num1 = work_num1
+     num2 = work_num2
+     op = work_op
+     logid = mlogid
+     work = mwork
 
   zip _ =
     print "zip()"
diff --git a/tutorial/hs/ThriftTutorial.cabal b/tutorial/hs/ThriftTutorial.cabal
index 6cc29e8..b38fc5c 100755
--- a/tutorial/hs/ThriftTutorial.cabal
+++ b/tutorial/hs/ThriftTutorial.cabal
@@ -37,7 +37,7 @@
   Hs-Source-Dirs:
     ., gen-hs/
   Build-Depends:
-    base >= 4, base < 5, network, ghc-prim, containers, thrift, vector, unordered-containers, text, hashable, bytestring
+    base >= 4, base < 5, network, ghc-prim, containers, thrift, vector, unordered-containers, text, hashable, bytestring, QuickCheck
   Extensions:
     DeriveDataTypeable,
     ExistentialQuantification,
@@ -53,7 +53,7 @@
   Hs-Source-Dirs:
     ., gen-hs/
   Build-Depends:
-    base >= 4, base < 5, network, ghc-prim, containers, thrift, vector
+    base >= 4, base < 5, network, ghc-prim, containers, thrift, vector, QuickCheck
   Extensions:
     DeriveDataTypeable,
     ExistentialQuantification,