Skip to content

Commit

Permalink
Don't support old haddock-library versions (haskell/ghcide#375)
Browse files Browse the repository at this point in the history
* Don't support old haddock-library versions

* Update stack.yaml values

* Remove some more haddock_library CPP

* Make sure the latest haddock-library is on GHC 8.4
  • Loading branch information
ndmitchell authored and cocreature committed Jan 28, 2020
1 parent 381b3a2 commit c648224
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ library
extra,
fuzzy,
filepath,
haddock-library,
haddock-library >= 1.8,
hashable,
haskell-lsp-types == 0.19.*,
haskell-lsp == 0.19.*,
Expand Down
9 changes: 0 additions & 9 deletions src/Development/IDE/Spans/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ spanDocToMarkdown (SpanDocText txt) = txt

spanDocToMarkdownForTest :: String -> String
spanDocToMarkdownForTest
#if MIN_VERSION_haddock_library(1,6,0)
= haddockToMarkdown . H.toRegular . H._doc . H.parseParas Nothing
#else
= haddockToMarkdown . H.toRegular . H._doc . H.parseParas
#endif

-- Simple (and a bit hacky) conversion from Haddock markup to Markdown
haddockToMarkdown
Expand Down Expand Up @@ -127,13 +123,8 @@ haddockToMarkdown (H.DocExamples es)
= ">>> " ++ expr ++ "\n" ++ unlines result
haddockToMarkdown (H.DocHyperlink (H.Hyperlink url Nothing))
= "<" ++ url ++ ">"
#if MIN_VERSION_haddock_library(1,8,0)
haddockToMarkdown (H.DocHyperlink (H.Hyperlink url (Just label)))
= "[" ++ haddockToMarkdown label ++ "](" ++ url ++ ")"
#else
haddockToMarkdown (H.DocHyperlink (H.Hyperlink url (Just label)))
= "[" ++ label ++ "](" ++ url ++ ")"
#endif
haddockToMarkdown (H.DocPic (H.Picture url Nothing))
= "![](" ++ url ++ ")"
haddockToMarkdown (H.DocPic (H.Picture url (Just label)))
Expand Down
1 change: 1 addition & 0 deletions stack-ghc-lib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extra-deps:
- fuzzy-0.1.0.0
- regex-base-0.94.0.0
- regex-tdfa-1.3.1.0
- haddock-library-1.8.0
nix:
packages: [zlib]
flags:
Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ extra-deps:
- regex-base-0.94.0.0
- regex-tdfa-1.3.1.0
- parser-combinators-1.2.1
- haddock-library-1.8.0
nix:
packages: [zlib]
1 change: 1 addition & 0 deletions stack84.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extra-deps:
- regex-base-0.94.0.0
- regex-tdfa-1.3.1.0
- parser-combinators-1.2.1
- haddock-library-1.8.0
nix:
packages: [zlib]
allow-newer: true
4 changes: 0 additions & 4 deletions test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1665,11 +1665,7 @@ haddockTests
(unlines
[ ""
, ""
#if MIN_VERSION_haddock_library(1,8,0)
, "However, `(+)` and `(*)` are"
#else
, "However, '(+)' and '(*)' are"
#endif
, "customarily expected to define a ring and have the following properties: "
, "+ ****Associativity of (+)****: `(x + y) + z` = `x + (y + z)`"
, "+ ****Commutativity of (+)****: `x + y` = `y + x`"
Expand Down

0 comments on commit c648224

Please sign in to comment.