File tree 3 files changed +12
-7
lines changed
src/GHC/TypeLits/Normalise 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -507,8 +507,9 @@ simplifyNats opts@Opts {..} leqT eqsG eqsW = do
507
507
x' = substsSOP subst x
508
508
y' = substsSOP subst y
509
509
uS = (x',y',b)
510
- leqsG' | isGiven (ctEvidence ct) = (x',y',b): leqsG
511
- | otherwise = leqsG
510
+ isG = isGiven (ctEvidence ct)
511
+ leqsG' | isG = (x',y',b): leqsG
512
+ | otherwise = leqsG
512
513
ineqs = concat [ leqsG
513
514
, map (substLeq subst) leqsG
514
515
, map snd (rights (map fst eqsG))
@@ -519,7 +520,7 @@ simplifyNats opts@Opts {..} leqT eqsG eqsW = do
519
520
evs' <- maybe evs (: evs) <$> evMagic ct knW (subToPred opts leqT k)
520
521
simples subst evs' leqsG' xs eqs'
521
522
522
- Just (False ,_) | null k -> return (Impossible (fst eq))
523
+ Just (False ,_) | null k && not isG -> return (Impossible (fst eq))
523
524
_ -> do
524
525
let solvedIneq = mapMaybe runWriterT
525
526
-- it is an inequality that can be instantly solved, such as
Original file line number Diff line number Diff line change @@ -568,8 +568,8 @@ unifiers' ct (S ((P [I i]):ps1)) (S ((P [I j]):ps2))
568
568
unifiers' ct s1@ (S ps1) s2@ (S ps2) = case sopToIneq k1 of
569
569
Just (s1',s2',_)
570
570
| s1' /= s1 || s2' /= s1
571
- , maybe False (uncurry (&&) . second Set. null ) (runWriterT (isNatural s1'))
572
- , maybe False (uncurry (&&) . second Set. null ) (runWriterT (isNatural s2'))
571
+ , maybe True (uncurry (&&) . second Set. null ) (runWriterT (isNatural s1'))
572
+ , maybe True (uncurry (&&) . second Set. null ) (runWriterT (isNatural s2'))
573
573
-> unifiers' ct s1' s2'
574
574
_ | null psx
575
575
, length ps1 == length ps2
@@ -655,7 +655,7 @@ isNatural (S []) = return True
655
655
isNatural (S [P [] ]) = return True
656
656
isNatural (S [P (I i: ps)])
657
657
| i >= 0 = isNatural (S [P ps])
658
- | otherwise = WriterT Nothing
658
+ | otherwise = return False
659
659
-- If i is not a natural number then their sum *might* be natural,
660
660
-- but we simply can't be sure since ps might be zero
661
661
isNatural (S [P (V _: ps)]) = isNatural (S [P ps])
Original file line number Diff line number Diff line change @@ -509,8 +509,12 @@ oneLtPowSubst = go
509
509
go = id
510
510
511
511
givenLEZeroNotImpossible :: forall (a :: Nat ) . Proxy a -> a <= 0 => ()
512
- givenLEZeroNotImpossible _ = go (Proxy @ ( a + a - a ) )
512
+ givenLEZeroNotImpossible p = go (go2 p )
513
513
where
514
+ -- Ensure the plugin is called
515
+ go2 :: Proxy (b + 0 ) -> Proxy b
516
+ go2 p = p
517
+
514
518
go :: Proxy b -> b <= 0 => ()
515
519
go _ = ()
516
520
You can’t perform that action at this time.
0 commit comments