This Idris code demonstrates working with time and durations. Here’s an explanation of the key differences and adaptations:
Idris uses Data.Time, Data.Time.Clock, and Data.Time.Calendar modules for time-related operations.
Instead of time.Now(), we use getCurrentTime.
To create a specific time, we use UTCTime constructor with fromGregorian for the date and TimeOfDay for the time.
Extracting components of time is done using various functions like utctYear, utctMonth, etc.
Day of the week is obtained using dayOfWeek function.
Time comparisons are done using standard comparison operators (<, >, ==).
diffUTCTime is used to get the time difference, which returns a NominalDiffTime.
Duration calculations are done using functions like nominalDiffTimeToSeconds, nominalDiffTimeToMinutes, etc.
addUTCTime is used to add or subtract durations from a time.
Note that Idris’s time handling is somewhat different from Go’s, but this code achieves similar functionality. The exact output may differ due to the different representations of time and duration in Idris.