7.8.1, template haskell, and dynamic libraries

Albert Y. C. Lai trebla at vex.net
Wed Feb 19 02:48:55 UTC 2014

The new dynamism is pretty nice! I even used GHC 7.6.3 to build 
cabal-install 1.18, then played with PATH so that when I said "cabal 
install mtl" it saw GHC 7.8. It correctly added -dynamic-too and built 
both *.a and *.so in one go. This is very user-friendly.

Still, I observed a few oddities.

1. Referring to the user guide section 2.3 "loading compiled code", it 
is now insufficient to "ghc -c D.hs". It has to be "ghc -c -dynamic D.hs".

Perhaps more importantly, "ghc -c -dynamic-too D.hs" is also 
insufficient. Apparently, while TemplateHaskell considers both *.hi and 
*.dyn_hi, :load considers *.hi only.

2. My experiment began with just QuasiQuote. QuasiQuote needs as much 
dynamism as TemplateHaskell. Yet, QuasiQuote does not trigger a nice 
implicit -dynamic-too, unlike TemplateHaskell.

More information about the Glasgow-haskell-users mailing list