Skip to content

Commit

Permalink
Add strictness annotation in inits
Browse files Browse the repository at this point in the history
(The Core was already good but, just to be safe.)
  • Loading branch information
Lysxia committed Mar 14, 2024
1 parent d3c20b2 commit 6dd5613
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Data/Text/Lazy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1448,9 +1448,9 @@ initsNE ts0 = Empty NE.:| inits' 0 ts0
inits' :: Int64 -- Number of previous chunks i
-> Text -- The remainder after dropping i chunks from ts0
-> [Text] -- Prefixes longer than the first i chunks of ts0.
inits' _ Empty = []
inits' i (Chunk t ts) = L.map (takeChunks i ts0) (NE.tail (T.initsNE t))
++ inits' (i + 1) ts
inits' !i (Chunk t ts) = L.map (takeChunks i ts0) (NE.tail (T.initsNE t))
++ inits' (i + 1) ts
inits' _ Empty = []

takeChunks :: Int64 -> Text -> T.Text -> Text
takeChunks !i (Chunk t ts) lastChunk | i > 0 = Chunk t (takeChunks (i - 1) ts lastChunk)
Expand Down

0 comments on commit 6dd5613

Please sign in to comment.