@@ -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 )
5856import Control.Concurrent.Lifted ( fork , killThread )
59- import qualified Control.Concurrent.MVar as MVar
6057import Control.Exception ( throwIO )
6158import Control.Concurrent.STM ( atomically , readTVarIO , modifyTVar' )
6259import Control.Monad ( when , unless )
6360import 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' )
6662import Data.Aeson ( FromJSON , Result (.. ), fromJSON )
67- import Data.Maybe ( fromMaybe )
6863import Data.Aeson.Encode.Pretty ( encodePretty )
6964import 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 )
7566import Network.Socket ( SockAddr )
7667import System.IO ( Handle )
7768import qualified Data.ByteString.Lazy.Char8 as BL8
@@ -82,10 +73,6 @@ import DAP.Types
8273import DAP.Utils
8374import DAP.Internal
8475----------------------------------------------------------------------------
85- -- | Meant for internal consumption
86- logDebug :: DebugStatus -> BL8. ByteString -> Adaptor app ()
87- logDebug d = logWithAddr DEBUG (Just d)
88- ----------------------------------------------------------------------------
8976logWarn :: BL8. ByteString -> Adaptor app ()
9077logWarn 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----------------------------------------------------------------------------
221208destroyDebugSession :: Adaptor app ()
222209destroyDebugSession = 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)
0 commit comments