@@ -46,9 +46,12 @@ module Main (main) where
4646-- guest language as such.
4747
4848#if __GLASGOW_HASKELL__ >= 906
49- import Numeric
5049import Control.Monad
5150#endif
51+ import qualified Data.Time.Format.ISO8601 as Time
52+ import qualified Data.Time as Time
53+ import Data.Time (Day )
54+ import Numeric
5255import Control.Exception (evaluate )
5356import qualified Control.Concurrent as Concurrent
5457import Control.Monad.Reader
@@ -666,6 +669,7 @@ tc (UForall _ forallLoc _ _ fall _ _ reps0) _env = go reps0 fall
666669 if
667670 | Just Type. HRefl <- Type. eqTypeRep rep (typeRep @ Int ) -> go reps (f rep)
668671 | Just Type. HRefl <- Type. eqTypeRep rep (typeRep @ Integer ) -> go reps (f rep)
672+ | Just Type. HRefl <- Type. eqTypeRep rep (typeRep @ Day ) -> go reps (f rep)
669673 | Just Type. HRefl <- Type. eqTypeRep rep (typeRep @ Double ) -> go reps (f rep)
670674 | Just Type. HRefl <- Type. eqTypeRep rep (typeRep @ Bool ) -> go reps (f rep)
671675 | Just Type. HRefl <- Type. eqTypeRep rep (typeRep @ Char ) -> go reps (f rep)
@@ -1259,6 +1263,7 @@ supportedTypeConstructors =
12591263 (" Value" , SomeTypeRep $ typeRep @ Value ),
12601264 (" ()" , SomeTypeRep $ typeRep @ () ),
12611265 (" Handle" , SomeTypeRep $ typeRep @ IO. Handle ),
1266+ (" Day" , SomeTypeRep $ typeRep @ Day ),
12621267
12631268 -- Internal, hidden types
12641269 (" hell:Hell.NilL" , SomeTypeRep $ typeRep @ ('NilL)),
@@ -1291,6 +1296,14 @@ supportedLits =
12911296 lit' " Text.readProcessStdout_" t_readProcessStdout_,
12921297 lit' " Text.getContents" (fmap Text. decodeUtf8 ByteString. getContents ),
12931298 lit' " Text.setStdin" t_setStdin,
1299+
1300+ -- Dates
1301+ lit' " Day.fromGregorianValid" Time. fromGregorianValid,
1302+ lit' " Day.addDays" Time. addDays,
1303+ lit' " Day.diffDays" Time. diffDays,
1304+ lit' " Day.iso8601Show" (Text. pack . Time. iso8601Show :: Day -> Text ),
1305+ lit' " Day.iso8601ParseM" (Time. iso8601ParseM . Text. unpack :: Text -> Maybe Day ),
1306+
12941307 -- Text operations
12951308 lit' " Text.decodeUtf8" Text. decodeUtf8,
12961309 lit' " Text.encodeUtf8" Text. encodeUtf8,
0 commit comments