iproctor | ff8eb92 | 2007-07-25 19:06:13 +0000 | [diff] [blame^] | 1 | Haskell Thrift Bindings |
| 2 | |
| 3 | Running: you need -fglasgow-exts. |
| 4 | |
| 5 | Enums: become haskell data types. Use fromEnum to get out the int value. |
| 6 | |
| 7 | Structs: become records. Field labels are ugly, of the form f_STRUCTNAME_FIELDNAME. All fields are Maybe types. |
| 8 | |
| 9 | Exceptions: identical to structs. Throw them with throwDyn. Catch them with catchDyn. |
| 10 | |
| 11 | Client: just a bunch of functions. You may have to import a bunch of client files to deal with inheritance. |
| 12 | |
| 13 | Interface: You should only have to import the last one in the chain of inheritors. To make an interface, declare a label: |
| 14 | data MyIface = MyIface |
| 15 | and then declare it an instance of each iface class, starting with the superest class and proceding down (all the while defining the methods). |
| 16 | Then pass your label to process as the handler. |
| 17 | |
| 18 | Processor: Just a function that takes a handler label, protocols. It calls the superclasses process if there is a superclass. |
| 19 | |
| 20 | |
| 21 | Note: Protocols implement flush as well as transports and do not have a getTransport method. This is because I couldn't get getTransport to typecheck. Shrug. |
| 22 | |