Permalink
Browse files

Fix some warnings.

  • Loading branch information...
reinerp committed May 24, 2011
1 parent acfd183 commit 3338c88b558a4fdec8389bf054a423c1be44b3a9
Showing with 181 additions and 193 deletions.
  1. +1 −2 yi/src/library/Data/Rope.hs
  2. +0 −1 yi/src/library/Parser/Incremental.hs
  3. +0 −2 yi/src/library/Shim/CabalInfo.hs
  4. +28 −15 yi/src/library/Shim/ProjectContent.hs
  5. +1 −1 yi/src/library/Shim/Utils.hs
  6. +3 −1 yi/src/library/System/FriendlyPath.hs
  7. +0 −2 yi/src/library/Yi/Buffer/Basic.hs
  8. +4 −3 yi/src/library/Yi/Buffer/Implementation.hs
  9. +2 −2 yi/src/library/Yi/Buffer/Misc.hs
  10. +0 −2 yi/src/library/Yi/Buffer/Normal.hs
  11. +0 −2 yi/src/library/Yi/Buffer/Undo.hs
  12. +0 −1 yi/src/library/Yi/Command.hs
  13. +1 −1 yi/src/library/Yi/Debug.hs
  14. +0 −3 yi/src/library/Yi/Dired.hs
  15. +3 −4 yi/src/library/Yi/Dynamic.hs
  16. +1 −2 yi/src/library/Yi/Eval.hs
  17. +0 −2 yi/src/library/Yi/File.hs
  18. +0 −1 yi/src/library/Yi/Hoogle.hs
  19. +2 −1 yi/src/library/Yi/IncrementalParse.hs
  20. +1 −1 yi/src/library/Yi/Keymap.hs
  21. +1 −3 yi/src/library/Yi/Keymap/Emacs.hs
  22. +0 −1 yi/src/library/Yi/Keymap/Emacs/KillRing.hs
  23. +8 −6 yi/src/library/Yi/Keymap/Emacs/Utils.hs
  24. +14 −11 yi/src/library/Yi/Keymap/Vim.hs
  25. +0 −2 yi/src/library/Yi/KillRing.hs
  26. +2 −3 yi/src/library/Yi/Layout.hs
  27. +1 −0 yi/src/library/Yi/Lexer/Alex.hs
  28. +2 −4 yi/src/library/Yi/MiniBuffer.hs
  29. +1 −2 yi/src/library/Yi/Misc.hs
  30. +0 −2 yi/src/library/Yi/Mode/Buffers.hs
  31. +2 −3 yi/src/library/Yi/Mode/Compilation.hs
  32. +35 −34 yi/src/library/Yi/Mode/Haskell.hs
  33. +2 −2 yi/src/library/Yi/Mode/Haskell/Dollarify.hs
  34. +3 −4 yi/src/library/Yi/Mode/JavaScript.hs
  35. +0 −1 yi/src/library/Yi/Monad.hs
  36. +4 −6 yi/src/library/Yi/Prelude.hs
  37. +5 −4 yi/src/library/Yi/Process.hs
  38. +0 −2 yi/src/library/Yi/Rectangle.hs
  39. +1 −0 yi/src/library/Yi/Regex.hs
  40. +3 −2 yi/src/library/Yi/Snippets.hs
  41. +1 −1 yi/src/library/Yi/Style.hs
  42. +2 −2 yi/src/library/Yi/Syntax/Driver.hs
  43. +11 −12 yi/src/library/Yi/Syntax/Haskell.hs
  44. +2 −1 yi/src/library/Yi/Syntax/Latex.hs
  45. +3 −3 yi/src/library/Yi/Syntax/Layout.hs
  46. +4 −6 yi/src/library/Yi/Syntax/OnlineTree.hs
  47. +5 −5 yi/src/library/Yi/Syntax/Paren.hs
  48. +2 −1 yi/src/library/Yi/Syntax/Strokes/Haskell.hs
  49. +6 −4 yi/src/library/Yi/Syntax/Tree.hs
  50. +0 −2 yi/src/library/Yi/Tab.hs
  51. +0 −1 yi/src/library/Yi/Tag.hs
  52. +10 −7 yi/src/library/Yi/UI/Pango.hs
  53. +2 −1 yi/src/library/Yi/UI/Pango/Control.hs
  54. +1 −0 yi/src/library/Yi/UI/Vty.hs
  55. +0 −2 yi/src/library/Yi/Window.hs
  56. +1 −4 yi/src/tests/Driver.hs
@@ -38,7 +38,7 @@ import Prelude hiding (null, head, tail, length, take, drop, splitAt, head, tail
import qualified Data.List as L
import qualified Data.ByteString.UTF8 as B
-import qualified Data.ByteString as B (append, concat, elemIndices)
+import qualified Data.ByteString as B (append, concat)
import qualified Data.ByteString as Byte
import Data.ByteString (ByteString)
import qualified Data.ByteString.Lazy as LB (toChunks, fromChunks, null, readFile)
@@ -51,7 +51,6 @@ import Data.Binary
import Data.Char (ord)
import Data.Monoid
import Data.Foldable (toList)
-import Data.Int
import System.IO.Cautious (writeFileL)
@@ -16,7 +16,6 @@ module Parser.Incremental (Process,
) where
import Control.Applicative
-import Data.List hiding (map, minimumBy)
import Data.Tree
-- Local versions of our Control.Arrow friends (also make sure they are lazy enough)
@@ -5,15 +5,13 @@ import Shim.Utils
import qualified Control.OldException as CE
import System.FilePath
import Control.Monad.State
-import Data.Maybe
import Control.Applicative
import Distribution.ModuleName
import Distribution.PackageDescription
import qualified Distribution.PackageDescription as Library (Library(..))
import qualified Distribution.PackageDescription as BuildInfo (BuildInfo(..))
import System.Directory hiding (canonicalizePath)
-import System.FriendlyPath
import System.CanonicalizePath
guessCabalFile :: String -> IO (Maybe FilePath)
@@ -5,6 +5,8 @@
-- already configured Cabal package.
--
+-- TODO: much of this module was commented out to avoid 'defined but not used' warnings. The commented functions should either be exported or removed.
+
module Shim.ProjectContent
( {- loadProject
, -} itemName
@@ -14,23 +16,21 @@ module Shim.ProjectContent
, ModuleKind(..)
) where
+{-
import Control.Monad.State
import Data.Tree
import Data.Tree.Zipper
import qualified Data.Set as Set
-import Data.List (partition)
-import Distribution.ModuleName
-import Distribution.Version
-import Distribution.Package
import Distribution.PackageDescription
-import Distribution.Simple.LocalBuildInfo
-import Distribution.Simple.Configure
import Distribution.Simple.Utils(findFileWithExtension')
import Distribution.Simple.PreProcess(knownSuffixHandlers)
-import Distribution.Simple.Setup (defaultDistPref)
-import Distribution.Text
import System.FilePath
import System.Directory
+-}
+import Distribution.ModuleName
+import Distribution.Version
+import Distribution.Package
+import Distribution.Text
data ProjectItem
= ProjectItem
@@ -112,6 +112,7 @@ loadProject projPath = do
return (tree tloc5, tree tloc6)
-}
+{-
getTop :: Tree a -> TreeLoc a
getTop = fromTree
@@ -124,20 +125,28 @@ up = modify' parent
modify' :: (a -> Maybe a) -> State a ()
modify' f = modify (\x -> maybe (error "impossible movement!") id (f x))
-
+addLibraryTree :: FilePath
+ -> (Set.Set ProjectItem, TreeLoc ProjectItem)
+ -> Library
+ -> IO (Set.Set ProjectItem, TreeLoc ProjectItem)
addLibraryTree projPath (mod_items,tloc) (Library {libBuildInfo=binfo, exposedModules=exp_mods}) = do
- (exp_mods,hid_mods,mod_items1,tloc1) <- foldM (\st dir -> addSourceDir projPath dir st)
+ (_exp_mods,_hid_mods,mod_items1,tloc1) <- foldM (\st dir -> addSourceDir projPath dir st)
(exp_mods,otherModules binfo,mod_items,tloc)
(hsSourceDirs binfo)
return $ (mod_items1,execState (mapM_ (addFilePath CSource projPath) (cSources binfo)) tloc1)
+addExecutableTree :: FilePath
+ -> (Set.Set ProjectItem, TreeLoc ProjectItem)
+ -> Executable
+ -> IO (Set.Set ProjectItem, TreeLoc ProjectItem)
addExecutableTree projPath (mod_items,tloc) (Executable {modulePath=mainIs, buildInfo=binfo}) = do
let tloc1 = execState (addFilePath (HsSource ExposedModule) projPath mainIs) tloc
- (exp_mods,hid_mods,mod_items2,tloc2) <- foldM (\st dir -> addSourceDir projPath dir st)
+ (_exp_mods,_hid_mods,mod_items2,tloc2) <- foldM (\st dir -> addSourceDir projPath dir st)
([],otherModules binfo,mod_items,tloc1)
(hsSourceDirs binfo)
return $ (mod_items2,execState (mapM_ (addFilePath CSource projPath) (cSources binfo)) tloc2)
+addDependenciesTree :: [PackageIdentifier] -> State (TreeLoc ProjectItem) ()
addDependenciesTree deps = do
insertDown (DependenciesItem "Dependencies")
mapM_ addDependency deps
@@ -156,8 +165,8 @@ addSourceDir projPath srcDir (exp_mods,hid_mods,mod_items,tloc) = do
(exp_paths,exp_mods) <- findModules dir exp_mods
(hid_paths,hid_mods) <- findModules dir hid_mods
let tloc1 = execState (addFilePath' (\c -> FolderItem c HsSourceFolder) (splitPath' srcDir)
- (mapM_ (\(mod,loc) -> addFilePath (HsSource ExposedModule) dir loc) exp_paths >>
- mapM_ (\(mod,loc) -> addFilePath (HsSource HiddenModule) dir loc) hid_paths))
+ (mapM_ (\(_mod,loc) -> addFilePath (HsSource ExposedModule) dir loc) exp_paths >>
+ mapM_ (\(_mod,loc) -> addFilePath (HsSource HiddenModule) dir loc) hid_paths))
tloc
mod_items1 = foldr (\(mod,loc) -> Set.insert (ModuleItem mod (dir </> loc) ExposedModule)) mod_items exp_paths
mod_items2 = foldr (\(mod,loc) -> Set.insert (ModuleItem mod (dir </> loc) HiddenModule )) mod_items1 hid_paths
@@ -169,7 +178,7 @@ addFilePath kind root fpath = addFilePath' (\c -> FileItem c (root </> fpath) ki
addFilePath' :: (String -> ProjectItem) -> [String]
-> State (TreeLoc ProjectItem) ()
-> State (TreeLoc ProjectItem) ()
-addFilePath' mkItem [] cont = cont
+addFilePath' _ [] cont = cont
addFilePath' mkItem (c:cs) cont
| c == "." = addFilePath' mkItem cs cont
| otherwise = do let item | null cs = mkItem c
@@ -192,15 +201,18 @@ addFilePath' mkItem (c:cs) cont
then modify $ insertRight $ simpleNode item
else modify' right >> insertItem c item
+simpleNode :: a -> Tree a
simpleNode item = Node item []
+splitPath' :: FilePath -> [String]
splitPath' fpath = [removeSlash c | c <- splitPath fpath]
where
removeSlash c
| null c = c
| isPathSeparator (last c) = init c
| otherwise = c
+checkAndAddFile :: FilePath -> FilePath -> FileKind -> TreeLoc ProjectItem -> IO (TreeLoc ProjectItem)
checkAndAddFile projPath fpath kind tloc = do
let fullPath = projPath </> fpath
exists <- doesFileExist fullPath
@@ -215,7 +227,7 @@ checkAndAddFile projPath fpath kind tloc = do
findModules :: FilePath -- ^source directory location
-> [ModuleName] -- ^module names
-> IO ([(ModuleName,FilePath)],[ModuleName]) -- ^found modules and unknown modules
-findModules location [] = return ([],[])
+findModules _ [] = return ([],[])
findModules location (mod:mods) = do
mb_paths <- findFileWithExtension' (map fst knownSuffixHandlers ++ ["hs", "lhs"]) [location] (toFilePath mod)
(locs,unks) <- findModules location mods
@@ -230,3 +242,4 @@ findFirstFile file = findFirst
if exists
then return (Just x)
else findFirst xs
+-}
@@ -48,7 +48,7 @@ processGetContents :: FilePath -> [String] -> IO String
processGetContents cmd args = do
(_,out,_,pid) <- runInteractiveProcess cmd args Nothing Nothing
s <- hGetContents out
- waitForProcess pid
+ _ <- waitForProcess pid
return s
recurseDir :: (Monad m) => (FilePath -> m (Maybe a)) -> FilePath -> m (Maybe a)
@@ -5,7 +5,6 @@ module System.FriendlyPath
) where
import Control.Applicative
-import Data.List
import System.FilePath
import System.Posix.User (getUserEntryForName, homeDirectory)
import System.CanonicalizePath
@@ -17,6 +16,8 @@ import System.Directory hiding (canonicalizePath)
userToCanonPath :: FilePath -> IO String
userToCanonPath f = canonicalizePath =<< expandTilda f
+{-
+TODO: export or remove
-- | Make a path more user-friendly by replacing the home directory with tilda.
recoverTilda :: FilePath -> IO String
recoverTilda path = do
@@ -28,6 +29,7 @@ recoverTilda path = do
-- | Turn a path into its canonicalized, user-friendly version.
canonicalizePath' :: FilePath -> IO String
canonicalizePath' f = recoverTilda =<< canonicalizePath f
+-}
-- | Turn a user-friendly path into a computer-friendly path by expanding the leading tilda.
expandTilda :: String -> IO FilePath
@@ -6,9 +6,7 @@ import Prelude (reverse)
import Data.Binary
import Yi.Prelude
import qualified Data.Rope as R
-import Data.Typeable
import Data.DeriveTH
-import Data.Derive.Binary
import Data.Ix
-- | Direction of movement inside a buffer
@@ -77,9 +77,10 @@ data OvlLayer = UserLayer | HintLayer
deriving (Ord, Eq)
data Overlay = Overlay {
overlayLayer :: OvlLayer,
- overlayBegin :: MarkValue,
- overlayEnd :: MarkValue,
- overlayStyle :: StyleName
+ -- underscores to avoid 'defined but not used'. Remove if desired
+ _overlayBegin :: MarkValue,
+ _overlayEnd :: MarkValue,
+ _overlayStyle :: StyleName
}
instance Eq Overlay where
Overlay a b c _ == Overlay a' b' c' _ = a == a' && b == b' && c == c'
@@ -100,10 +100,10 @@ module Yi.Buffer.Misc
, modePrettifyA
, modeKeymapA
, modeIndentA
- , modeAdjustBlock
+ , modeAdjustBlockA
, modeFollowA
, modeIndentSettingsA
- , modeToggleCommentSelection
+ , modeToggleCommentSelectionA
, modeGetStrokesA
, modeGetAnnotationsA
, modePrintTreeA
@@ -51,9 +51,7 @@ import Yi.Buffer.Region
import Yi.Dynamic
import Data.Char
import Data.List (sort)
-import Control.Applicative
import Control.Monad
-import Data.Accessor (Accessor)
import Data.Binary
import Data.DeriveTH
@@ -57,10 +57,8 @@ module Yi.Buffer.Undo (
, Change(AtomicChange, InteractivePoint)
) where
-import Control.Monad (ap)
import Data.Binary
import Data.DeriveTH
-import Data.Derive.Binary
import Yi.Buffer.Implementation
data Change = SavedFilePoint
@@ -13,7 +13,6 @@ import Control.Monad.Trans (MonadIO (..))
{- Local (yi) module imports -}
import Prelude ()
-import Yi.Prelude (discard)
import Yi.Core
import Yi.MiniBuffer
import qualified Yi.Mode.Compilation as Compilation
@@ -69,7 +69,7 @@ logError s = logPutStrLn $ "error: " ++ s
logStream :: Show a => String -> Chan a -> IO ()
logStream msg ch = do
logPutStrLn $ "Logging stream " ++ msg
- forkIO $ logStreamThread msg ch
+ _ <- forkIO $ logStreamThread msg ch
return ()
logStreamThread :: Show a => String -> Chan a -> IO ()
@@ -42,19 +42,16 @@ import Data.Time.Clock.POSIX
import System.Directory hiding (canonicalizePath)
import System.FilePath
import System.CanonicalizePath (canonicalizePath)
-import System.FriendlyPath
import System.Locale
import System.PosixCompat.Files
import System.PosixCompat.Types
import System.PosixCompat.User
import Text.Printf
-import Yi.Config
import Yi.Core hiding (sequence, forM, notElem)
import {-# source #-} Yi.File (editFile)
import Yi.MiniBuffer (spawnMinibufferE, withMinibufferGen, noHint, withMinibuffer)
import Yi.Misc (getFolder, promptFile)
-import Yi.Regex
import Yi.Style
data DiredFileInfo = DiredFileInfo { permString :: String
@@ -4,24 +4,23 @@
module Yi.Dynamic
(
-- * Nonserializable (\"config\") dynamics
- YiConfigVariable(..),
+ YiConfigVariable,
ConfigVariables, configVariableA,
-- * Serializable dynamics
- YiVariable(..),
+ YiVariable,
DynamicValues, dynamicValueA,
)
where
import Prelude ()
import Yi.Prelude
-import Data.Accessor
import Data.Maybe(fromJust)
import Data.HashMap.Strict as M
import Data.Monoid
import Data.ConcreteTypeRep
import Data.Binary
-import Data.Typeable(Typeable, cast)
+import Data.Typeable(cast)
import Data.ByteString.Lazy(ByteString)
import Data.IORef
import System.IO.Unsafe(unsafePerformIO)
@@ -17,7 +17,6 @@ import System.FilePath
import System.Directory
import Yi.Core hiding (concatMap)
-import Yi.Dired
import Yi.File
import Yi.Regex
@@ -72,7 +71,7 @@ flattenExport (LHI.Data _ xs) = xs
jumpToE :: String -> Int -> Int -> YiM ()
jumpToE filename line column = do
- editFile filename
+ discard $ editFile filename
withBuffer $ do _ <- gotoLn line
moveXorEol column
@@ -21,14 +21,12 @@ import Control.Monad.Reader (asks)
import Data.Maybe
import Data.Time
import Control.Monad.Trans
-import Control.Monad.State (gets)
import System.Directory
import System.IO.UTF8 as UTF8
import System.FilePath
import System.FriendlyPath
import qualified Data.Rope as R
-import Yi.Buffer (file)
import Yi.Config
import Yi.Core
import Yi.Dired
@@ -10,7 +10,6 @@ import System.Exit (ExitCode(ExitFailure))
import Yi.Core
import Yi.Process (runProgCommand)
-import Yi.Buffer (replaceRegionB, unitWord)
-- | Remove anything starting with uppercase letter. These denote either module names or types.
caseSensitize :: [String] -> [String]
@@ -1,5 +1,6 @@
-- Copyright (c) JP Bernardy 2008
-{-# OPTIONS -fglasgow-exts #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+
module Yi.IncrementalParse (recoverWith, symbol, eof, lookNext, testNext,
State, P, Parser(..), AlexState (..), scanner) where
import Parser.Incremental hiding (run)
@@ -22,7 +22,6 @@ import Yi.UI.Common
import qualified Data.Map as M
import qualified Yi.Editor as Editor
import qualified Yi.Interact as I
-import qualified Yi.UI.Common as UI
import Data.Accessor.Template
data Action = forall a. Show a => YiA (YiM a)
@@ -91,6 +90,7 @@ instance MonadEditor YiM where
write :: (I.MonadInteract m Action ev, YiAction a x, Show x) => a -> m ()
write x = I.write (makeAction x)
+write' :: (I.MonadInteract m Action e, YiAction a x, Show x) => String -> a -> m ()
write' s x = I.write (TaggedA s (makeAction x))
--------------------------------
Oops, something went wrong.

0 comments on commit 3338c88

Please sign in to comment.