on master help sign in
Remove the ShakeValue on A (#587)
commita9bf409f45df3f92483006a2a0d7ab6145ee5326 authorNeil Mitchell <ndmitchell@gmail.com> dateTue 26 May 2020, 11:03 (6 years ago) parent698fe2f
1 file changed+6−8
src/Development/IDE/Core/Shake.hs+6−8
src/Development/IDE/Core/Shake.hs+6−8
@@ -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.
527525uses :: 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.
532530usesWithStale :: IdeRule k v
533531 => k -> [NormalizedFilePath] -> Action [Maybe (v, PositionMapping)]
534532usesWithStale 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