File tree 3 files changed +36
-3
lines changed
src/Development/IDE/Spans
3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ library
62
62
focus,
63
63
ghc-trace-events,
64
64
Glob,
65
- haddock-library >= 1.8 && < 1.11 ,
65
+ haddock-library >= 1.8 && < 1.12 ,
66
66
hashable,
67
67
hie-compat ^>= 0.3.0.0 ,
68
68
hls-plugin-api ^>= 1.5 ,
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import GHC.Generics
23
23
24
24
import GHC
25
25
26
+ import Data.Bifunctor (second )
26
27
import Development.IDE.GHC.Compat
27
28
import Development.IDE.GHC.Orphans ()
28
29
import Development.IDE.GHC.Util
@@ -179,8 +180,12 @@ haddockToMarkdown (H.DocHeader (H.Header level title))
179
180
180
181
haddockToMarkdown (H. DocUnorderedList things)
181
182
= ' \n ' : (unlines $ map ((" + " ++ ) . trimStart . splitForList . haddockToMarkdown) things)
182
- haddockToMarkdown (H. DocOrderedList things)
183
- = ' \n ' : (unlines $ map ((" 1. " ++ ) . trimStart . splitForList . haddockToMarkdown) things)
183
+ haddockToMarkdown (H. DocOrderedList things) =
184
+ #if MIN_VERSION_haddock_library(1,11,0)
185
+ ' \n ' : (unlines $ map ((\ (num, str) -> show num ++ " . " ++ str) . second (trimStart . splitForList . haddockToMarkdown)) things)
186
+ #else
187
+ ' \n ' : (unlines $ map ((" 1. " ++ ) . trimStart . splitForList . haddockToMarkdown) things)
188
+ #endif
184
189
haddockToMarkdown (H. DocDefList things)
185
190
= ' \n ' : (unlines $ map (\ (term, defn) -> " + **" ++ haddockToMarkdown term ++ " **: " ++ haddockToMarkdown defn) things)
186
191
Original file line number Diff line number Diff line change @@ -2393,6 +2393,34 @@ haddockTests
2393
2393
, " "
2394
2394
]
2395
2395
)
2396
+ , testCase " ordered list" $ checkHaddock
2397
+ (unlines
2398
+ [ " may require"
2399
+ , " different precautions:"
2400
+ , " "
2401
+ , " 1. Use @{\\ -\\ # NOINLINE foo \\ #-\\ }@ as a pragma on any function @foo@"
2402
+ , " that calls 'unsafePerformIO'. If the call is inlined,"
2403
+ , " the I\\ /O may be performed more than once."
2404
+ , " "
2405
+ , " 2. Use the compiler flag @-fno-cse@ to prevent common sub-expression"
2406
+ , " elimination being performed on the module."
2407
+ , " "
2408
+ ]
2409
+ )
2410
+ (unlines
2411
+ [ " "
2412
+ , " "
2413
+ , " may require"
2414
+ , " different precautions: "
2415
+ , " 1. Use `{-# NOINLINE foo #-}` as a pragma on any function `foo` "
2416
+ , " that calls `unsafePerformIO` . If the call is inlined,"
2417
+ , " the I/O may be performed more than once."
2418
+ , " "
2419
+ , " 2. Use the compiler flag `-fno-cse` to prevent common sub-expression"
2420
+ , " elimination being performed on the module."
2421
+ , " "
2422
+ ]
2423
+ )
2396
2424
]
2397
2425
where
2398
2426
checkHaddock s txt = spanDocToMarkdownForTest s @?= txt
You can’t perform that action at this time.
0 commit comments