Skip to content

Instantly share code, notes, and snippets.

@tfausak
Last active September 7, 2021 18:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfausak/acd44de4c6db7aa604e824f9f30d4a91 to your computer and use it in GitHub Desktop.
Save tfausak/acd44de4c6db7aa604e824f9f30d4a91 to your computer and use it in GitHub Desktop.
Haskell string quasi-quotation.
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