[Haskell-cafe] Eager global IO actions (per module initialization)

Einar Karttunen ekarttun at cs.helsinki.fi
Thu Sep 28 08:59:17 EDT 2006


I am needing a way to run initializers defined in various modules 
in an eager fashion before main. I am doing this to load
deserialization functions for a Typeable function.

Basically I have code like:

$(inferDecoderAndRegisterItOnStartup ''MyType)

which defines a class instance, but additionally I want to
call 'registerDecoderForType "MyType" decodeMyType' automatically
on startup.

Calling registerDecodeForType for all types in main gets very tedious
and error-prone when doing things by hand. Thus an automated solution
would be very nice.

- Einar Karttunen

More information about the Haskell-Cafe mailing list