I'm writing a library in Haskell, in which there are parameters that must be initialized, but never changes during execution. For example:
initialize :: CInt -> CPtr CInt -> IO ParameterData
However, ParameterData
is a complex datatype that is too expensive to build up every time I need it. How can I set up the program so that when the C code calls the initialization function, it computes a ParameterData
and sets it somewhere as a constant that the rest of the Haskell library can access?