Skip to content

Conversation

@Bodigrim
Copy link
Contributor

Fixes #668, and also makes another step towards #513.

@Bodigrim Bodigrim requested a review from Lysxia October 24, 2025 22:27
src/Data/Text.hs Outdated
where g a b = safe (f a b)
scanl f c0 = go
where
go (Text src o l) = runST $ do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not inline go, since it is used only once?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is a modified copy of mapAccumL below: I think the idea is to allow it to inline even if only two arguments are supplied.

I doubt anyone has meaningful applications for scan* or mapAccumL. How about we inline the worker function and scrap INLINE in all four functions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

…apAccumR

It's unlikely that anyone has any application for these functions,
let alone a performance-critical application, so let's reduce
code bloat and make implementation a tiny bit more straightforward.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scanl / scanr do not replace invalid Char when passed as an initial value of accumulator

2 participants