ghc-mod 5.2.1.1 → 5.2.1.2
raw patch · 10 files changed
+65/−44 lines, 10 filesdep ~ghcdep ~mtlPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc, mtl
API changes (from Hackage documentation)
Files
- ChangeLog +10/−0
- Language/Haskell/GhcMod/Browse.hs +15/−5
- Language/Haskell/GhcMod/Monad.hs +28/−4
- Language/Haskell/GhcMod/Monad.hs-boot +0/−21
- Language/Haskell/GhcMod/Utils.hs +1/−2
- elisp/ghc-doc.el +3/−3
- elisp/ghc-process.el +5/−6
- elisp/ghc.el +1/−1
- ghc-mod.cabal +1/−1
- src/GHCMod.hs +1/−1
ChangeLog view
@@ -1,5 +1,15 @@+2014-12-31 v5.2.1.2+ * Merge #377, Fix `browse` erroneously thinking haskell2010 identifiers+ are operators+ * Fix incompatibility with monad-control >= 1.0.0+ * Fix temporary directories not being removed properly+ * Merge #405, #408, a race condition in the Emacs frontend+ * Merge #403, Support unicode quotes in module regexp+ 2014-11-03 v5.2.1.1 * Fix `findCabalFiles` thinking `$HOME/.cabal` is a cabal file.+ * Support `where` clauses, `let` bindings and `case` expressions+ in case splitting, #400 2014-11-02 v5.2.1.0 * Fix `newTempDir` on Windows
Language/Haskell/GhcMod/Browse.hs view
@@ -61,13 +61,23 @@ (mdl,"") -> (Nothing,mdl) (pkg,_:mdl) -> (Just pkg,mdl) +-- Haskell 2010:+-- small -> ascSmall | uniSmall | _+-- ascSmall -> a | b | ... | z+-- uniSmall -> any Unicode lowercase letter+-- varid -> (small {small | large | digit | ' })++isNotOp :: String -> Bool+isNotOp (h:_) = isAlpha h || (h == '_')+isNotOp _ = error "isNotOp"+ processExports :: IOish m => ModuleInfo -> GhcModT m [String] processExports minfo = do opt <- options let removeOps | operators opt = id- | otherwise = filter (isAlpha . head . getOccString)+ | otherwise = filter (isNotOp . getOccString) mapM (showExport opt minfo) $ removeOps $ G.modInfoExports minfo showExport :: IOish m => Options -> ModuleInfo -> Name -> GhcModT m String@@ -87,10 +97,10 @@ typeName <- tyResult >>= showThing dflag (" :: " ++ typeName) `justIf` detailed opt | otherwise = return Nothing- formatOp nm@(n:_)- | isAlpha n = nm- | otherwise = "(" ++ nm ++ ")"- formatOp "" = error "formatOp"+ formatOp nm+ | null nm = error "formatOp"+ | isNotOp nm = nm+ | otherwise = "(" ++ nm ++ ")" inOtherModule :: IOish m => Name -> GhcModT m (Maybe TyThing) inOtherModule nm = G.getModuleInfo (G.nameModule nm) >> G.lookupGlobalName nm justIf :: a -> Bool -> Maybe a
Language/Haskell/GhcMod/Monad.hs view
@@ -77,7 +77,10 @@ import Control.Applicative (Alternative) import Control.Arrow (first)-import Control.Monad (MonadPlus, void, liftM)+import Control.Monad (MonadPlus, void)+#if !MIN_VERSION_monad_control(1,0,0)+import Control.Monad (liftM)+#endif import Control.Monad.Base (MonadBase, liftBase) -- Monad transformer stuff@@ -270,16 +273,18 @@ => Options -> GhcModT m a -> m (Either GhcModError a, GhcModLog)-runGhcModT opt action = do- env <- liftBase $ newGhcModEnv opt =<< getCurrentDirectory+runGhcModT opt action = gbracket newEnv delEnv $ \env -> do r <- first (fst <$>) <$> (runGhcModT' env defaultState $ do dflags <- getSessionDynFlags defaultCleanupHandler dflags $ do initializeFlagsWithCradle opt (gmCradle env) action)- liftBase $ cleanupGhcModEnv env return r + where+ newEnv = liftBase $ newGhcModEnv opt =<< getCurrentDirectory+ delEnv = liftBase . cleanupGhcModEnv+ -- | @hoistGhcModT result@. Embed a GhcModT computation's result into a GhcModT -- computation. Note that if the computation that returned @result@ modified the -- state part of GhcModT this cannot be restored.@@ -366,7 +371,24 @@ instance (MonadBaseControl IO m) => MonadBase IO (GhcModT m) where liftBase = GhcModT . liftBase +#if MIN_VERSION_monad_control(1,0,0)+ instance (MonadBaseControl IO m) => MonadBaseControl IO (GhcModT m) where+ type StM (GhcModT m) a =+ StM (StateT GhcModState+ (ErrorT GhcModError+ (JournalT GhcModLog+ (ReaderT GhcModEnv m) ) ) ) a+ liftBaseWith f = GhcModT . liftBaseWith $ \runInBase ->+ f $ runInBase . unGhcModT++ restoreM = GhcModT . restoreM+ {-# INLINE liftBaseWith #-}+ {-# INLINE restoreM #-}++#else++instance (MonadBaseControl IO m) => MonadBaseControl IO (GhcModT m) where newtype StM (GhcModT m) a = StGhcMod { unStGhcMod :: StM (StateT GhcModState (ErrorT GhcModError@@ -378,6 +400,8 @@ restoreM = GhcModT . restoreM . unStGhcMod {-# INLINE liftBaseWith #-} {-# INLINE restoreM #-}++#endif -- GHC cannot prove the following instances to be decidable automatically using -- the FlexibleContexts extension as they violate the second Paterson Condition,
− Language/Haskell/GhcMod/Monad.hs-boot
@@ -1,21 +0,0 @@-{-# LANGUAGE RoleAnnotations #-}--module Language.Haskell.GhcMod.Monad where--import DynFlags (HasDynFlags)-import Control.Monad.IO.Class (MonadIO)-import Control.Applicative (Applicative)--data GhcModT m a-type role GhcMod nominal--data GhcModEnv-data GhcModState-type GhcModWriter = ()--instance Functor GhcMod-instance Applicative GhcMod-instance Monad GhcMod--instance HasDynFlags GhcMod-instance MonadIO GhcMod
Language/Haskell/GhcMod/Utils.hs view
@@ -54,8 +54,7 @@ (\_ -> liftIO (setCurrentDirectory dir) >> action) uniqTempDirName :: FilePath -> FilePath-uniqTempDirName dir =- uncurry (++)+uniqTempDirName dir = ("ghc-mod"++) $ uncurry (++) $ map escapeDriveChar *** map escapePathChar $ splitDrive dir where
elisp/ghc-doc.el view
@@ -22,8 +22,8 @@ (setq expr (ghc-read-expression expr0)) (setq info (ghc-get-info expr0)) (setq mod (ghc-extact-module-from-info info)))- (setq pkg-ver-path (ghc-resolve-document-path mod))- (if (and pkg-ver-path mod)+ (setq pkg-ver-path (and mod (ghc-resolve-document-path mod)))+ (if pkg-ver-path (ghc-display-document pkg-ver-path mod haskell-org expr) (message "No document found")))) @@ -75,7 +75,7 @@ (apply 'concat (nreverse acc)))) (defun ghc-extact-module-from-info (info)- (when (string-match "\`\\([^']+\\)'" info)+ (when (string-match "[`\u2018]\\([^'\u2019]+\\)['\u2019]" info) (match-string 1 info))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
elisp/ghc-process.el view
@@ -111,13 +111,12 @@ (setq ghc-process-results nil) (setq ghc-process-num-of-results (or n 1)) (let ((pro (ghc-with-process cmd 'ghc-process-callback nil hook)))+ ;; ghc-process-running is now t.+ ;; But if the process exits abnormally, it is set to nil. (condition-case nil- (while (null ghc-process-rendezvous)- ;; 0.01 is too fast for Emacs 24.4.- ;; (sit-for 0.1 t) may get stuck when tooltip is displayed.- (sit-for 0.1)- ;; (discard-input) avoids getting stuck.- (discard-input))+ (let ((inhibit-quit nil))+ (while (and (null ghc-process-rendezvous) ghc-process-running)+ (accept-process-output pro 0.1 nil t))) (quit (setq ghc-process-running nil)))) ghc-process-results))
elisp/ghc.el view
@@ -28,7 +28,7 @@ (< emacs-minor-version minor))) (error "ghc-mod requires at least Emacs %d.%d" major minor))) -(defconst ghc-version "5.2.1.1")+(defconst ghc-version "5.2.1.2") ;; (eval-when-compile ;; (require 'haskell-mode))
ghc-mod.cabal view
@@ -1,5 +1,5 @@ Name: ghc-mod-Version: 5.2.1.1+Version: 5.2.1.2 Author: Kazu Yamamoto <kazu@iij.ad.jp> Daniel Gröber <dxld@darkboxed.org> Alejandro Serrano <trupill@gmail.com>
src/GHCMod.hs view
@@ -87,7 +87,7 @@ \ - help | --help\n\ \ Print this help message.\n\ \\n\- \ - list [FLAGS...]\n\+ \ - list [FLAGS...] | modules [FLAGS...]\n\ \ List all visible modules.\n\ \ Flags:\n\ \ -d\n\