Thrift: Haskell library and codegen

Summary: It's thrift for haskell. The codegen is complete. The library has binary protocol, io channel transport, and a threaded server.
Reviewed by: mcslee
Test plan: Yes
Revert plan: yes


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665174 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/hs/Client.hs b/test/hs/Client.hs
new file mode 100644
index 0000000..10e5929
--- /dev/null
+++ b/test/hs/Client.hs
@@ -0,0 +1,29 @@
+module Client where
+import Thrift
+import ThriftTest_Client
+import ThriftTest_Types
+import TSocket
+import TBinaryProtocol
+import qualified Data.Map as Map
+import qualified Data.Set as Set
+import Control.Monad
+t = TSocket "127.0.0.1" 9090 Nothing
+
+main = do to <- topen t
+          let p =  TBinaryProtocol to
+          let ps = (p,p)
+          print =<< testString ps "bya"
+          print =<< testByte ps 8
+          print =<< testByte ps (-8)
+          print =<< testI32 ps 32
+          print =<< testI32 ps (-32)
+          print =<< testI64 ps 64
+          print =<< testI64 ps (-64)
+          print =<< testDouble ps 3.14
+          print =<< testDouble ps (-3.14)
+          print =<< testMap ps (Map.fromList [(1,1),(2,2),(3,3)])
+          print =<< testList ps [1,2,3,4,5]
+          print =<< testSet ps (Set.fromList [1,2,3,4,5])
+          print =<< testStruct ps (Xtruct (Just "hi") (Just 4) (Just 5) Nothing)
+          tclose to
+          
diff --git a/test/hs/Server.hs b/test/hs/Server.hs
new file mode 100644
index 0000000..ee4fd20
--- /dev/null
+++ b/test/hs/Server.hs
@@ -0,0 +1,33 @@
+module Server where
+import Thrift
+import ThriftTest
+import ThriftTest_Iface
+import Data.Map as Map
+import TServer
+import Control.Exception
+import ThriftTest_Types
+
+
+data TestHandler = TestHandler
+instance ThriftTest_Iface TestHandler where
+    testVoid a = return ()
+    testString a (Just s) = do print s; return s
+    testByte a (Just x) = do print x; return x
+    testI32 a (Just x) = do print x; return x
+    testI64 a (Just x) = do print x; return x
+    testDouble a (Just x) = do print x; return x
+    testStruct a (Just x) = do print x; return x
+    testNest a (Just x) = do print x; return x
+    testMap a (Just x) = do print x; return x
+    testSet a (Just x) = do print x; return x
+    testList a (Just x) = do print x; return x
+    testEnum a (Just x) = do print x; return x
+    testTypedef a (Just x) = do print x; return x
+    testMapMap a (Just x) = return (Map.fromList [(1,Map.fromList [(2,2)])])
+    testInsanity a (Just x) = return (Map.fromList [(1,Map.fromList [(ONE,x)])])
+    testMulti a a1 a2 a3 a4 a5 a6 = return (Xtruct Nothing Nothing Nothing Nothing)
+    testException a c = throwDyn (Xception (Just 1) (Just "bya"))
+    testMultiException a c1 c2 = return (Xtruct Nothing Nothing Nothing Nothing)
+
+
+main = do (run_basic_server TestHandler process 9090) `catchDyn` (\(TransportExn s t) -> print s)
diff --git a/test/hs/runclient.sh b/test/hs/runclient.sh
new file mode 100644
index 0000000..3dace0a
--- /dev/null
+++ b/test/hs/runclient.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+ghci -fglasgow-exts -i/home/iproctor/code/projects/thrift/trunk/lib/hs/src -igen-hs Client.hs
diff --git a/test/hs/runserver.sh b/test/hs/runserver.sh
new file mode 100644
index 0000000..c090155
--- /dev/null
+++ b/test/hs/runserver.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+ghci -fglasgow-exts -i/home/iproctor/code/projects/thrift/trunk/lib/hs/src -igen-hs Server.hs