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
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 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
Prev Previous commit
Next Next commit
Fewer imports; move moduleNameToHtmlFile into a where clause.
carlohamalainen committed Jul 17, 2016
commit 048eaac9b3c2c431922f8b7a6f6d96b38d7ea53d
26 changes: 8 additions & 18 deletions Language/Haskell/GhcMod/ImportedFrom.hs
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@

module Language.Haskell.GhcMod.ImportedFrom (importedFrom) where

import Control.Applicative
import Control.Exception
import Control.Monad
import Data.Char (isAlpha)
@@ -26,12 +25,9 @@ import Data.IORef
import Data.List
import Data.List.Split
import Data.Maybe
import Data.Typeable()
import Desugar()
import Exception (ghandle)
import FastString
import GHC
import GHC.SYB.Utils()
import HscTypes
import Language.Haskell.GhcMod
import Language.Haskell.GhcMod.DynFlags
@@ -44,18 +40,11 @@ import Language.Haskell.GhcMod.Output
import Language.Haskell.GhcMod.SrcUtils (listifySpans)
import Outputable
import System.Directory
import System.Process
import System.Environment()
import System.Exit
import System.FilePath
import System.IO.Error
import TcRnTypes()

import qualified Data.Map as M
import qualified Documentation.Haddock as Haddock
import qualified DynFlags()
import qualified GhcMonad
import qualified MonadUtils()
import qualified Safe
import qualified SrcLoc
import qualified Text.Parsec as TP
@@ -437,13 +426,6 @@ getVisibleExports getHaddockInterfaces p = do
ref <- GhcMonad.withSession (return . hsc_NC)
liftIO $ writeIORef ref nc'

-- | Convert a module name string, e.g. @Data.List@ to @Data-List.html@.
moduleNameToHtmlFile :: String -> String
moduleNameToHtmlFile m = map f m ++ ".html"
where f :: Char -> Char
f '.' = '-'
f c = c

filterMatchingQualifiedImport :: String -> [NiceImportDecl] -> [NiceImportDecl]
filterMatchingQualifiedImport symbol hmodules =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also should be in a where, the indenting looks strange also. Newline after of please.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit 13e5cdabb9bb484c0c843c5752ab07ff559f2366
Author: Carlo Hamalainen <carlo@carlo-hamalainen.net>
Date:   Sun Jul 17 22:19:48 2016 +1000

    Move filterMatchingQualifiedImport to a where clause; tidy up
    indenting.

case moduleOfQualifiedName symbol of Nothing -> []
@@ -757,6 +739,14 @@ guessHaddockUrl modSum targetFile targetModule symbol lineNr colNr ghcPkg readPr
else do gmErrStrLn "Please reinstall packages using the flag '--enable-documentation' for 'cabal install.\n"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a proper top level error in GhcModError too.

return $ Left $ "Could not find " ++ f

where
-- Convert a module name string, e.g. @Data.List@ to @Data-List.html@.
moduleNameToHtmlFile :: String -> String
moduleNameToHtmlFile m = map f m ++ ".html"
where f :: Char -> Char
f '.' = '-'
f c = c

-- | Look up Haddock docs for a symbol.
importedFrom
:: forall m. IOish m