Skip to content

Conversation

@mpscholten
Copy link
Member

Summary

  • Add actionPrefixText function that uses Text.isPrefixOf and Text.breakOn instead of manual char-by-char pattern matching
  • Add stripActionSuffixText function that uses Text.stripSuffix instead of recursive String traversal
  • Update pathTo to use these Text functions, reducing Text.pack calls in the hot path

The pathTo function is called frequently for URL generation. This change moves more of the computation to use efficient Text operations instead of building Strings and converting at the end.

Test plan

  • Module compiles: echo ':l ihp/IHP/RouterSupport.hs' | ghci
  • All 345 IHP IDE tests pass: echo -e ':l ihp-ide/Test/Main.hs\nmain' | ghci

🤖 Generated with Claude Code

mpscholten and others added 2 commits January 25, 2026 13:41
Add actionPrefixText and stripActionSuffixText functions that use
efficient Text operations (Text.isPrefixOf, Text.stripSuffix, Text.breakOn)
instead of recursive char-by-char String traversal. Update pathTo to use
these Text functions, reducing Text.pack calls in the hot path.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace usages of actionPrefix with Text.encodeUtf8 (actionPrefixText ...)
and delete the old String-based functions that are no longer needed.
Also removes unused Data.Char import.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@mpscholten mpscholten merged commit d78e1a7 into master Jan 25, 2026
1 check passed
@mpscholten mpscholten deleted the refactor/router-string-to-text branch January 25, 2026 16:56
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.

2 participants