aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haddock.cabal2
-rw-r--r--html-test/ref/Threaded.html94
-rw-r--r--html-test/src/Threaded.hs10
-rw-r--r--html-test/src/Threaded_TH.hs13
4 files changed, 118 insertions, 1 deletions
diff --git a/haddock.cabal b/haddock.cabal
index 03bb28ab..ed570f53 100644
--- a/haddock.cabal
+++ b/haddock.cabal
@@ -42,7 +42,7 @@ executable haddock
default-language: Haskell2010
main-is: Main.hs
hs-source-dirs: driver
- ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2
+ ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2 -threaded
build-depends:
base >= 4.3 && < 4.9
diff --git a/html-test/ref/Threaded.html b/html-test/ref/Threaded.html
new file mode 100644
index 00000000..95a18933
--- /dev/null
+++ b/html-test/ref/Threaded.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+><head
+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
+ /><title
+ >Threaded</title
+ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"
+ /><script src="haddock-util.js" type="text/javascript"
+ ></script
+ ><script type="text/javascript"
+ >//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Threaded.html");};
+//]]>
+</script
+ ></head
+ ><body
+ ><div id="package-header"
+ ><ul class="links" id="page-menu"
+ ><li
+ ><a href="index.html"
+ >Contents</a
+ ></li
+ ><li
+ ><a href="doc-index.html"
+ >Index</a
+ ></li
+ ></ul
+ ><p class="caption empty"
+ >&nbsp;</p
+ ></div
+ ><div id="content"
+ ><div id="module-header"
+ ><table class="info"
+ ><tr
+ ><th
+ >Safe Haskell</th
+ ><td
+ >None</td
+ ></tr
+ ></table
+ ><p class="caption"
+ >Threaded</p
+ ></div
+ ><div id="description"
+ ><p class="caption"
+ >Description</p
+ ><div class="doc"
+ ><p
+ >Ensures haddock built with <code
+ >-threaded</code
+ >.</p
+ ></div
+ ></div
+ ><div id="synopsis"
+ ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"
+ >Synopsis</p
+ ><ul id="section.syn" class="hide" onclick="toggleSection('syn')"
+ ><li class="src short"
+ ><a href="#v:f"
+ >f</a
+ > :: <a href=" ${pkgroot}/../../share/doc/ghc/html/libraries/base-4.8.0.0/Prelude.html#t:Integer"
+ >Integer</a
+ ></li
+ ></ul
+ ></div
+ ><div id="interface"
+ ><h1
+ >Documentation</h1
+ ><div class="top"
+ ><p class="src"
+ ><a name="v:f" class="def"
+ >f</a
+ > :: <a href=" ${pkgroot}/../../share/doc/ghc/html/libraries/base-4.8.0.0/Prelude.html#t:Integer"
+ >Integer</a
+ ></p
+ ><div class="doc"
+ ><p
+ ><code
+ >$(forkTH)</code
+ > fails at compile time if haddock isn't using the
+ threaded RTS.</p
+ ></div
+ ></div
+ ></div
+ ></div
+ ><div id="footer"
+ ><p
+ >Produced by <a href="http://www.haskell.org/haddock/"
+ >Haddock</a
+ > version 2.16.0</p
+ ></div
+ ></body
+ ></html
+>
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))