
I'm writing an FFI bindings module, and one of the pieces from the library I want to wrap is their "Error" type.
module Error where
To the user of the module, I'd like to only expose the nicely wrapped interface:
data Error = Error String String instance Typeable Error where ... -- for throwDyn
But within the module's implementation, I need to share some other, internal-only functions:
type ErrorTag = () type ErrorP = Ptr ErrorTag withErrorP :: (ErrorP -> IO a) -> IO a Where withErrorP potentially throwDyns an Error, so it needs the first module.
What is the proper way to divide these up in terms of package exports? The best options I can figure out are either to split these into multiple modules, or to have my "Error" module export them and mark them not to be documented by haddock...