aboutsummaryrefslogtreecommitdiff
path: root/hypsrc-test/src/Quasiquoter.hs
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2020-03-20 20:17:01 -0400
committerAlec Theriault <alec.theriault@gmail.com>2020-03-20 20:17:01 -0400
commit053c9add568dad4264f4629bff0de9b10d9316e1 (patch)
tree0e6f4de693a1748fb59df1ef32e5596e6008af0b /hypsrc-test/src/Quasiquoter.hs
parent70f4b3a03a47b38ee301f0da9c72d5a7ff0ed9b0 (diff)
parentdae8d9de6aaf3913a3776f1af235fb72404e9970 (diff)
Merge branch 'ghc-8.8' into ghc-8.10
Diffstat (limited to 'hypsrc-test/src/Quasiquoter.hs')
-rw-r--r--hypsrc-test/src/Quasiquoter.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/hypsrc-test/src/Quasiquoter.hs b/hypsrc-test/src/Quasiquoter.hs
new file mode 100644
index 00000000..d0a46c33
--- /dev/null
+++ b/hypsrc-test/src/Quasiquoter.hs
@@ -0,0 +1,16 @@
+module Quasiquoter ( string ) where
+
+import Language.Haskell.TH.Quote
+import Language.Haskell.TH.Syntax
+
+-- | Quoter for constructing multiline string literals
+string :: QuasiQuoter
+string = QuasiQuoter
+ { quoteExp = pure . LitE . StringL
+ , quotePat = invalidDomain
+ , quoteType = invalidDomain
+ , quoteDec = invalidDomain
+ }
+ where
+ invalidDomain :: String -> Q a
+ invalidDomain _ = fail "stringQuoter: only valid in expression context"