Padded decimal and hexadecimal text builders

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
haskell
領域
data

調査の方向性

Data.Text.Lazy.Builder.Int から始めて、既存の 10 進数および 16 進数用のビルダーを読みます。左側のゼロ埋め、負の値、表現より短い幅を含め、例を受け入れ条件として使用します。これらのケースと Integer の特殊化に関する懸念をカバーするテストとともに、2 つのビルダーを追加します。

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

説明

feature request

In Data.Text.Lazy.Builder.Int, the functions decimal and hexadecimal are available. Sometimes, I need to zero pad my decimal and hexadecimal representations to a certain length. I propose adding the following two functions to this module:

paddedDecimal :: Integral a => Int -> a -> Builder
paddedHexadecimal :: Integral a => Int -> a -> Builder

The behaviors of these would be:

  • The padding occurs on the left.
  • The padding adds zeroes until that cause the builder to be of the desired length.
  • The padding happens after the minus sign in the event that the number is negative.

Examples of expected behavior:

> paddedDecimal 3 5
005
> paddedDecimal 6 (-103)
-000103
> paddedDecimal 2 1039
1039
> paddedDecimal (-5) 1
1

If this would be a welcome addition, I am already familiar with the integral text builder code, and I would be happy to add these functions. The only place where I am uncertain of how to proceed would be writing a performant specialization for Integer.

主要言語
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 を短くまとめたダイジェスト。