Sick and tired of the ease with which Haskell code flows onto the page? Even the thrill of binding to a C library losing its lustre? Look no further! Hoppy is a tool restoring the good old days of pointers, manual memory management, and hours lost to the debugger.
Hoppy is a foreign function interface generator for accessing C++ libraries from Haskell. Interface descriptions are written in Haskell, then compiled into a generator that produces C++ and Haskell bindings that interact. Hoppy should work on any *nix platform that supports GHC.
c_QPushButton :: Class c_QPushButton = addReqIncludes [includeStd "QPushButton"] $ makeClass (ident "QPushButton") Nothing [c_QAbstractButton] [ -- Constructors. mkCtor "new"  , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithText" [objT c_QString] , mkCtor "newWithTextAndParent" [objT c_QString, ptrT $ objT c_QWidget] -- Methods. , mkMethod "showMenu"  voidT -- Getter/setter pairs. , mkProp "autoDefault" boolT , mkBoolIsProp "default" , mkBoolIsProp "flat" , mkProp "menu" $ ptrT $ objT c_QMenu ]
2019-09-29: Hoppy 0.6.0 has at long last been released. The codebase has undergone significant refactoring to generalize concepts that were baked in before. It is now possible to define one's own exportable entities, and define custom marshalling for function parameters and return values; the built-in function, enum, class, etc. data types are much less special now. Function parameters can now be named and these names will show up in binding documentation. Also, enums have seen many improvements, the main one being that enums' ordinal values can now be autodetected, and no longer have to be written into generators manually. The Nix infrastructure has also been updated for this release.
2018-06-05: Hoppy 0.5.0 is out, with fixes for exception
std::set, and building on
macOS. Bindings for STL unordered collections were added.
2018-01-27: Hoppy 0.4.0 is out, fixing an important bug in the generator where non-const class methods could be declared and then called as const functions, breaking const-safety. Please update your bindings. Code changes are only necessary when methods are declared incorrectly.
2017-06-10: New minor versions of Hoppy packages have been released. Hoppy now includes Setup.hs hooks for easy packaging of bindings, and callbacks are default-constructable on the C++ side.
2016-12-16: Released Hoppy 0.3.0 with support for exceptions, function pointers, and class member variables. Simplified class member lists, improved conversion flexibility, and class/enum member naming.
2016-06-29: Released Hoppy 0.2.0 with garbage collector support, and a restructuring of the API specification data types for future flexibility.
Hoppy is available in four separate parts:
Of the different packages, only hoppy-runtime is a dependency of generated bindings, but it is required by all generated bindings. The Hackage version is also suitable for binding development. There is a users guide available in the hoppy-docs package.
For Gentoo users, my overlay contains Hoppy ebuilds, and Nix expressions are in Nixpkgs.
With the aim of preserving the openness of Hoppy as free software, most of Hoppy is licensed under the GNU Affero General Public License v3 or later. However, some parts are licensed more permissively to allow the use of Hoppy in creating bindings to software of any license. Parts of Hoppy that have significant portions included in the output (hoppy-std) or are a dependency of generated bindings (hoppy-runtime) are available under the Apache 2.0 license, so in general, projects using Hoppy are only bound by Apache 2.0.