Strict `Text` wrapper unnecessarily decodes to `Char` for `text-2.*`
还没有人认领这个 Issue。
评估
调研方向
从 data/AlexWrappers.hs 的第 88-90 行和第 98-105 行开始,然后跟踪 alexInputPrevChar 以及 strict Text wrapper 的输入处理。保留 wrapper 的行为,同时移除不必要的 Text-to-Char 解码,包括 issue 中描述的向后字符边界处理。
由索引模型根据 Issue 内容生成。
描述
Looking at the code:
This can be replaced by:
type AlexInput = (Int, -- current offset
Data.Text.Text) -- input string
This can be replaced by:
alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)
alexGetByte (cur, input) = case input of
Text arr off len
| cur < len = Just (unsafeIndex arr (off + curr) (cur + 1, input))
| otherwise = Nothing
The only thing "complicated" is alexInputPrevChar, basically you go back from cur one byte at a time until you have seen two character boundaries and then do a character decode at that position.
- 主要语言
- Haskell
- 星标
- 323
- 派生
- 87
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
haskell/alex 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 30/100
-
难度 5/5 一周以上 新手友好度 25/100
-
re: unicode
难度 5/5 一周以上 新手友好度 25/100
-
discussion
难度 5/5 一周以上 新手友好度 20/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
haskell/bytestring#730 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
seal-harness/seal-harness#399 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
fmidue/codeworld-tasks#124 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
reflex-frp/reflex#563 ·