[Haskell-cafe] ANNOUNCE: hoppy, qtah

Nicola Gigante nicola.gigante at gmail.com
Tue Feb 9 08:59:37 UTC 2016


> Il giorno 08 feb 2016, alle ore 19:11, Bryan Gardiner <bog at khumba.net> ha scritto:
> 
> Are you 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!  I present to you a tool restoring the good
> old days of pointer arithmetic, manual memory management, and hours
> lost to the debugger:
> 
> Hoppy is a new C++ FFI generator for Haskell.  It takes Haskell code
> that describes a C++ API, and generates C++ and Haskell code to allow
> the two languages to interact.  It supports a good subset of C++,
> including functions, classes, variables, enums and bitflags, operator
> overloading, constness, and simple templates.  Adding a function takes
> only a few lines of code, and you normally don't need to write C++
> yourself.  For example, a definition for std::string is:
> 
>    c_string :: Class
>    c_string =
>      addReqIncludes [includeStd "string"] $
>      classAddFeatures [Assignable, Comparable, Copyable, Equatable] $
>      makeClass (ident1 "std" "string") (Just $ toExtName "StdString") []
>      [ mkCtor "new" []
>      , mkCtor "newFromCString" [TPtr $ TConst TChar]
>      ]
>      [ mkConstMethod' "at" "at" [TInt] $ TRef TChar
>      , mkConstMethod' "at" "get" [TInt] TChar
>      , mkConstMethod "c_str" [] $ TPtr $ TConst TChar
>      , mkConstMethod "size" [] TSize
>      , mkConstMethod OpAdd [TObj c_string] $ TObj c_string
>      ]
> 
> Now, writing a FFI generator isn't much fun unless you have a project
> to use it with.  So I am pleased to also announce Qtah, a fresh set of
> Qt 4/5 bindings.  These include portions of QtCore, QtGui, and
> QtWidgets, and are on the whole wildly incomplete, but are usable for
> basic tasks so far, and I am working on extending coverage.
> 
> (On qtHaskell/hsQt: I started Qtah before qtHaskell began being
> updated in 2015 and I missed when that happened.  My hope is that Qtah
> requires less code and effort to maintain; at least, qtHaskell
> contains a lot of generated code and I haven't seen where it came
> from, so please correct me if the generator is in fact available
> somewhere.  Hoppy also doesn't (currently) do many of the fancy things
> that qtHaskell does, like overloading and garbage collection.)
> 
> Both Hoppy and Qtah are young, and I am very interested in discussing
> how to make them most useful for the community.  Because of questions
> such as this[1], their APIs (including those of generated bindings)
> should be considered experimental at this time.
> 
> I will be uploading Hoppy to Hackage shortly.  Becuase Qtah includes a
> shared library, I haven't figured out how to get that on Hackage yet,
> so you'll have to clone the repo yourself.
> 
> http://khumba.net/projects/hoppy
> 
> http://khumba.net/projects/qtah
> 
> Happy hacking!
> 

That’s wonderful!

A couple of questions:
- Do you think it would fit well to provide a monadic interface to construct
  a clean and readable DSL on top of your functions?
- What is the definition of “simple” template?

Good job!

> Bryan Gardiner

Regards,
Nicola


More information about the Haskell-Cafe mailing list