Open s-zeng opened 3 months ago
You may have a look at https://github.com/kukimik/dhall-date-format as a possible workaround.
Wow, did not realize this was doable in pure Dhall. Their parse
function was exactly what I was looking for
Thanks!
Upon further inspections, that package (and Dhall in general) can only extract text components from a date. It would be nice to get integer components
Upon further inspections, that package (and Dhall in general) can only extract text components from a date.
Yeah, that's why I called it a workaround. I thought it might be sufficient for your use case.
The proposed Date -> Natural
functions should be easy to include in the standard and implement. And they would allow to create some utilities (e.g. for date comparison) at the library level.
On the other hand, I'm not sure whether the ability to inspect Date
values could lead to some bad programming practices. As far as I understand this is the main reason for keeping Text
opaque.
Yeah, I'd support adding functions like these to the standard. I'd also support the same thing for Time/{hour,minute,second}
I can help with the Haskell implementation if somebody (@s-zeng ?) does the standardization work. It's rather easy, but somewhat tedious. Here are some recent examples to follow: https://github.com/dhall-lang/dhall-lang/commit/74233ca6af7485877c6c4fd230ba2dc897730b47, https://github.com/dhall-lang/dhall-lang/pull/1351.
Hello, is it possible to have
Date/year, Date/month, Date/date: Date -> Natural
functions added to the standard? Usecase: well-typed way to have templated directories in the format.../YYYY/MM/DD/...