Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Fix warnings #171

Merged
merged 2 commits into from
Jan 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ install:
- "./travis_long stack +RTS -N2 -RTS setup"
- "./travis_long stack build --only-snapshot"
- "./travis_long stack install ide-backend-server"
- "export PATH=\"${HOME}/.local/bin\":${PATH}"
script:
- "./travis_long stack +RTS -N1 -RTS build"
- "STACK_YAML=stack_test.yaml ./travis_long stack +RTS -N1 -RTS build --test --no-run-tests"
- "./travis_long stack +RTS -N1 -RTS build --test"
- "./travis_long stack exec emacs24 -- -q --batch -L elisp -l elisp/tests/hie-tests.el
-f ert-run-tests-batch-and-exit"
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ ifeq (,$(shell which $(emacs) 2> /dev/null))
endif

.PHONY: test
test: test-haskell test-emacs
test: build-haskell test-haskell test-emacs

.PHONY: test-emacs
test-emacs:
stack exec $(emacs) -- -q --batch -L elisp -l elisp/tests/hie-tests.el -f ert-run-tests-batch-and-exit

.PHONY: test-haskell
build-haskell:
@STACK_YAML=stack_test.yaml stack build --test --no-run-tests
test-haskell:
# stack build --test --pedantic
# stack complains about deprecations in ghc-mod as an extra dep
# build with -Werror enabled but run the tests without it because ide-backend picks it up
stack build --test

.PHONY: ghci-test
Expand Down
2 changes: 2 additions & 0 deletions app/MainHie.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}

{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TemplateHaskell #-}
Expand Down
8 changes: 8 additions & 0 deletions haskell-ide-engine.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

library
hs-source-dirs: src
exposed-modules: Haskell.Ide.Engine.BasePlugin
Expand Down Expand Up @@ -94,6 +98,8 @@ executable hie
, transformers
, vinyl
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010

test-suite haskell-ide-test
Expand Down Expand Up @@ -135,6 +141,8 @@ test-suite haskell-ide-test
, unordered-containers
, vinyl
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010

source-repository head
Expand Down
6 changes: 3 additions & 3 deletions hie-apply-refact/Haskell/Ide/ApplyRefactPlugin.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
Expand All @@ -17,8 +19,6 @@ import Haskell.Ide.Engine.PluginUtils
import Haskell.Ide.Engine.SemanticTypes
import Language.Haskell.HLint3 as Hlint
import Refact.Apply
import qualified Refact.Types as R
import Refact.Types hiding (SrcSpan)
import System.Directory
import System.IO.Extra

Expand Down Expand Up @@ -108,7 +108,7 @@ showParseError (Hlint.ParseError loc message content) = unlines [show loc, messa
makeDiffResult :: FilePath -> T.Text -> IO HieDiff
makeDiffResult orig new = do
origText <- T.readFile orig
let (HieDiff f s d) = diffText (orig,origText) ("changed",new)
let (HieDiff f _ d) = diffText (orig,origText) ("changed",new)
f' <- liftIO $ makeRelativeToCurrentDirectory f
-- return (HieDiff f' s' d)
return (HieDiff f' "changed" d)
6 changes: 6 additions & 0 deletions hie-apply-refact/hie-apply-refact.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

library
exposed-modules: Haskell.Ide.ApplyRefactPlugin
build-depends: base >= 4.7 && < 5
Expand All @@ -30,4 +34,6 @@ library
, transformers
, vinyl >= 0.5 && < 0.6
ghc-options: -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010
6 changes: 6 additions & 0 deletions hie-base/hie-base.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

library
exposed-modules:
Haskell.Ide.Engine.PluginTypes
Expand All @@ -24,4 +28,6 @@ library
, singletons
, vinyl
ghc-options: -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010
9 changes: 8 additions & 1 deletion hie-docs-generator/hie-docs-generator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

executable hie-docs-generator
main-is: Main.hs
other-modules: Options, Examples
Expand All @@ -39,4 +43,7 @@ executable hie-docs-generator
, pcre-heavy
, text
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010
6 changes: 0 additions & 6 deletions hie-docs-generator/src/Examples.hs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
{-# LANGUAGE OverloadedStrings #-}
module Examples where

import qualified Data.Aeson as A
import qualified Data.ByteString.Lazy as BSL
import qualified Data.Map as M
import Data.Monoid
import qualified Data.Text as T
import Haskell.Ide.Engine.BasePlugin
import Haskell.Ide.HaRePlugin
import Haskell.Ide.Engine.PluginDescriptor
import Haskell.Ide.Engine.Transport.JsonStdio
import Options

jsonStdioExample :: PluginId -> UntaggedCommandDescriptor -> WireRequest
jsonStdioExample pluginId (CommandDesc{cmdName = name,cmdContexts = contexts,cmdAdditionalParams = cmdParams}) =
Expand Down
10 changes: 2 additions & 8 deletions hie-docs-generator/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Text.IO as T
import Examples
import Haskell.Ide.ApplyRefactPlugin
import Haskell.Ide.Engine.BasePlugin
import Haskell.Ide.Engine.PluginDescriptor
import Haskell.Ide.ExamplePlugin2
import Haskell.Ide.ExamplePluginAsync
import Haskell.Ide.GhcModPlugin
import Haskell.Ide.HaRePlugin
import qualified Options as O
import Options.Applicative
import System.Directory
Expand All @@ -41,11 +35,11 @@ newtype DocGenM a =

generateDocs :: DocGenM ()
generateDocs =
do path <- pluginIndexPath
do indexPath <- pluginIndexPath
index <- pluginIndex
prefix <- asks O.prefix
liftIO . createDirectoryIfMissing True $ prefix </> "plugins"
liftIO $ T.writeFile path index
liftIO $ T.writeFile indexPath index
plugins <- asks O.plugins
let pluginDocs = map pluginDoc $ M.toList plugins
pluginDocPaths <- mapM pluginDocPath $ M.keys plugins
Expand Down
9 changes: 5 additions & 4 deletions hie-eg-plugin-async/Haskell/Ide/ExamplePluginAsync.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GADTs #-}
Expand All @@ -8,13 +10,11 @@ import Control.Concurrent
import Control.Concurrent.STM.TChan
import Control.Monad.IO.Class
import Control.Monad.STM
import qualified Data.Map as Map
import Data.Monoid
import qualified Data.Text as T
import Haskell.Ide.Engine.ExtensibleState
import Haskell.Ide.Engine.MonadFunctions
import Haskell.Ide.Engine.PluginDescriptor
import Haskell.Ide.Engine.PluginUtils

-- ---------------------------------------------------------------------

Expand Down Expand Up @@ -64,7 +64,7 @@ instance ExtensionClass AsyncPluginState where

-- | This command manages interaction with a separate process, doing stuff.
longRunningCmdSync :: WorkerCmd -> CommandFunc T.Text
longRunningCmdSync cmd = CmdSync $ \_ctx req -> do
longRunningCmdSync cmd = CmdSync $ \_ctx _req -> do
SubProcess cin cout _tid <- ensureProcessRunning
liftIO $ atomically $ writeTChan cin cmd
res <- liftIO $ atomically $ readTChan cout
Expand Down Expand Up @@ -95,6 +95,7 @@ ensureProcessRunning = do
workerProc :: TChan WorkerCmd -> TChan T.Text -> IO ()
workerProc cin cout = loop 1
where
loop :: Integer -> IO ()
loop cnt = do
debugm "workerProc:top of loop"
req <- liftIO $ atomically $ readTChan cin
Expand All @@ -111,7 +112,7 @@ workerProc cin cout = loop 1

-- | This command manages interaction with a separate process, doing stuff.
streamingCmdAsync :: WorkerCmdAsync -> CommandFunc T.Text
streamingCmdAsync cmd = CmdAsync $ \replyFunc _ctx req -> do
streamingCmdAsync cmd = CmdAsync $ \replyFunc _ctx _req -> do
tid <- liftIO $ forkIO (workerProcAsync cmd replyFunc)
debugm $ "streamingCmdAsync:launched worker as " ++ show tid
let tidStr = T.pack (show tid ++ ":")
Expand Down
6 changes: 6 additions & 0 deletions hie-eg-plugin-async/hie-eg-plugin-async.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

library
exposed-modules: Haskell.Ide.ExamplePluginAsync
build-depends: base >= 4.7 && < 5
Expand All @@ -21,4 +25,6 @@ library
, text
, transformers
ghc-options: -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010
2 changes: 2 additions & 0 deletions hie-example-plugin2/Haskell/Ide/ExamplePlugin2.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down
6 changes: 6 additions & 0 deletions hie-example-plugin2/hie-example-plugin2.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

library
exposed-modules: Haskell.Ide.ExamplePlugin2
build-depends: base >= 4.7 && < 5
Expand All @@ -20,4 +24,6 @@ library
, text
, transformers
ghc-options: -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010
4 changes: 2 additions & 2 deletions hie-ghc-mod/Haskell/Ide/GhcModPlugin.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}

{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
Expand All @@ -8,7 +10,6 @@ module Haskell.Ide.GhcModPlugin where

import Haskell.Ide.Engine.PluginUtils

import Control.Exception
import Control.Monad.IO.Class
import Data.Aeson
import Data.Either
Expand All @@ -18,7 +19,6 @@ import qualified Data.Text.Read as T
import Data.Vinyl
import qualified Exception as G
import Haskell.Ide.Engine.PluginDescriptor
import Haskell.Ide.Engine.PluginUtils
import Haskell.Ide.Engine.SemanticTypes
import qualified Language.Haskell.GhcMod as GM
import qualified Language.Haskell.GhcMod.Monad as GM
Expand Down
6 changes: 6 additions & 0 deletions hie-ghc-mod/hie-ghc-mod.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

library
exposed-modules: Haskell.Ide.GhcModPlugin
build-depends: base >= 4.7 && < 5
Expand All @@ -27,4 +31,6 @@ library
, vinyl >= 0.5 && < 0.6

ghc-options: -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010
7 changes: 3 additions & 4 deletions hie-hare/Haskell/Ide/HaRePlugin.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}

{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -143,10 +145,7 @@ makeRefactorResult changedFiles = do
diffOne f1 = do
let (baseFileName,ext) = splitExtension f1
f2 = (baseFileName ++ ".refactored" ++ ext)
(HieDiff f s d) <- diffFiles f1 f2
f' <- liftIO $ makeRelativeToCurrentDirectory f
s' <- liftIO $ makeRelativeToCurrentDirectory s
return (HieDiff f s d)
diffFiles f1 f2
diffs <- mapM diffOne changedFiles
return (RefactorResult diffs)

Expand Down
6 changes: 6 additions & 0 deletions hie-hare/hie-hare.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

library
exposed-modules: Haskell.Ide.HaRePlugin
build-depends: base >= 4.7 && < 5
Expand All @@ -27,4 +31,6 @@ library
, transformers
, vinyl >= 0.5 && < 0.6
ghc-options: -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010
6 changes: 6 additions & 0 deletions hie-ide-backend/hie-ide-backend.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

flag pedantic
Description: Enable -Werror
Default: False

library
exposed-modules: Haskell.Ide.IdeBackend
build-depends: aeson
Expand All @@ -28,4 +32,6 @@ library
, transformers
, vinyl
ghc-options: -Wall
if flag(pedantic)
ghc-options: -Werror
default-language: Haskell2010
7 changes: 0 additions & 7 deletions hie-plugin-api/Haskell/Ide/Engine/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@

module Haskell.Ide.Engine.Monad where

import Control.Concurrent
import Control.Concurrent.MVar
import Control.Exception
import Control.Monad.IO.Class
import Control.Monad.State.Strict
import Data.Char
import Haskell.Ide.Engine.PluginDescriptor
import qualified Language.Haskell.GhcMod.Monad as GM
import qualified Language.Haskell.GhcMod.Types as GM
import qualified Language.Haskell.GhcMod.Utils as GM
import qualified Language.Haskell.GhcMod.Debug as GM
import System.Directory
import System.IO.Unsafe
-- ---------------------------------------------------------------------

runIdeM :: IdeState -> IdeM a -> IO a
Expand Down
Loading