Skip to content

'#' becomes an illegal first-character of a QuasiQuote line when CPP is enabled

{-# LANGUAGE CPP #-} <pre> [hamlet| #{foo} |] </pre>

This will fail to compile. CPP should skip over a quasi-quote, which is allowed to have any characters. I think the only use case for CPP inside QQ is trying to place a QQ into an external file. In Yesod, we accomplish this with Template Haskell.

Our ideal situation would be for GHC to provide a function loadQQ. This would make it simple to not need #include. But my real hope is that loadQQ will identify the external file as a dependency and automatically recompile that code as needed.

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