Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit 3a064ee

Browse files
committed
Remove DelayedActionExtra
1 parent 06c66d3 commit 3a064ee

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

bench/lib/Experiments.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ runBenchmarks allBenchmarks = do
280280
unwords $
281281
[ ghcide ?config,
282282
"--lsp",
283+
"--test",
284+
"--verbose",
283285
"--cwd",
284286
dir,
285287
"+RTS",

src/Development/IDE/Core/Rules.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ import System.Directory ( getModificationTime )
8484
import Control.Exception
8585

8686
import Control.Monad.State
87-
import System.IO.Error (isDoesNotExistError)
88-
import Control.Exception.Safe (IOException, catch)
8987
import FastString (FastString(uniq))
9088
import qualified HeaderInfo as Hdr
9189

src/Development/IDE/Core/Shake.hs

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -498,35 +498,18 @@ withMVar' var unmasked masked = mask $ \restore -> do
498498
pure c
499499

500500

501-
-- | Actions with an ID for tracing purposes
502-
data DelayedActionExtra
503-
= DelayedActionExtra
504-
{ _actionInternalId :: Unique
505-
, _actionInternal :: Action ()
506-
}
507-
508-
type DelayedAction a = DelayedActionX (Action a)
509-
type DelayedActionInternal = DelayedActionX DelayedActionExtra
510-
511-
{-# COMPLETE DelayedActionInternal#-}
512-
pattern DelayedActionInternal :: String -> Logger.Priority -> Action () -> Unique -> DelayedActionX DelayedActionExtra
513-
pattern DelayedActionInternal { _actionInternalName, _actionInternalPriority, getAction , _actionId}
514-
= DelayedActionX _actionInternalName _actionInternalPriority (DelayedActionExtra _actionId getAction)
515-
516-
{-# COMPLETE DelayedAction#-}
517-
pattern DelayedAction :: String -> Logger.Priority -> Action a -> DelayedAction a
518-
pattern DelayedAction a b c = DelayedActionX a b c
519-
520501
mkDelayedAction :: String -> Logger.Priority -> Action a -> DelayedAction a
521502
mkDelayedAction = DelayedAction
522503

523-
data DelayedActionX a = DelayedActionX
504+
data DelayedAction a = DelayedAction
524505
{ actionName :: String -- ^ Name we show to the user
525506
, actionPriority :: Logger.Priority -- ^ Priority with which to log the action
526-
, _actionExtra :: a -- ^ The payload
507+
, getAction :: Action a -- ^ The payload
527508
}
528509

529-
instance Show (DelayedActionX a) where
510+
type DelayedActionInternal = DelayedAction ()
511+
512+
instance Show (DelayedAction a) where
530513
show d = "DelayedAction: " ++ actionName d
531514

532515
-- | These actions are run asynchronously after the current action is
@@ -640,7 +623,6 @@ newSession ShakeExtras{..} shakeDb systemActs userActs = do
640623
instantiateDelayedAction :: DelayedAction a -> IO (Barrier (Either SomeException a), DelayedActionInternal)
641624
instantiateDelayedAction (DelayedAction s p a) = do
642625
b <- newBarrier
643-
i <- newUnique
644626
let a' = do
645627
-- work gets reenqueued when the Shake session is restarted
646628
-- it can happen that a work item finished just as it was reenqueud
@@ -649,7 +631,7 @@ instantiateDelayedAction (DelayedAction s p a) = do
649631
unless alreadyDone $ do
650632
x <- actionCatch @SomeException (Right <$> a) (pure . Left)
651633
liftIO $ signalBarrier b x
652-
let d = DelayedActionInternal s p a' i
634+
let d = DelayedAction s p a'
653635
return (b, d)
654636

655637
logDelayedAction :: Logger -> DelayedActionInternal -> Action ()

0 commit comments

Comments
 (0)