aboutsummaryrefslogtreecommitdiff
path: root/html-test/src/Threaded_TH.hs
diff options
context:
space:
mode:
Diffstat (limited to 'html-test/src/Threaded_TH.hs')
-rw-r--r--html-test/src/Threaded_TH.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/html-test/src/Threaded_TH.hs b/html-test/src/Threaded_TH.hs
new file mode 100644
index 00000000..53e5a399
--- /dev/null
+++ b/html-test/src/Threaded_TH.hs
@@ -0,0 +1,13 @@
+-- | Imported by 'Threaded', since a TH splice can't be used in the
+-- module where it is defined.
+module Threaded_TH where
+
+import Control.Concurrent (forkOS)
+import Language.Haskell.TH.Syntax (Exp (LitE), Lit (IntegerL), Q, runIO)
+
+-- | forkOS requires the threaded RTS, so this TH fails if haddock was
+-- built without @-threaded@.
+forkTH :: Q Exp
+forkTH = do
+ _ <- runIO (forkOS (return ()))
+ return (LitE (IntegerL 0))