Last active
September 7, 2021 18:30
-
-
Save tfausak/acd44de4c6db7aa604e824f9f30d4a91 to your computer and use it in GitHub Desktop.
Haskell string quasi-quotation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module QQ where | |
import qualified Language.Haskell.TH as TH | |
import qualified Language.Haskell.TH.Quote as TH | |
string :: TH.QuasiQuoter | |
string = TH.QuasiQuoter | |
{ TH.quoteDec = const $ fail "cannot be used as a declaration" | |
, TH.quoteExp = pure . TH.LitE . TH.StringL | |
, TH.quotePat = pure . TH.LitP . TH.StringL | |
, TH.quoteType = pure . TH.LitT . TH.StrTyLit | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment