Skip to content

Template Haskell only imports

This is the Template Haskell equivalent of #11244 (closed).

It should be possible to use the plugin package database to make a Template Haskell only import; I suggest the syntax import {-# TH_ONLY #-} Foo. Such imports are only allowed to be used in splices, and cannot be quoted (they are not allowed to reside in the final code generated by the splice.)

The reason a user may want to use such an import is that it means that they can declare that a library is necessary when compiling splices, but not necessary when actually linking against it.

There are extra benefits. If a user is compiling the package with the splices with profiling, it ordinarily requires all imports to have been compiled with profiling. This would NOT be necessary for a TH_ONLY import, since we're only ever going to run the imported code in the (non-profiled) compiler, and not in the (profiled) executable.)

Trac metadata
Trac field Value
Version 7.11
Type FeatureRequest
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Template Haskell
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information