summaryrefslogtreecommitdiff
path: root/Data
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-06-10 08:14:16 -0400
committerBen Sima <ben@bsima.me>2021-11-26 13:47:35 -0500
commit72a7aaa39e7552970f466e712e1f7ef91aeb03c8 (patch)
tree8b8d501d28a9c1d56a0150d8129ff6324f196ad9 /Data
parent0ff0a23c8c7425b0d56b95e318c2087e74cb6605 (diff)
Upgrade to nixos-21.05
Getting me closer to the latest GHC. This release also includes my own packages that I submitted some time ago. GHCJS is not present in 21.05 for some reason, but I think it's back in master, so I might do another upgrade soon, but for now I just disabled my GHCJS support. I'm not really using it anyway. I also had to bring it string-quote, update nixos-mailserver, and a few other things.
Diffstat (limited to 'Data')
-rw-r--r--Data/String/Quote.hs37
1 files changed, 37 insertions, 0 deletions
diff --git a/Data/String/Quote.hs b/Data/String/Quote.hs
new file mode 100644
index 0000000..7efe692
--- /dev/null
+++ b/Data/String/Quote.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+-- | QuasiQuoter for non-interpolated strings, texts and bytestrings.
+--
+-- Originally by Audrey Tang <audreyt@audreyt.org>
+--
+-- The "s" quoter contains a multi-line string with no interpolation at all:
+--
+-- @
+-- {-\# LANGUAGE QuasiQuotes #-}
+-- import Data.Text (Text)
+-- import Data.String.Quote
+-- foo :: Text -- "String", "ByteString" etc also works
+-- foo = [s|
+--
+-- Well here is a
+-- multi-line string!
+--
+-- |]
+-- @
+--
+-- Any instance of the IsString type is permitted.
+module Data.String.Quote (s) where
+
+import Alpha
+import GHC.Exts (IsString (..))
+import qualified Language.Haskell.TH as TH
+import Language.Haskell.TH.Quote
+
+-- | QuasiQuoter for a non-interpolating IsString literal. The pattern portion is undefined.
+s :: QuasiQuoter
+s =
+ QuasiQuoter
+ ((\a -> [|fromString a|]) <. filter (/= '\r'))
+ (error "Cannot use q as a pattern")
+ (error "Cannot use q as a type")
+ (error "Cannot use q as a dec")