Bindings to Linux I2C with support for repeated-start transactions.


LTS Haskell 13.30:1.0.0
Stackage Nightly 2019-01-07:1.0.0
Latest on Hackage:1.0.0

See all snapshots h2c appears in

MIT licensed by Edward Amsden
Maintained by [email protected]
This version can be pinned in stack with:h2c-1.0.0@sha256:32fcb3552fc4ddd3e1336d59dbb0f695e86c12fa8fa28e1c956cc498dafe0fde,1112

Module documentation for 1.0.0

Used by 1 package in lts-11.22(full list with versions):

h2c: Haskell bindings to Linux I2C API

H2C is a binding to the Linux i2c-tools/i2c-dev API. It uses the I2C_RDWR ioctl for repeated-start communications between master and slave.


  • You’ll probably have to run as root. Getting regular users direct access to i2c busses on Linux is tricky.
  • The Linux i2c-stub driver that you might think would be useful for testing doesn’t support the I2C_RDWR ioctl. This is why, if you try to use it, you’ll get the “invalid argument” error.


$ stack haddock --open, find module System.IO.I2C

BE CAREFUL WITH I2C. It can be used to poke at things like your graphics card, fans, &c.

See my library bno055-haskell for examples of h2c in use.