This repository has been archived by the owner on Apr 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 175
Merge ghc-imported-from into ghc-mod #810
Closed
carlohamalainen
wants to merge
57
commits into
DanielG:master
from
carlohamalainen:ghc-imported-from-merge-vs-master
Closed
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
2485221
Merging the ghc-imported-from utility.
carlohamalainen 5126454
Dependencies for imported-from command.
carlohamalainen 4e4f69c
Add imported-from command.
carlohamalainen bd62eb0
Fix a type error.
carlohamalainen 5d26b71
Remove bound on process-streaming.
carlohamalainen 6339f63
Fix bounds for haddock-api with ghc 7.x and 8.x
carlohamalainen 875b513
Revert ghc-mod.cabal to current master.
carlohamalainen ae39594
Import in alphabetical position.
carlohamalainen 47becac
LANGUAGE extensions on one line.
carlohamalainen ffc755b
Remove unused import.
carlohamalainen cfb9693
Revert to current master.
carlohamalainen 07e4be3
Remove dependency on System.Process.Streaming
carlohamalainen af4e620
Use gmReadProcess. Builds and tests pass with ghc-7.10.3
carlohamalainen 1736e24
Fix import for Control.Applicative
carlohamalainen d9c9477
Avoid use of "traverse" which is not in ghc-7.6.3
carlohamalainen 7b8d5a7
Builds on ghc-7.6.3; added some fallback cases for earlier versions o…
carlohamalainen 7fa7b12
Move #if things to Language.Haskell.GhcMod.Gap.
carlohamalainen 1557ef1
Add type sig.
carlohamalainen d276260
Remove definition of tdflags (also gets rid of unsafeGlobalDynFlags).
carlohamalainen 7106525
Remove constraints on GmOut and GmLog.
carlohamalainen 048eaac
Fewer imports; move moduleNameToHtmlFile into a where clause.
carlohamalainen 13e5cda
Move filterMatchingQualifiedImport to a where clause; tidy up
carlohamalainen f52077c
Use parameter of ```gmLog GmDebug``` instead of passing ```""```.
carlohamalainen 50a52d2
Reformat some very long lines.
carlohamalainen 1339dc5
Merge changes from master.
carlohamalainen ec38b27
Merging changes from master.
carlohamalainen 84579ef
Tweaks for building on earlier versions of ghc.
carlohamalainen b94f2f4
Adjust ghc version bound on ghcIdeclHiding.
carlohamalainen 6b11e9d
Tweaks for building on GHC8.
carlohamalainen ae4badb
Use exit code instead of printing SUCCESS / FAIL.
carlohamalainen fb1c146
Add ImportedFromSpec to test suite.
carlohamalainen fa1417a
Use top-level error GMEMissingHaddock when missing haddock html.
carlohamalainen 40e3daf
Use GMError type instead of calling plain "error".
carlohamalainen b1c1b2a
Tidying up logging.
carlohamalainen 9eb0cc8
Add note about setting documentation:True in .cabal/config.
carlohamalainen 6f83fab
Tweak for resolver on internal symbols (tested with GHC8; added testc…
carlohamalainen 2edda72
Forgot "$$".
carlohamalainen 704cff6
Drop parens in qualified name. New in GHC8?
carlohamalainen cdbe0ef
Adding some more test cases.
carlohamalainen e2f6092
Remove dependency on parsec.
carlohamalainen f6ba25b
Tidyup some warnings.
carlohamalainen 0961feb
Accidentally removed import of Control.Applicative.
carlohamalainen ea1d4a0
Instead of throwing an exception if the haddock file is missing,
carlohamalainen c37907c
Improved tests for imported-from command. Actually checks the output
carlohamalainen e413cea
Merge remote-tracking branch 'remotes/upstream/master' into ghc-impor…
carlohamalainen 5eefa23
Don't use Python-style leading underscore.
carlohamalainen 122cfd5
Remove dead code.
carlohamalainen f3c9268
Use things from Control.Monad.Trans.Maybe.
carlohamalainen fc02ddc
Remove unused dependency.
carlohamalainen a9fa573
Remove stackoverflow snippet.
carlohamalainen 4897f16
Remove another ```fromMaybe (throw ...)``` pattern.
carlohamalainen 2be2742
fail instead of throw; tidy up some definitions.
carlohamalainen 8d4d2c7
Use a view pattern.
carlohamalainen 21a81b2
Tidying up.
carlohamalainen e36a3c3
Flag for cabal install is --only-dependencies not --dependencies-only.
carlohamalainen 83f27c6
Avoid use of ```nub```.
carlohamalainen c995e15
Note on use of ```last```.
carlohamalainen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -552,7 +552,10 @@ refineVisibleExports getHaddockInterfaces exports = mapM f exports | |
qexports = qualifiedExports mexports -- e.g. ["base-4.8.2.0:GHC.Base.Just", ...] | ||
mVisibleExportsMap <- getVisibleExports getHaddockInterfaces pname | ||
|
||
let visibleExportsMap = fromMaybe (throw $ GMEString $ "ImportedFrom: visible exports map is Nothing") mVisibleExportsMap | ||
visibleExportsMap <- case mVisibleExportsMap of | ||
Nothing -> throw $ GMEString $ "ImportedFrom: visible exports map is Nothing" | ||
Just x -> return x | ||
|
||
gmLog GmDebug "visibleExportsMap" $ strDoc $ show visibleExportsMap | ||
|
||
let thisModVisibleExports0 = M.lookup thisModuleName visibleExportsMap | ||
|
@@ -563,9 +566,9 @@ refineVisibleExports getHaddockInterfaces exports = mapM f exports | |
let thisModVisibleExports = case thisModVisibleExports0 of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't need an explicit |
||
Just ve -> ve | ||
Nothing -> let pname' = ((head $ splitOn "-" pname) ++ ":" ++ thisModuleName) in | ||
fromMaybe | ||
(throw $ GMENoVisibleExports thisModuleName pname') | ||
(M.lookup pname' visibleExportsMap) | ||
case M.lookup pname' visibleExportsMap of | ||
Nothing -> throw $ GMENoVisibleExports thisModuleName pname' | ||
Just ve -> ve | ||
|
||
let qexports' = filter (hasPostfixMatch thisModVisibleExports) qexports | ||
|
||
|
@@ -733,18 +736,16 @@ guessHaddockUrl modSum targetFile targetModule symbol lineNr colNr ghcPkg readPr | |
gmLog GmDebug "guessHaddockUrl" $ strDoc $ "lastMatchPackageName: " ++ lastMatchPackageName | ||
gmLog GmDebug "guessHaddockUrl" $ strDoc $ "mhaddock: " ++ show mhaddock | ||
|
||
let haddock = fromMaybe | ||
(throw $ GMEString $ "ImportedFrom: ghcPkgHaddockUrl failed to find path to HTML file.") | ||
mhaddock | ||
|
||
let f = haddock </> (moduleNameToHtmlFile lastMatchModule) | ||
case mhaddock of | ||
Nothing -> throw $ GMEString $ "ImportedFrom: ghcPkgHaddockUrl failed to find path to HTML file." | ||
Just haddock -> do let f = haddock </> (moduleNameToHtmlFile lastMatchModule) | ||
|
||
let mySymbol' = case mySymbol of | ||
MySymbolSysQualified s -> s | ||
MySymbolUserQualified s -> s | ||
let mySymbol' = case mySymbol of | ||
MySymbolSysQualified s -> s | ||
MySymbolUserQualified s -> s | ||
|
||
return $ mySymbol' ++ " " ++ lastMatchModule ++ " file://" ++ f | ||
++ " " ++ toHackageUrl f lastMatchPackageName lastMatchModule | ||
return $ mySymbol' ++ " " ++ lastMatchModule ++ " file://" ++ f | ||
++ " " ++ toHackageUrl f lastMatchPackageName lastMatchModule | ||
|
||
where | ||
-- Convert a module name string, e.g. @Data.List@ to @Data-List.html@. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you misunderstood, there are three kinds of failures:
The differences are subtle but in general the first two kinds are annoying since you need to explicitly catch the exceptions whereas the last one just always gets returned as a
Left
byrunGhcModT
.The difference between 1) and 2) is important though:
throw "whatever" >> return "foo"
will always crash when run,let foo = throw "whatever" in return (foo, "bar")
will only crash when you touch the fst of that tuple! (lazyness and such)The GhcModError stuff should always be returned via
throwError
where possible. All you really had to do was to replacefromMaybe
withliftMaybe
:)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also
fail
is equivalent tothrowError . GMEString
which is why I suggested you use that before.