Skip to content

Commit 1a52e9a

Browse files
committed
Fix rule replicate/singleton
it was matching on `singleton`, but `singleton` gets rewritten to `s.singleton`. An additional rule makes this robust.
1 parent 92768ec commit 1a52e9a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Data/Text/Lazy.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,8 @@ replicateChar n c = unstream (S.replicateCharI n (safe c))
10331033
{-# RULES
10341034
"LAZY TEXT replicate/singleton -> replicateChar" [~1] forall n c.
10351035
replicate n (singleton c) = replicateChar n c
1036+
"LAZY TEXT replicate/unstream/singleton -> replicateChar" [~1] forall n c.
1037+
replicate n (unstream (S.singleton c)) = replicateChar n c
10361038
#-}
10371039

10381040
-- | /O(n)/, where @n@ is the length of the result. The 'unfoldr'

0 commit comments

Comments
 (0)