Skip to content

well-typed/hs-bindgen-tutorial-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate Haskell bindings from C header files with hs-bindgen

In this tutorial, we showcase the automatic generation of Haskell bindings with hs-bindgen on selected libraries:

libpcap is an interface to various kernel packet capture mechanisms. We present two methods to generate Haskell bindings and use the generated bindings to print the list of network devices available on the local machine. The tutorial on pcap is available in the hs-pcap sub-folder of this repository.

wlroots is a modular Wayland compositor library. The wlroots project is more complex than libpcap and depends on non-system libraries such as Wayland and Pixman. Therefore, we split the generation of Haskell bindings into several library components. We use external binding specifications to inform higher-level library components about types defined in lower-level library components. The tutorial on wlroots is available in the hs-wlroots sub-folder of this repository.

Note

In both cases we use the Nix package manager to manage installation of hs-bindgen and other system dependencies.

Important

Last update: January 13, 2026. The upstream Nix Flake may have received updates in the meantime.

About

Tutorial on integration of hs-bindgen in Nix workflow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published