Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 099e4c4

Browse files
authored
Merge pull request #1723 from wz1000/master
Haddock source file names may use either dot or dash as separator
2 parents 4e185f7 + d9697bd commit 099e4c4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Haskell/Ide/Engine/Plugin/Haddock.hs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ lookupSrcHtmlForModule =
6363

6464
lookupHtmlForModule :: (FilePath -> FilePath -> FilePath) -> DynFlags -> Module -> IO (Maybe FilePath)
6565
lookupHtmlForModule mkDocPath df m = do
66-
let mfp = go <$> (listToMaybe =<< lookupHtmls df ui)
67-
exists <- maybe (pure False) doesFileExist mfp
68-
return $ if exists then mfp else Nothing
66+
let mfs = go <$> (listToMaybe =<< lookupHtmls df ui)
67+
htmls <- filterM doesFileExist (concat . maybeToList $ mfs)
68+
return $ listToMaybe htmls
6969
where
70-
go pkgDocDir = mkDocPath pkgDocDir mn
70+
-- The file might use "." or "-" as separator
71+
go pkgDocDir = [mkDocPath pkgDocDir mn | mn <- [mndot,mndash]]
7172
ui = moduleUnitId m
72-
mn = map (\x -> if x == '.' then '-' else x) mns
73-
mns = moduleNameString $ moduleName m
73+
mndash = map (\x -> if x == '.' then '-' else x) mndot
74+
mndot = moduleNameString $ moduleName m
7475

7576
nameCacheFromGhcMonad :: GhcMonad m => NameCacheAccessor m
7677
nameCacheFromGhcMonad = ( read_from_session , write_to_session )

0 commit comments

Comments
 (0)