Haskell cleanup, more abstract interface for c functions