Add a function to split text at the first occurrence of a character

オープン
#625 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
haskell
領域
backend

調査の方向性

まず、既存の breakOn、drop、singleton のエントリポイントと、関連するテキスト分割操作がどのように公開されているかを読みます。提案されている split1 の動作を、類似する byteslice 関数と比較し、選択した API が要求された最初の一致を処理し、一致した部分を破棄することを確認します。

索引モデルが issue の本文から書いたものです。

説明

I was surprised not to find a function in the library to split a text on the first match of a character/text/predicate, with the matched part discarded.
This is not difficult to write using breakOn and drop, but I think a function implemented with the internals of the library might have better performance.

split1 :: Char -> Text -> (Text, Text)
split1 c = (id *** drop 1) . (breakOn $ singleton c)

See a similar function (previously called splitOnce) in the byteslice package, and a question on Stack Overflow about splitAtfirst.

主要言語
Haskell
スター
424
フォーク
167
平均マージ
1日 21時間
マージ済み PR(30日)
6

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

haskell/text のほかの issue

haskell/text の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。