aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2018-07-05 10:43:35 -0400
committerSimon Jakobi <simon.jakobi@gmail.com>2018-07-20 13:39:29 +0200
commit7e92026477248c077c0f47a1d5995513fa76e2b4 (patch)
tree8536ca907fa5ee28ff8f371c9ab0729ff913e8c9
parenta532f8f0b81461849278b4cc5bc5b72521e516d1 (diff)
Export more fixities for Hoogle (#871)
This exports fixities for more things, including class methods and type-level operators. (cherry picked from commit 88316b972e3d47197b1019111bae0f7f87275fce)
-rw-r--r--haddock-api/src/Haddock/Backends/Hoogle.hs4
-rw-r--r--hoogle-test/ref/Bug722/test.txt16
-rw-r--r--hoogle-test/src/Bug722/Bug722.hs13
3 files changed, 31 insertions, 2 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs
index 37ac431a..e23e8cc6 100644
--- a/haddock-api/src/Haddock/Backends/Hoogle.hs
+++ b/haddock-api/src/Haddock/Backends/Hoogle.hs
@@ -123,7 +123,7 @@ ppExport dflags ExportDecl { expItemDecl = L _ decl
, expItemMbDoc = (dc, _)
, expItemSubDocs = subdocs
, expItemFixities = fixities
- } = ppDocumentation dflags dc ++ f decl
+ } = ppDocumentation dflags dc ++ f decl ++ ppFixities
where
f (TyClD _ d@DataDecl{}) = ppData dflags d subdocs
f (TyClD _ d@SynDecl{}) = ppSynonym dflags d
@@ -131,7 +131,7 @@ ppExport dflags ExportDecl { expItemDecl = L _ decl
f (TyClD _ (FamDecl _ d)) = ppFam dflags d
f (ForD _ (ForeignImport _ name typ _)) = [pp_sig dflags [name] (hsSigType typ)]
f (ForD _ (ForeignExport _ name typ _)) = [pp_sig dflags [name] (hsSigType typ)]
- f (SigD _ sig) = ppSig dflags sig ++ ppFixities
+ f (SigD _ sig) = ppSig dflags sig
f _ = []
ppFixities = concatMap (ppFixity dflags) fixities
diff --git a/hoogle-test/ref/Bug722/test.txt b/hoogle-test/ref/Bug722/test.txt
new file mode 100644
index 00000000..96f3747b
--- /dev/null
+++ b/hoogle-test/ref/Bug722/test.txt
@@ -0,0 +1,16 @@
+-- Hoogle documentation, generated by Haddock
+-- See Hoogle, http://www.haskell.org/hoogle/
+
+@package test
+@version 0.0.0
+
+module Bug722
+class Foo a
+(!@#) :: Foo a => a -> a -> a
+infixl 4 !@#
+type family &* :: * -> * -> *
+infixr 3 &*
+data a :-& b
+(:^&) :: a -> b -> (:-&) a b
+infixl 6 :-&
+infixl 6 :^&
diff --git a/hoogle-test/src/Bug722/Bug722.hs b/hoogle-test/src/Bug722/Bug722.hs
new file mode 100644
index 00000000..a33d5b24
--- /dev/null
+++ b/hoogle-test/src/Bug722/Bug722.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE TypeOperators, TypeFamilies #-}
+module Bug722 where
+
+class Foo a where
+ (!@#) :: a -> a -> a
+infixl 4 !@#
+
+type family (&*) :: * -> * -> *
+infixr 3 &*
+
+data a :-& b = a :^& b
+infixl 6 :-&, :^&
+