From 953e3eb86b57f468c68d6ec0c651e8b3feda1518 Mon Sep 17 00:00:00 2001
From: Alec Theriault <alec.theriault@gmail.com>
Date: Fri, 20 Jul 2018 03:01:16 -0700
Subject: Refactor handling of parens in types (#874)

* Fix type parenthesization in Hoogle backend

Ported the logic in the HTML and LaTeX backends for adding in parens
into something top-level in 'GhcUtil'. Calling that from the Hoogle
backend fixes #873.

* Remove parenthesizing logic from LaTeX and XHTML backends

Now, the only times that parenthesis in types are added in any backend
is through the explicit 'HsParTy' constructor. Precedence is also
represented as its own datatype.

* List out cases explicitly vs. catch-all

* Fix printing of parens for QuantifiedConstraints

The priority of printing 'forall' types was just one too high.

Fixes #877.

* Accept HTML output for quantified contexts test
---
 haddock-test/src/Test/Haddock.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'haddock-test')

diff --git a/haddock-test/src/Test/Haddock.hs b/haddock-test/src/Test/Haddock.hs
index f372f773..942c0587 100644
--- a/haddock-test/src/Test/Haddock.hs
+++ b/haddock-test/src/Test/Haddock.hs
@@ -158,7 +158,9 @@ maybeAcceptFile :: Config c -> FilePath -> CheckResult -> IO CheckResult
 maybeAcceptFile cfg file result
     | cfgAccept cfg && result `elem` [NoRef, Fail] = do
         Just out <- readOut cfg file
-        writeFile (refFile dcfg file) $ ccfgDump ccfg out
+        let ref = refFile dcfg file
+        createDirectoryIfMissing True (takeDirectory ref)
+        writeFile ref $ ccfgDump ccfg out
         pure Accepted
   where
     dcfg = cfgDirConfig cfg
-- 
cgit v1.2.3