Skip to content

Commit 69105c5

Browse files
committed
-Wall clean
1 parent e169a0d commit 69105c5

File tree

5 files changed

+21
-40
lines changed

5 files changed

+21
-40
lines changed

dap.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ library
4343
unordered-containers >= 0.2.19 && < 0.3,
4444
stm >= 2.5.0 && < 2.6,
4545
transformers-base >= 0.4.6 && < 0.5
46+
ghc-options:
47+
-Wall
4648
hs-source-dirs:
4749
src
4850
default-language:

src/DAP/Adaptor.hs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,17 @@ module DAP.Adaptor
5252
, runAdaptorWith
5353
) where
5454
----------------------------------------------------------------------------
55-
import Control.Concurrent ( ThreadId )
56-
import Control.Concurrent.MVar ( newMVar, newEmptyMVar, modifyMVar_
57-
, takeMVar, putMVar, readMVar, MVar )
55+
import Control.Concurrent.MVar ( modifyMVar_, MVar )
5856
import Control.Concurrent.Lifted ( fork, killThread )
59-
import qualified Control.Concurrent.MVar as MVar
6057
import Control.Exception ( throwIO )
6158
import Control.Concurrent.STM ( atomically, readTVarIO, modifyTVar' )
6259
import Control.Monad ( when, unless )
6360
import Control.Monad.Except ( runExceptT, throwError )
64-
import Control.Monad.State ( evalStateT, runStateT, execStateT, gets
65-
, MonadIO(liftIO), gets, modify', put )
61+
import Control.Monad.State ( runStateT, gets, MonadIO(liftIO), gets, modify' )
6662
import Data.Aeson ( FromJSON, Result (..), fromJSON )
67-
import Data.Maybe ( fromMaybe )
6863
import Data.Aeson.Encode.Pretty ( encodePretty )
6964
import Data.Aeson.Types ( object, Key, KeyValue((.=)), ToJSON )
70-
import qualified Data.IntMap.Strict as I
71-
import Data.IntMap.Strict (IntMap)
72-
import qualified Data.IntSet as IntSet
73-
import Data.IntSet (IntSet)
74-
import Data.Text ( unpack, Text, pack )
65+
import Data.Text ( unpack, pack )
7566
import Network.Socket ( SockAddr )
7667
import System.IO ( Handle )
7768
import qualified Data.ByteString.Lazy.Char8 as BL8
@@ -82,10 +73,6 @@ import DAP.Types
8273
import DAP.Utils
8374
import DAP.Internal
8475
----------------------------------------------------------------------------
85-
-- | Meant for internal consumption
86-
logDebug :: DebugStatus -> BL8.ByteString -> Adaptor app ()
87-
logDebug d = logWithAddr DEBUG (Just d)
88-
----------------------------------------------------------------------------
8976
logWarn :: BL8.ByteString -> Adaptor app ()
9077
logWarn msg = logWithAddr WARN Nothing (withBraces msg)
9178
----------------------------------------------------------------------------
@@ -204,7 +191,7 @@ getDebugSessionWithThreadIdAndSessionId = do
204191
appStore <- liftIO . readTVarIO =<< getAppStore
205192
case H.lookup sessionId appStore of
206193
Nothing -> do
207-
sendError (ErrorMessage (pack "")) Nothing
194+
appNotFound sessionId
208195
Just (tid, app) ->
209196
pure (sessionId, tid, app)
210197
where
@@ -220,7 +207,7 @@ getDebugSessionWithThreadIdAndSessionId = do
220207
----------------------------------------------------------------------------
221208
destroyDebugSession :: Adaptor app ()
222209
destroyDebugSession = do
223-
(sessionId, DebuggerThreadState {..}, app) <- getDebugSessionWithThreadIdAndSessionId
210+
(sessionId, DebuggerThreadState {..}, _) <- getDebugSessionWithThreadIdAndSessionId
224211
store <- getAppStore
225212
liftIO $ do
226213
killThread debuggerThread
@@ -286,7 +273,7 @@ writeToHandle
286273
-> Handle
287274
-> event
288275
-> Adaptor app ()
289-
writeToHandle addr handle evt = do
276+
writeToHandle _ handle evt = do
290277
let msg = encodeBaseProtocolMessage evt
291278
debugMessage ("\n" <> encodePretty evt)
292279
withConnectionLock (BS.hPutStr handle msg)

src/DAP/Server.hs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,22 @@ module DAP.Server
2323
----------------------------------------------------------------------------
2424
import Control.Concurrent.MVar ( MVar )
2525
import Control.Monad ( when )
26-
import Control.Monad.Except ( runExceptT )
2726
import Control.Concurrent.MVar ( newMVar, newEmptyMVar, modifyMVar_
28-
, takeMVar, putMVar, readMVar )
27+
, putMVar, readMVar )
2928
import Control.Concurrent.STM ( newTVarIO )
3029
import Control.Exception ( SomeException
3130
, IOException
3231
, catch
3332
, fromException
3433
, throwIO )
35-
import Control.Monad ( forever, void )
36-
import Control.Monad.State ( evalStateT, runStateT, execStateT, gets )
37-
import DAP.Internal ( withGlobalLock )
34+
import Control.Monad ( void )
35+
import Control.Monad.State ( gets )
3836
import Data.Aeson ( decodeStrict, eitherDecode, Value, FromJSON )
3937
import Data.Aeson.Encode.Pretty ( encodePretty )
4038
import Data.ByteString ( ByteString )
4139
import Data.Char ( isDigit )
4240
import Network.Simple.TCP ( serve, HostPreference(Host) )
43-
import Network.Socket ( socketToHandle, withSocketsDo, SockAddr, Socket )
41+
import Network.Socket ( socketToHandle, withSocketsDo, SockAddr )
4442
import System.IO ( hClose, hSetNewlineMode, Handle, Newline(CRLF)
4543
, NewlineMode(NewlineMode, outputNL, inputNL)
4644
, IOMode(ReadWriteMode) )

src/DAP/Types.hs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ module DAP.Types
9696
-- * Client
9797
, Adaptor (..)
9898
, AdaptorState (..)
99-
, AppStore (..)
99+
, AppStore
100100
-- * Errors
101101
, AdaptorException (..)
102102
, ErrorMessage (..)
@@ -201,26 +201,21 @@ module DAP.Types
201201
, DebuggerThreadState (..)
202202
) where
203203
----------------------------------------------------------------------------
204-
import Data.Word ( Word32 )
205-
import Data.IntMap.Strict ( IntMap )
206-
import qualified Data.IntMap.Strict as I
207204
import Control.Monad.Base ( MonadBase )
208205
import Control.Monad.Except ( MonadError, ExceptT )
209206
import Control.Monad.Trans.Control ( MonadBaseControl )
210207
import Control.Concurrent ( ThreadId )
211208
import Control.Concurrent.MVar ( MVar )
212209
import Control.Applicative ( (<|>) )
213210
import Data.Typeable ( typeRep )
214-
import Control.Concurrent.STM ( TVar, newTVarIO )
211+
import Control.Concurrent.STM ( TVar )
215212
import Control.Exception ( Exception )
216213
import Control.Monad.State ( StateT, MonadState, MonadIO )
217214
import Data.Aeson ( (.:), (.:?), withObject, withText, object
218-
, FromJSON(parseJSON), Value(Null), KeyValue((.=))
219-
, ToJSON(toJSON), fieldLabelModifier
220-
, genericParseJSON, genericToJSON, defaultOptions
215+
, FromJSON(parseJSON), Value, KeyValue((.=))
216+
, ToJSON(toJSON), genericParseJSON, defaultOptions
221217
)
222218
import Data.Aeson.Types ( Pair, typeMismatch )
223-
import Data.IORef ( IORef )
224219
import Data.Proxy ( Proxy(Proxy) )
225220
import Data.String ( IsString(..) )
226221
import Data.Time ( UTCTime )
@@ -231,10 +226,8 @@ import Text.Read ( readMaybe )
231226
import Data.Text (Text)
232227
import qualified Data.Text as T ( pack, unpack )
233228
import qualified Data.HashMap.Strict as H
234-
import GHC.TypeLits (TypeError)
235-
import qualified GHC.TypeLits as TypeLits
236229
----------------------------------------------------------------------------
237-
import DAP.Utils ( capitalize, toLowerCase, modifier, getName, genericParseJSONWithModifier, genericToJSONWithModifier )
230+
import DAP.Utils ( capitalize, getName, genericParseJSONWithModifier, genericToJSONWithModifier )
238231
----------------------------------------------------------------------------
239232
-- | Core type for Debug Adaptor to send and receive messages in a type safe way.
240233
-- the state is 'AdaptorState' which holds configuration information, along with

src/DAP/Utils.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
module DAP.Utils where
1919
----------------------------------------------------------------------------
2020
import GHC.Generics (Generic, Rep)
21-
import Data.Aeson ( ToJSON(toJSON), Value, fieldLabelModifier
21+
import Data.Aeson ( ToJSON, Value, fieldLabelModifier
2222
, genericToJSON, genericParseJSON, fieldLabelModifier
23-
, defaultOptions, GToJSON, GFromJSON, Zero, Options
24-
, constructorTagModifier, sumEncoding, SumEncoding(UntaggedValue), omitNothingFields
23+
, defaultOptions, GToJSON, GFromJSON, Zero
24+
, constructorTagModifier, sumEncoding
25+
, SumEncoding(UntaggedValue), omitNothingFields
2526
)
2627
import Data.Aeson.Types ( Parser )
2728
import Data.Aeson.Encode.Pretty ( encodePretty )

0 commit comments

Comments
 (0)