Add constructors for Date / Time components using type-level integers
まだ誰も着手していません。
- #97 @JordanMartinez による — マージされずにクローズ
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 15/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 領域
- backend
調査の方向性
Start with the proposed type-level constructors in the issue and the exactDate API; the issue identifies type-level leap-year validation and a Prim.Int (class Mod) as prerequisites. Read the discussion and linked pull request #97 to see what was attempted. Done means providing a DateTime constructor that validates the day for its month and year at the type level.
索引モデルが issue の本文から書いたものです。
説明
With the advent of 0.15.0 and type-level integers, we can now define Date and Time components without using unsafePartial:
hour
:: forall i
. Reflectable i Int
=> PI.Compare i (-1) PO.GT
=> PI.Compare i 24 PO.LT
=> Proxy i
-> Hour
hour p = Hour $ reflectType p
minute
:: forall i
. Reflectable i Int
=> PI.Compare i (-1) PO.GT
=> PI.Compare i 60 PO.LT
=> Proxy i
-> Minute
minute p = Minute $ reflectType p
second
:: forall i
. Reflectable i Int
=> PI.Compare i (-1) PO.GT
=> PI.Compare i 60 PO.LT
=> Proxy i
-> Second
second p = Second $ reflectType p
millisecond
:: forall i
. Reflectable i Int
=> PI.Compare i (-1) PO.GT
=> PI.Compare i 1_000 PO.LT
=> Proxy i
-> Millisecond
millisecond p = Millisecond $ reflectType p
year
:: forall i
. Reflectable i Int
=> PI.Compare i (-271821) PO.GT
=> PI.Compare i 275760 PO.LT
=> Proxy i
-> Year
year p = Year $ reflectType p
month
:: forall i
. Reflectable i Int
=> PI.Compare i 0 PO.GT
=> PI.Compare i 13 PO.LT
=> Proxy i
-> Month
month p = unsafePartial $ fromJust $ toEnum $ reflectType p
day
:: forall i
. Reflectable i Int
=> PI.Compare i 0 PO.GT
=> PI.Compare i 32 PO.LT
=> Proxy i
-> Day
day p = Day $ reflectType p
I would like to add a similar constructor for DateTime based on exactDate, but that requires verifying at the type-level that the day is within the bounds for the month-year combination. If we wanted to lift the isLeapYear function to the type-level, it seems we'll need a Prim.Int (class Mod) type class.
- 主要言語
- PureScript
- スター
- 51
- フォーク
- 48
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
purescript/purescript-datetime のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
purescript/purescript-datetime#102 · コメント 5 件 ·
-
type: documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
purescript/purescript-datetime#92 · コメント 1 件 ·
-
status: needs more info
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
purescript/purescript-datetime#90 · リアクション 3 件 ·
-
status: needs more info
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
-
type: enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 24/100
purescript/purescript-datetime#79 · コメント 6 件 · リアクション 1 件 ·
purescript/purescript-datetime の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
milind-soni/OpenMausBot#5829 ·
メンテナーはふだん 1 日以内に返信