Rev 30 | Blame | Compare with Previous | Last modification | View Log | RSS feed
Haskell Thrift BindingsLicense=======Licensed to the Apache Software Foundation (ASF) under oneor more contributor license agreements. See the NOTICE filedistributed with this work for additional informationregarding copyright ownership. The ASF licenses this fileto you under the Apache License, Version 2.0 (the"License"); you may not use this file except in compliancewith the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,software distributed under the License is distributed on an"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied. See the License for thespecific language governing permissions and limitationsunder the License.Running=======You need -fglasgow-exts. Use Cabal to compile and install. If you're trying tomanually compile or load via ghci, and you're using ghc 6.10 (or really if yourdefault base package has major version number 4), you must specify a version ofthe base package with major version number 3. Furthermore if you have the sybpackage installed you need to hide that package to avoid import conflicts.Here's an example of what I'm talking about:ghci -fglasgow-exts -package base-3.0.3.0 -hide-package syb -isrc Thrift.hsTo determine which versions of the base package you have installed use thefollowing command:ghc-pkg list baseAll of this is taken care of for you if you use Cabal.Enums=====become haskell data types. Use fromEnum to get out the int value.Structs=======become records. Field labels are ugly, of the form f_STRUCTNAME_FIELDNAME. Allfields are Maybe types.Exceptions==========identical to structs. Throw them with throwDyn. Catch them with catchDyn.Client======just a bunch of functions. You may have to import a bunch of client files todeal with inheritance.Interface=========You should only have to import the last one in the chain of inheritors. To makean interface, declare a label:data MyIface = MyIfaceand then declare it an instance of each iface class, starting with the superestclass and proceding down (all the while defining the methods). Then pass yourlabel to process as the handler.Processor=========Just a function that takes a handler label, protocols. It calls thesuperclasses process if there is a superclass.