Skip to content

Commit a9bf409

Browse files
authored
Remove the ShakeValue on A (#587)
1 parent 698fe2f commit a9bf409

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Development/IDE/Core/Shake.hs

+6-8
Original file line numberDiff line numberDiff line change
@@ -511,12 +511,10 @@ instance Show k => Show (Q k) where
511511

512512
-- | Invariant: the 'v' must be in normal form (fully evaluated).
513513
-- Otherwise we keep repeatedly 'rnf'ing values taken from the Shake database
514-
-- Note (MK) I am not sure why we need the ShakeValue here, maybe we
515-
-- can just remove it?
516-
data A v = A (Value v) ShakeValue
514+
newtype A v = A (Value v)
517515
deriving Show
518516

519-
instance NFData (A v) where rnf (A v x) = v `seq` rnf x
517+
instance NFData (A v) where rnf (A v) = v `seq` ()
520518

521519
-- In the Shake database we only store one type of key/result pairs,
522520
-- namely Q (question) / A (answer).
@@ -526,13 +524,13 @@ type instance RuleResult (Q k) = A (RuleResult k)
526524
-- | Return up2date results. Stale results will be ignored.
527525
uses :: IdeRule k v
528526
=> k -> [NormalizedFilePath] -> Action [Maybe v]
529-
uses key files = map (\(A value _) -> currentValue value) <$> apply (map (Q . (key,)) files)
527+
uses key files = map (\(A value) -> currentValue value) <$> apply (map (Q . (key,)) files)
530528

531529
-- | Return the last computed result which might be stale.
532530
usesWithStale :: IdeRule k v
533531
=> k -> [NormalizedFilePath] -> Action [Maybe (v, PositionMapping)]
534532
usesWithStale key files = do
535-
values <- map (\(A value _) -> value) <$> apply (map (Q . (key,)) files)
533+
values <- map (\(A value) -> value) <$> apply (map (Q . (key,)) files)
536534
zipWithM lastValue files values
537535

538536

@@ -558,7 +556,7 @@ defineEarlyCutoff op = addBuiltinRule noLint noIdentity $ \(Q (key, file)) (old
558556
case v of
559557
-- No changes in the dependencies and we have
560558
-- an existing result.
561-
Just v -> return $ Just $ RunResult ChangedNothing old $ A v (decodeShakeValue old)
559+
Just v -> return $ Just $ RunResult ChangedNothing old $ A v
562560
_ -> return Nothing
563561
_ -> return Nothing
564562
case val of
@@ -589,7 +587,7 @@ defineEarlyCutoff op = addBuiltinRule noLint noIdentity $ \(Q (key, file)) (old
589587
return $ RunResult
590588
(if eq then ChangedRecomputeSame else ChangedRecomputeDiff)
591589
(encodeShakeValue bs) $
592-
A res bs
590+
A res
593591

594592

595593
-- | Rule type, input file

0 commit comments

Comments
 (0)