Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Merge ghc-imported-from into ghc-mod #810

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2485221
Merging the ghc-imported-from utility.
carlohamalainen Jul 12, 2016
5126454
Dependencies for imported-from command.
carlohamalainen Jul 12, 2016
4e4f69c
Add imported-from command.
carlohamalainen Jul 12, 2016
bd62eb0
Fix a type error.
carlohamalainen Jul 12, 2016
5d26b71
Remove bound on process-streaming.
carlohamalainen Jul 12, 2016
6339f63
Fix bounds for haddock-api with ghc 7.x and 8.x
carlohamalainen Jul 12, 2016
875b513
Revert ghc-mod.cabal to current master.
carlohamalainen Jul 15, 2016
ae39594
Import in alphabetical position.
carlohamalainen Jul 15, 2016
47becac
LANGUAGE extensions on one line.
carlohamalainen Jul 15, 2016
ffc755b
Remove unused import.
carlohamalainen Jul 15, 2016
cfb9693
Revert to current master.
carlohamalainen Jul 15, 2016
07e4be3
Remove dependency on System.Process.Streaming
carlohamalainen Jul 15, 2016
af4e620
Use gmReadProcess. Builds and tests pass with ghc-7.10.3
carlohamalainen Jul 15, 2016
1736e24
Fix import for Control.Applicative
carlohamalainen Jul 16, 2016
d9c9477
Avoid use of "traverse" which is not in ghc-7.6.3
carlohamalainen Jul 16, 2016
7b8d5a7
Builds on ghc-7.6.3; added some fallback cases for earlier versions o…
carlohamalainen Jul 16, 2016
7fa7b12
Move #if things to Language.Haskell.GhcMod.Gap.
carlohamalainen Jul 16, 2016
1557ef1
Add type sig.
carlohamalainen Jul 16, 2016
d276260
Remove definition of tdflags (also gets rid of unsafeGlobalDynFlags).
carlohamalainen Jul 17, 2016
7106525
Remove constraints on GmOut and GmLog.
carlohamalainen Jul 17, 2016
048eaac
Fewer imports; move moduleNameToHtmlFile into a where clause.
carlohamalainen Jul 17, 2016
13e5cda
Move filterMatchingQualifiedImport to a where clause; tidy up
carlohamalainen Jul 17, 2016
f52077c
Use parameter of ```gmLog GmDebug``` instead of passing ```""```.
carlohamalainen Jul 17, 2016
50a52d2
Reformat some very long lines.
carlohamalainen Jul 17, 2016
1339dc5
Merge changes from master.
carlohamalainen Jul 17, 2016
ec38b27
Merging changes from master.
carlohamalainen Jul 17, 2016
84579ef
Tweaks for building on earlier versions of ghc.
carlohamalainen Jul 17, 2016
b94f2f4
Adjust ghc version bound on ghcIdeclHiding.
carlohamalainen Jul 17, 2016
6b11e9d
Tweaks for building on GHC8.
carlohamalainen Jul 19, 2016
ae4badb
Use exit code instead of printing SUCCESS / FAIL.
carlohamalainen Jul 19, 2016
fb1c146
Add ImportedFromSpec to test suite.
carlohamalainen Jul 19, 2016
fa1417a
Use top-level error GMEMissingHaddock when missing haddock html.
carlohamalainen Jul 19, 2016
40e3daf
Use GMError type instead of calling plain "error".
carlohamalainen Jul 19, 2016
b1c1b2a
Tidying up logging.
carlohamalainen Jul 20, 2016
9eb0cc8
Add note about setting documentation:True in .cabal/config.
carlohamalainen Jul 24, 2016
6f83fab
Tweak for resolver on internal symbols (tested with GHC8; added testc…
carlohamalainen Jul 24, 2016
2edda72
Forgot "$$".
carlohamalainen Jul 24, 2016
704cff6
Drop parens in qualified name. New in GHC8?
carlohamalainen Jul 24, 2016
cdbe0ef
Adding some more test cases.
carlohamalainen Jul 29, 2016
e2f6092
Remove dependency on parsec.
carlohamalainen Jul 30, 2016
f6ba25b
Tidyup some warnings.
carlohamalainen Jul 30, 2016
0961feb
Accidentally removed import of Control.Applicative.
carlohamalainen Jul 30, 2016
ea1d4a0
Instead of throwing an exception if the haddock file is missing,
carlohamalainen Aug 8, 2016
c37907c
Improved tests for imported-from command. Actually checks the output
carlohamalainen Aug 8, 2016
e413cea
Merge remote-tracking branch 'remotes/upstream/master' into ghc-impor…
carlohamalainen Aug 8, 2016
5eefa23
Don't use Python-style leading underscore.
carlohamalainen Aug 9, 2016
122cfd5
Remove dead code.
carlohamalainen Aug 9, 2016
f3c9268
Use things from Control.Monad.Trans.Maybe.
carlohamalainen Aug 9, 2016
fc02ddc
Remove unused dependency.
carlohamalainen Aug 9, 2016
a9fa573
Remove stackoverflow snippet.
carlohamalainen Aug 9, 2016
4897f16
Remove another ```fromMaybe (throw ...)``` pattern.
carlohamalainen Aug 9, 2016
2be2742
fail instead of throw; tidy up some definitions.
carlohamalainen Aug 9, 2016
8d4d2c7
Use a view pattern.
carlohamalainen Aug 9, 2016
21a81b2
Tidying up.
carlohamalainen Aug 9, 2016
e36a3c3
Flag for cabal install is --only-dependencies not --dependencies-only.
carlohamalainen Aug 9, 2016
83f27c6
Avoid use of ```nub```.
carlohamalainen Aug 9, 2016
c995e15
Note on use of ```last```.
carlohamalainen Aug 9, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Language/Haskell/GhcMod/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ gmeDoc e = case e of
\ Try enabling them:" $$
nest 4 (backticks $ text "cabal configure --enable-tests [--enable-benchmarks]")

backticks d = char '`' <> d <> char '`'
ctxDoc = moduleDoc *** compsDoc
>>> first (<> colon) >>> uncurry (flip hang 4)

Expand All @@ -104,6 +103,27 @@ gmeDoc e = case e of
GMETooManyCabalFiles cfs ->
text $ "Multiple cabal files found. Possible cabal files: \""
++ intercalate "\", \"" cfs ++"\"."
GMEMissingHaddockInterface f ->
text ("Haddock interface file missing: " ++ f) $$
text "" $$
haddockSuggestion
GMENoVisibleExports moduleName package ->
text $ "Failed to find visible exports of \"" ++ moduleName ++ "\" in \"" ++ package ++ "\""

where

backticks d = char '`' <> d <> char '`'

haddockSuggestion =
text "- To generate Haddock docs for dependencies, try:" $$
nest 4 (backticks $ text "cabal install --enable-documentation --haddock-hyperlink-source --only-dependencies") $$
text "" $$
text "- or set" $$
nest 4 (backticks $ text "documentation: True") $$
text "in ~/.cabal/config" $$
text "" $$
text "- or with Stack:" $$
nest 4 (backticks $ text "stack haddock")

ghcExceptionDoc :: GhcException -> Doc
ghcExceptionDoc e@(CmdLineError _) =
Expand Down
49 changes: 49 additions & 0 deletions Language/Haskell/GhcMod/Gap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ module Language.Haskell.GhcMod.Gap (
, mkErrStyle'
, everythingStagedWithContext
, withCleanupSession
, ghcQualify
, ghcIdeclHiding
, ghc_sl_fs
, ghc_ms_textual_imps
) where

import Control.Applicative hiding (empty)
Expand Down Expand Up @@ -118,6 +122,10 @@ import Control.DeepSeq (NFData(rnf))
import Data.ByteString.Lazy.Internal (ByteString(..))
#endif

#if __GLASGOW_HASKELL__ >= 800
import BasicTypes (sl_fs, StringLiteral)
#endif

import Bag
import Lexer as L
import Parser
Expand Down Expand Up @@ -687,3 +695,44 @@ withCleanupSession action = do
df <- getSessionDynFlags
GHC.defaultCleanupHandler df action
#endif

-- | Things for Language.Haskell.GhcMod.ImportedFrom

#if __GLASGOW_HASKELL__ >= 710
ghcQualify :: PrintUnqualified
ghcQualify = reallyAlwaysQualify
#else
ghcQualify :: PrintUnqualified
ghcQualify = alwaysQualify
#endif

#if __GLASGOW_HASKELL__ >= 710
ghcIdeclHiding :: GHC.ImportDecl GHC.RdrName -> Maybe (Bool, SrcLoc.Located [GHC.LIE GHC.RdrName])
ghcIdeclHiding = GHC.ideclHiding
#else
-- Here, we have
--
-- ideclHiding :: Maybe (Bool, [LIE name])
--
-- so we have to use noLoc to get a SrcLoc.Located type in the second part of the tuple.
ghcIdeclHiding :: GHC.ImportDecl GHC.RdrName -> Maybe (Bool, SrcLoc.Located [GHC.LIE GHC.RdrName])
ghcIdeclHiding x = case GHC.ideclHiding x of
Just (b, lie) -> Just (b, GHC.noLoc lie)
Nothing -> Nothing
#endif

#if __GLASGOW_HASKELL__ >= 800
ghc_sl_fs :: StringLiteral -> FastString
ghc_sl_fs = sl_fs
#else
ghc_sl_fs = id
#endif


ghc_ms_textual_imps :: GHC.ModSummary -> [Located (ImportDecl RdrName)]
#if __GLASGOW_HASKELL__ >= 800
-- What does GHC8 give in the first part of the tuple?
ghc_ms_textual_imps ms = map (fmap simpleImportDecl . snd) (ms_textual_imps ms)
#else
ghc_ms_textual_imps = ms_textual_imps
#endif
Loading