How does one interface with a C enum using Haskell and FFI?

Viewed 2062

Let's say charm.c has an enum key and a function get_key() that returns a key type value.

How can I expose a corresponding Haskell Key record and function getKey :: IO Key?

And how can I do this without manually specifying how every single enum value maps to a Haskell value?

1 Answers
Related