blob: e58c8c93f647e88aa755b2b42d2cd1ca6a81c12b [file] [log] [blame]
iproctorff8eb922007-07-25 19:06:13 +00001Haskell Thrift Bindings
2
Bryan Duxburydef30a62009-04-08 00:19:37 +00003License
4=======
5
6Licensed to the Apache Software Foundation (ASF) under one
7or more contributor license agreements. See the NOTICE file
8distributed with this work for additional information
9regarding copyright ownership. The ASF licenses this file
10to you under the Apache License, Version 2.0 (the
11"License"); you may not use this file except in compliance
12with the License. You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16Unless required by applicable law or agreed to in writing,
17software distributed under the License is distributed on an
18"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19KIND, either express or implied. See the License for the
20specific language governing permissions and limitations
21under the License.
22
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000023Running
24=======
iproctorff8eb922007-07-25 19:06:13 +000025
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000026You need -fglasgow-exts. Use Cabal to compile and install. If you're trying to
27manually compile or load via ghci, and you're using ghc 6.10 (or really if your
28default base package has major version number 4), you must specify a version of
29the base package with major version number 3. Furthermore if you have the syb
30package installed you need to hide that package to avoid import conflicts.
31Here's an example of what I'm talking about:
iproctorff8eb922007-07-25 19:06:13 +000032
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000033 ghci -fglasgow-exts -package base-3.0.3.0 -hide-package syb -isrc Thrift.hs
iproctorff8eb922007-07-25 19:06:13 +000034
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000035To determine which versions of the base package you have installed use the
36following command:
iproctorff8eb922007-07-25 19:06:13 +000037
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000038 ghc-pkg list base
iproctorff8eb922007-07-25 19:06:13 +000039
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000040All of this is taken care of for you if you use Cabal.
iproctorff8eb922007-07-25 19:06:13 +000041
Bryan Duxbury6a3705c2009-04-07 23:23:39 +000042
43Enums
44=====
45
46become haskell data types. Use fromEnum to get out the int value.
47
48Structs
49=======
50
51become records. Field labels are ugly, of the form f_STRUCTNAME_FIELDNAME. All
52fields are Maybe types.
53
54Exceptions
55==========
56
57identical to structs. Throw them with throwDyn. Catch them with catchDyn.
58
59Client
60======
61
62just a bunch of functions. You may have to import a bunch of client files to
63deal with inheritance.
64
65Interface
66=========
67
68You should only have to import the last one in the chain of inheritors. To make
69an interface, declare a label:
70
71 data MyIface = MyIface
72
73and then declare it an instance of each iface class, starting with the superest
74class and proceding down (all the while defining the methods). Then pass your
75label to process as the handler.
76
77Processor
78=========
79
80Just a function that takes a handler label, protocols. It calls the
81superclasses process if there is a superclass.
iproctorff8eb922007-07-25 19:06:13 +000082