You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constructing some wrong Dates I have managed to reach a segmentation fault error. While I guess building correct dates is a user duty, it seems to me a bit too much to have segmentation fault for these cases.
Attached an example to reproduce.
importChronosimportData.Int
validDate =Date
(Year2025)
(Month0) -- valid month January
(DayOfMonth10)
validDay = dateToDay validDate
-- λ> validDay-- Day {getDay = 60685}
brokenDate =Date
(Year2025)
(Month (-1)) -- clearly not a valid month
(DayOfMonth10)
bangDay = dateToDay brokenDate
-- λ> bangDay-- Day {getDay = Segmentation fault (core dumped)
alsoBrokenDate =Date
(Year2025)
(Month13) -- also clearly not a valid month
(DayOfMonth10)
alsoBangDay = dateToDay alsoBrokenDate
-- λ> alsoBangDay-- Day {getDay = Segmentation fault (core dumped)
brokenButNotQuiteDate =Date
(Year2025)
(Month12) -- not a valid month 0..11
(DayOfMonth10)
notBangButShoudlBangDay = dateToDay brokenButNotQuiteDate
-- λ> notBangButShoudlBangDay-- Day {getDay = 61040}
what = (dayToDate . dateToDay) brokenButNotQuiteDate
-- λ> what-- Date { dateYear = Year {getYear = 2025}-- , dateMonth = Month {getMonth = 11}-- , dateDay = DayOfMonth {getDayOfMonth = 31}-- }
As s bonus the roundtrip for Dates on the thirteenth month just does not make sense.
The text was updated successfully, but these errors were encountered:
Constructing some wrong
Date
s I have managed to reach a segmentation fault error. While I guess building correct dates is a user duty, it seems to me a bit too much to have segmentation fault for these cases.Attached an example to reproduce.
As s bonus the roundtrip for
Date
s on the thirteenth month just does not make sense.The text was updated successfully, but these errors were encountered: