blob: 5510de1e747d3dc6b27369ca2e1f4f7676322429 [file] [log] [blame]
iproctorff8eb922007-07-25 19:06:13 +00001Haskell Thrift Bindings
2
Bryan Duxbury6a3705c2009-04-07 23:23:39 +00003Running
4=======
iproctorff8eb922007-07-25 19:06:13 +00005
Bryan Duxbury6a3705c2009-04-07 23:23:39 +00006You need -fglasgow-exts. Use Cabal to compile and install. If you're trying to
7manually compile or load via ghci, and you're using ghc 6.10 (or really if your
8default base package has major version number 4), you must specify a version of
9the base package with major version number 3. Furthermore if you have the syb
10package installed you need to hide that package to avoid import conflicts.
11Here's an example of what I'm talking about:
iproctorff8eb922007-07-25 19:06:13 +000012
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000013 ghci -fglasgow-exts -package base-3.0.3.0 -hide-package syb -isrc Thrift.hs
iproctorff8eb922007-07-25 19:06:13 +000014
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000015To determine which versions of the base package you have installed use the
16following command:
iproctorff8eb922007-07-25 19:06:13 +000017
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000018 ghc-pkg list base
iproctorff8eb922007-07-25 19:06:13 +000019
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000020All of this is taken care of for you if you use Cabal.
iproctorff8eb922007-07-25 19:06:13 +000021
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000022
23Enums
24=====
25
26become haskell data types. Use fromEnum to get out the int value.
27
28Structs
29=======
30
31become records. Field labels are ugly, of the form f_STRUCTNAME_FIELDNAME. All
32fields are Maybe types.
33
34Exceptions
35==========
36
37identical to structs. Throw them with throwDyn. Catch them with catchDyn.
38
39Client
40======
41
42just a bunch of functions. You may have to import a bunch of client files to
43deal with inheritance.
44
45Interface
46=========
47
48You should only have to import the last one in the chain of inheritors. To make
49an interface, declare a label:
50
51 data MyIface = MyIface
52
53and then declare it an instance of each iface class, starting with the superest
54class and proceding down (all the while defining the methods). Then pass your
55label to process as the handler.
56
57Processor
58=========
59
60Just a function that takes a handler label, protocols. It calls the
61superclasses process if there is a superclass.
iproctorff8eb922007-07-25 19:06:13 +000062