summaryrefslogtreecommitdiff
path: root/dev-haskell/haddock-api/files/haddock-api-2.24.0-haddock-library-1.10.patch
blob: 1627b73eba9dbbfd87062402ea46fd7482322468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
--- a/src/Haddock/Backends/Hoogle.hs
+++ b/src/Haddock/Backends/Hoogle.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE TypeFamilies #-}
 -----------------------------------------------------------------------------
@@ -326,7 +327,11 @@ markupTag dflags = Markup {
   markupAppend               = (++),
   markupIdentifier           = box (TagInline "a") . str . out dflags,
   markupIdentifierUnchecked  = box (TagInline "a") . str . showWrapped (out dflags . snd),
+#if MIN_VERSION_haddock_library(1,10,0)
+  markupModule               = box (TagInline "a") . str . modLinkName,
+#else
   markupModule               = box (TagInline "a") . str,
+#endif
   markupWarning              = box (TagInline "i"),
   markupEmphasis             = box (TagInline "i"),
   markupBold                 = box (TagInline "b"),
--- a/src/Haddock/Backends/LaTeX.hs
+++ b/src/Haddock/Backends/LaTeX.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
 {-# LANGUAGE RecordWildCards #-}
 {-# LANGUAGE TypeFamilies #-}
@@ -1206,7 +1207,11 @@ latexMarkup = Markup
   , markupAppend               = \l r v -> l v . r v
   , markupIdentifier           = \i v -> inlineElem (markupId v (fmap occName i))
   , markupIdentifierUnchecked  = \i v -> inlineElem (markupId v (fmap snd i))
+#if MIN_VERSION_haddock_library(1,10,0)
+  , markupModule               = \m _ -> inlineElem (let (mdl,_ref) = break (=='#') (modLinkName m) in (tt (text mdl)))
+#else
   , markupModule               = \m _ -> inlineElem (let (mdl,_ref) = break (=='#') m in (tt (text mdl)))
+#endif
   , markupWarning              = \p v -> p v
   , markupEmphasis             = \p v -> inlineElem (emph (p v empty))
   , markupBold                 = \p v -> inlineElem (bold (p v empty))
--- a/src/Haddock/Backends/Xhtml/DocMarkup.hs
+++ b/src/Haddock/Backends/Xhtml/DocMarkup.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Haddock.Backends.Html.DocMarkup
@@ -44,7 +45,11 @@ parHtmlMarkup qual insertAnchors ppId = Markup {
   markupAppend               = (+++),
   markupIdentifier           = thecode . ppId insertAnchors,
   markupIdentifierUnchecked  = thecode . ppUncheckedLink qual,
+#if MIN_VERSION_haddock_library(1,10,0)
+  markupModule               = \m -> let (mdl,ref) = break (=='#') (modLinkName m)
+#else
   markupModule               = \m -> let (mdl,ref) = break (=='#') m
+#endif
                                          -- Accomodate for old style
                                          -- foo\#bar anchors
                                          mdl' = case reverse mdl of
--- a/src/Haddock/Interface/LexParseRn.hs
+++ b/src/Haddock/Interface/LexParseRn.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# OPTIONS_GHC -Wwarn #-}
 {-# LANGUAGE BangPatterns #-}
 {-# LANGUAGE ViewPatterns #-}
@@ -148,7 +149,11 @@ rename dflags gre = rn
       DocDefList list -> DocDefList <$> traverse (\(a, b) -> (,) <$> rn a <*> rn b) list
       DocCodeBlock doc -> DocCodeBlock <$> rn doc
       DocIdentifierUnchecked x -> pure (DocIdentifierUnchecked x)
+#if MIN_VERSION_haddock_library(1,10,0)
+      DocModule (ModLink m l) -> DocModule . ModLink m <$> traverse rn l
+#else
       DocModule str -> pure (DocModule str)
+#endif
       DocHyperlink (Hyperlink u l) -> DocHyperlink . Hyperlink u <$> traverse rn l
       DocPic str -> pure (DocPic str)
       DocMathInline str -> pure (DocMathInline str)
--- a/src/Haddock/InterfaceFile.hs
+++ b/src/Haddock/InterfaceFile.hs
@@ -521,9 +521,16 @@ instance (Binary mod, Binary id) => Binary (DocH mod id) where
     put_ bh (DocIdentifier ae) = do
             putByte bh 4
             put_ bh ae
+#if MIN_VERSION_haddock_library(1,10,0)
+    put_ bh (DocModule (ModLink af bf)) = do
+            putByte bh 5
+            put_ bh af
+            put_ bh bf
+#else
     put_ bh (DocModule af) = do
             putByte bh 5
             put_ bh af
+#endif
     put_ bh (DocEmphasis ag) = do
             putByte bh 6
             put_ bh ag
@@ -598,8 +605,14 @@ instance (Binary mod, Binary id) => Binary (DocH mod id) where
                     ae <- get bh
                     return (DocIdentifier ae)
               5 -> do
+#if MIN_VERSION_haddock_library(1,10,0)
+                    af <- get bh
+                    bf <- get bh
+                    return (DocModule (ModLink af bf))
+#else
                     af <- get bh
                     return (DocModule af)
+#endif
               6 -> do
                     ag <- get bh
                     return (DocEmphasis ag)
--- a/src/Haddock/Types.hs
+++ b/src/Haddock/Types.hs
@@ -466,7 +466,11 @@ instance (NFData a, NFData mod)
     DocParagraph a            -> a `deepseq` ()
     DocIdentifier a           -> a `deepseq` ()
     DocIdentifierUnchecked a  -> a `deepseq` ()
+#if MIN_VERSION_haddock_library(1,10,0)
+    DocModule (ModLink a b)   -> a `deepseq` b `deepseq` ()
+#else
     DocModule a               -> a `deepseq` ()
+#endif
     DocWarning a              -> a `deepseq` ()
     DocEmphasis a             -> a `deepseq` ()
     DocBold a                 -> a `deepseq` ()