[Haskell-cafe] Template Haskell and unsafePerformIO

Achim Schneider barsoap at web.de
Sat Oct 18 19:59:44 EDT 2008


Shouldn't be there some kind of way to run IO code once at the
beginning of template processing? Something like a pair of

templateInit :: IO a

and

templateData :: a

where the a of both functions is the same and the latter is
automagically generated by TH.

Right now, I have to either use unsafePerformIO or runIO and IORef's to
load a file only once. Both solutions aren't necessarily pretty.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.



More information about the Haskell-Cafe mailing list