Add constructors for Date / Time components using type-level integers
Ninguém assumiu esta issue ainda.
- #97 de @JordanMartinez — fechado sem integrar
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 15/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Domínio
- backend
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- PureScript
- Estrelas
- 51
- Forks
- 48
- Merge médio
- 2d 23h
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de purescript/purescript-datetime
-
Week number of the YearAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 25/100
purescript/purescript-datetime#102 · 5 comentários ·
-
type: documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
purescript/purescript-datetime#92 · 1 comentário ·
-
status: needs more info
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
purescript/purescript-datetime#90 · 3 reações ·
-
Addjust by Month, YearAbertastatus: needs more info
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 20/100
-
type: enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 24/100
purescript/purescript-datetime#79 · 6 comentários · 1 reação ·
Todas as issues de purescript/purescript-datetime
Issues semelhantes
-
ManageSieve proxy: a backend's NO/BYE greeting is skipped as a capability line and reported as EOFAbertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Mend: dependency security vulnerability
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
ManageIQ/manageiq-pods#1476 ·
Mantenedores costumam responder em até 1 dia
-
mcp: typed tool handlers lose wrapped JSON-RPC errorsTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
modelcontextprotocol/go-sdk#1529 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
FinanceFlash/unvibecode#818 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100