aboutsummaryrefslogtreecommitdiff
path: root/html-test/src
diff options
context:
space:
mode:
authorEmanuel Borsboom <manny@fpcomplete.com>2015-05-23 04:56:18 -0700
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-06-12 02:46:23 +0100
commit2b467a747df246090d1fd0270ea9bd4192ebe3df (patch)
treef09d4837d39272ba3471ab544dd48f6de9827c84 /html-test/src
parenta65953de929fd9488250f8e0257c918465193e43 (diff)
Build executable with '-threaded' (fixes #399)
Diffstat (limited to 'html-test/src')
-rw-r--r--html-test/src/Threaded.hs10
-rw-r--r--html-test/src/Threaded_TH.hs13
2 files changed, 23 insertions, 0 deletions
diff --git a/html-test/src/Threaded.hs b/html-test/src/Threaded.hs
new file mode 100644
index 00000000..7f3073ad
--- /dev/null
+++ b/html-test/src/Threaded.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+-- | Ensures haddock built with @-threaded@.
+module Threaded where
+
+import Threaded_TH
+
+-- | @$(forkTH)@ fails at compile time if haddock isn't using the
+-- threaded RTS.
+f = $(forkTH)
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))