Hoppy - C++ FFI Generator for Haskell

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.

The binding definition for Qt's QPushButton class in Qtah looks like:

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


Latest News

See the changelog for further detail into what's mentioned here.

2024-06-01: Hoppy 0.9.0 released

2024-04-28: Fool me twice (moving to Sourcehut)

2021-02-06: Hoppy 0.8.0 and Qtah 0.8.0 released

2019-12-23: Hoppy 0.7.0 is released

2019-09-29: Hoppy 0.6.0 released.  This is a major new release including enum value autodetection, named function parameters, support for custom exportable entities and marshalling, among other improvements.

See all posts related to Hoppy.


Hoppy is available in four separate parts:

Of the different packages, only hoppy-runtime is a direct dependency of generated bindings, but it is required by all generated bindings.  The Hackage version is also suitable for binding development.  There is a user's guide available in the hoppy-docs package.

For Gentoo users, my overlay contains Hoppy ebuilds, and Nix expressions are available for Nix users (as well as from Nixpkgs).


Hoppy is hosted on Sourcehut: project page, issue tracker.  Clone the source from one of:


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 other licenses.  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.