Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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