Skip to content

Commit 750dac3

Browse files
authored
Eta-expand Builder.Internal.empty (#616)
See discussion at https://gitlab.haskell.org/ghc/ghc/-/issues/23822
1 parent 2e2e5ca commit 750dac3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Data/ByteString/Builder/Internal.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,14 @@ runBuilderWith (Builder b) = b
368368
-- only exported for use in rewriting rules. Use 'mempty' otherwise.
369369
{-# INLINE[1] empty #-}
370370
empty :: Builder
371-
empty = Builder ($)
371+
empty = Builder (\k br -> k br)
372372
-- This eta expansion (hopefully) allows GHC to worker-wrapper the
373373
-- 'BufferRange' in the 'empty' base case of loops (since
374374
-- worker-wrapper requires (TODO: verify this) that all paths match
375375
-- against the wrapped argument.
376+
--
377+
-- Do not use ($), which has arity 1 since base-4.19.
378+
-- See also https://gitlab.haskell.org/ghc/ghc/-/issues/23822
376379

377380
-- | Concatenate two 'Builder's. This function is only exported for use in rewriting
378381
-- rules. Use 'mappend' otherwise.

0 commit comments

Comments
 (0)