ghc-mod 1.10.6 → 1.10.7
raw patch · 9 files changed
+48/−65 lines, 9 filesdep +io-choicedep −alternative-io
Dependencies added: io-choice
Dependencies removed: alternative-io
Files
- AA.hs +0/−42
- Cabal.hs +2/−1
- CabalDev.hs +3/−3
- GHCChoice.hs +25/−0
- Gap.hs +2/−2
- Info.hs +4/−3
- elisp/ghc-info.el +4/−8
- elisp/ghc.el +1/−1
- ghc-mod.cabal +7/−5
− AA.hs
@@ -1,42 +0,0 @@-{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--module AA where--import Control.Applicative-import Control.Exception-import Control.Monad-import CoreMonad-import Data.Typeable-import Exception-import GHC--------------------------------------------------------------------instance Applicative Ghc where- pure = return- (<*>) = ap--instance Alternative Ghc where- empty = goNext- x <|> y = x `gcatch` (\(_ :: SomeException) -> y)--------------------------------------------------------------------{-| Go to the next 'Ghc' monad by throwing 'AltGhcgoNext'.--}-goNext :: Ghc a-goNext = liftIO $ throwIO AltGhcgoNext--{-| Run any one 'Ghc' monad.--}-runAnyOne :: [Ghc a] -> Ghc a-runAnyOne = foldr (<|>) goNext--------------------------------------------------------------------{-| Exception to control 'Alternative' 'Ghc'.--}-data AltGhcgoNext = AltGhcgoNext deriving (Show, Typeable)--instance Exception AltGhcgoNext
Cabal.hs view
@@ -14,6 +14,7 @@ import ErrMsg import GHC import GHCApi+import GHCChoice import qualified Gap import Language.Haskell.Extension import System.Directory@@ -26,7 +27,7 @@ importDirs = [".","..","../..","../../..","../../../..","../../../../.."] initializeGHC :: Options -> FilePath -> [String] -> Bool -> Ghc (FilePath,LogReader)-initializeGHC opt fileName ghcOptions logging = withCabal <|> withoutCabal+initializeGHC opt fileName ghcOptions logging = withCabal ||> withoutCabal where withoutCabal = do logReader <- initSession opt ghcOptions importDirs logging
CabalDev.hs view
@@ -5,17 +5,17 @@ options ghc-mod uses to check the source. Otherwise just pass it on. -} -import Control.Applicative ((<$>),(<|>))+import Control.Applicative ((<$>)) import Control.Exception (throwIO)+import Control.Exception.IOChoice import Data.List (find) import System.Directory import System.FilePath (splitPath,joinPath,(</>)) import Text.Regex.Posix ((=~)) import Types-import Data.Alternative.IO () modifyOptions :: Options -> IO Options-modifyOptions opts = found <|> notFound+modifyOptions opts = found ||> notFound where found = addPath opts <$> findCabalDev notFound = return opts
+ GHCChoice.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE ScopedTypeVariables #-}++module GHCChoice where++import Control.Exception+import CoreMonad+import Exception+import GHC++----------------------------------------------------------------++(||>) :: Ghc a -> Ghc a -> Ghc a+x ||> y = x `gcatch` (\(_ :: IOException) -> y)++----------------------------------------------------------------++{-| Go to the next 'Ghc' monad by throwing 'AltGhcgoNext'.+-}+goNext :: Ghc a+goNext = liftIO . throwIO $ userError "goNext"++{-| Run any one 'Ghc' monad.+-}+runAnyOne :: [Ghc a] -> Ghc a+runAnyOne = foldr (||>) goNext
Gap.hs view
@@ -16,12 +16,12 @@ #endif ) where -import AA () import Control.Applicative hiding (empty) import Control.Monad import DynFlags import FastString import GHC+import GHCChoice import Language.Haskell.Extension import Outputable import StringBuffer@@ -117,7 +117,7 @@ return (not . null $ top) #endif where- isTop mos = lookupMod <|> returnFalse+ isTop mos = lookupMod ||> returnFalse where lookupMod = lookupModule (ms_mod_name mos) Nothing >> return True returnFalse = return False
Info.hs view
@@ -2,7 +2,6 @@ module Info (infoExpr, typeExpr) where -import AA import Cabal import Control.Applicative import CoreUtils@@ -15,11 +14,13 @@ import GHC import GHC.SYB.Utils import GHCApi+import GHCChoice import qualified Gap import HscTypes import NameSet import Outputable import PprTyThing+import Pretty (showDocWith, Mode(OneLineMode)) import System.Time import TcRnTypes import Types@@ -93,7 +94,7 @@ ty_env = tcg_type_env $ fst $ tm_internals_ tcm pretty :: Type -> String-pretty = showSDocForUser neverQualify . pprTypeForUser False+pretty = showDocWith OneLineMode . withPprStyleDoc (mkUserStyle neverQualify AllTheWay) . pprTypeForUser False ---------------------------------------------------------------- -- from ghc/InteractiveUI.hs@@ -126,7 +127,7 @@ inModuleContext :: Options -> FilePath -> ModuleString -> Ghc String -> String -> IO String inModuleContext opt fileName modstr action errmsg =- withGHC (valid <|> invalid <|> return errmsg)+ withGHC (valid ||> invalid ||> return errmsg) where valid = do (file,_) <- initializeGHC opt fileName ["-w"] False
elisp/ghc-info.el view
@@ -14,10 +14,8 @@ (interactive "P") (if (not (ghc-which ghc-module-command)) (message "%s not found" ghc-module-command)- (let ((modname (ghc-find-module-name)))- (if (not modname)- (message "module should be specified")- (ghc-show-info0 ask modname)))))+ (let ((modname (or (ghc-find-module-name) "Main")))+ (ghc-show-info0 ask modname)))) (defun ghc-show-info0 (ask modname) (let* ((expr0 (ghc-things-at-point))@@ -87,10 +85,8 @@ (interactive) (if (not (ghc-which ghc-module-command)) (message "%s not found" ghc-module-command)- (let ((modname (ghc-find-module-name)))- (if (not modname)- (message "module should be specified")- (ghc-show-type0 modname)))))+ (let ((modname (or (ghc-find-module-name) "Main")))+ (ghc-show-type0 modname)))) (defun ghc-show-type0 (modname) (let* ((buf (current-buffer))
elisp/ghc.el view
@@ -16,7 +16,7 @@ ;;; Code: -(defconst ghc-version "1.10.6")+(defconst ghc-version "1.10.7") ;; (eval-when-compile ;; (require 'haskell-mode))
ghc-mod.cabal view
@@ -1,11 +1,11 @@ Name: ghc-mod-Version: 1.10.6+Version: 1.10.7 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3 License-File: LICENSE Homepage: http://www.mew.org/~kazu/proj/ghc-mod/-Synopsis: Happy Haskell programming on Emacs+Synopsis: Happy Haskell programming on Emacs/Vim Description: This packages includes Elisp files and a Haskell command, "ghc-mod". "ghc*.el" enable completion of@@ -15,6 +15,8 @@ It lists up all installed modules or extracts names of functions, classes, and data declarations.+ To use "ghc-mod" on Vim,+ see <https://github.com/eagletmt/ghcmod-vim> Category: Development Cabal-Version: >= 1.6 Build-Type: Simple@@ -23,14 +25,14 @@ ghc-flymake.el ghc-command.el ghc-info.el ghc-ins-mod.el Executable ghc-mod Main-Is: GHCMod.hs- Other-Modules: AA- Browse+ Other-Modules: Browse Cabal CabalDev Check ErrMsg Flag GHCApi+ GHCChoice Gap Info Lang@@ -44,13 +46,13 @@ GHC-Options: -Wall Build-Depends: base >= 4.0 && < 5 , Cabal- , alternative-io , directory , filepath , ghc , ghc-paths , ghc-syb-utils , hlint >= 1.7.1+ , io-choice , old-time , process , regex-posix