We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 402fedc commit e615993Copy full SHA for e615993
dhall/src/Dhall/Eval.hs
@@ -529,11 +529,10 @@ eval !env t0 =
529
-- https://github.com/ghcjs/ghcjs/issues/782
530
go zero (fromIntegral n' :: Integer) where
531
go !acc 0 = acc
532
- go (VNaturalLit x) m =
533
- case vApp succ (VNaturalLit x) of
534
- VNaturalLit y | x == y -> VNaturalLit x
535
- notNaturalLit -> go notNaturalLit (m - 1)
536
- go acc m = go (vApp succ acc) (m - 1)
+ go acc m =
+ -- Detect a shortcut: if succ acc == acc then return acc immediately.
+ let next = vApp succ acc
+ in if conv env next acc then acc else go next (m - 1)
537
_ -> inert
538
NaturalBuild ->
539
VPrim $ \case
0 commit comments