Add constructors for Date / Time components using type-level integers
Dieses Issue hat noch niemand übernommen.
- #97 von @JordanMartinez — ohne Merge geschlossen
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 15/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Bereich
- backend
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- PureScript
- Sterne
- 51
- Forks
- 48
- Ø Merge
- 2 T. 23 Std.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus purescript/purescript-datetime
-
Week number of the YearOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 25/100
purescript/purescript-datetime#102 · 5 Kommentare ·
-
type: documentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
purescript/purescript-datetime#92 · 1 Kommentar ·
-
status: needs more info
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
purescript/purescript-datetime#90 · 3 Reaktionen ·
-
Addjust by Month, YearOffenstatus: needs more info
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
-
type: enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 24/100
purescript/purescript-datetime#79 · 6 Kommentare · 1 Reaktion ·
Alle Issues in purescript/purescript-datetime
Ähnliche Issues
-
ManageSieve proxy: a backend's NO/BYE greeting is skipped as a capability line and reported as EOFOffenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Mend: dependency security vulnerability
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
ManageIQ/manageiq-pods#1476 ·
Maintainer antworten meist innerhalb von 1 Tag
-
mcp: typed tool handlers lose wrapped JSON-RPC errorsEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
modelcontextprotocol/go-sdk#1529 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
FinanceFlash/unvibecode#818 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100