Simon Peyton Jones pushed to branch wip/T23109a at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • libraries/ghc-internal/src/GHC/Internal/Base.hs
    ... ... @@ -1809,7 +1809,12 @@ build g = g (:) []
    1809 1809
     
    
    1810 1810
     augment :: forall a. (forall b. (a->b->b) -> b -> b) -> [a] -> [a]
    
    1811 1811
     {-# INLINE [1] augment #-}
    
    1812
    -augment g = g (:)
    
    1812
    +-- Give it one argument so that it inlines with one arg
    
    1813
    +-- But (crucially) the body is a lambda so that `g` is visibly applied
    
    1814
    +-- to two args, and hence we know that in a call
    
    1815
    +--      augment (\c n. blah)
    
    1816
    +-- both c and n are OneShot
    
    1817
    +augment g = \xs -> g (:) xs
    
    1813 1818
     
    
    1814 1819
     {-# RULES
    
    1815 1820
     "fold/build"    forall k z (g::forall b. (a->b->b) -> b -> b) .