···55-- Only return the result computation
66-- if there was at least `i` facts in
77-- the stream.
88-requiring : Aggregate (Definitely Int) -> Aggregate a -> Aggregate (Possibly a)
88+requiring : Aggregate Int -> Aggregate a -> Aggregate (Possibly a)
99requiring i x =
1010- case (fold x = 0 then x + 1 in x) < i of
1010+ case count () < i of
1111 True then
1212 missing
1313 False then
+2-2
icicle-data/src/Icicle/Data/Regex.hs
···215215 c' == c
216216 checkAcceptor c (AcceptRange s fe) =
217217 c >= s && c <= fe
218218- negs neg = if neg then not else id
219219-218218+ negs neg =
219219+ if neg then not else id
220220221221 step s0 c =
222222 let
+13-12
icicle-data/src/Icicle/Data/Time.hs
···11{-# LANGUAGE NoImplicitPrelude #-}
22{-# LANGUAGE OverloadedStrings #-}
33{-# LANGUAGE ViewPatterns #-}
44+{-# LANGUAGE PatternSynonyms #-}
45module Icicle.Data.Time (
56 Date(..)
67 , Time(..)
···168169timeOfDays :: Int -> Time
169170timeOfDays d
170171 = Time
171171- $ flip Thyme.mkUTCTime 0
172172+ $ flip Thyme.UTCTime 0
172173 $ Thyme.ModifiedJulianDay d
173174174175unsafeTimeOfYMD :: Int -> Int -> Int -> Time
175176unsafeTimeOfYMD y m d
176177 = Time
177177- $ flip Thyme.mkUTCTime 0
178178+ $ flip Thyme.UTCTime 0
178179 $ Thyme.fromGregorian y m d
179180180181timeOfYMD :: Int -> Int -> Int -> Maybe Time
181182timeOfYMD y m d
182183 = Time
183183- . flip Thyme.mkUTCTime 0
184184+ . flip Thyme.UTCTime 0
184185 <$> Thyme.fromGregorianValid y m d
185186186187timeOfIvorySeconds :: Int64 -> Time
187188timeOfIvorySeconds seconds =
188188- Time $ Thyme.addUTCTime (fromIntegral seconds) (Thyme.mkUTCTime ivoryEpoch 0)
189189+ Time $ Thyme.addUTCTime (fromIntegral seconds) (Thyme.UTCTime ivoryEpoch 0)
189190190191timeOfYMDHMS :: Int -> Int -> Int -> Int -> Int -> Int -> Time
191192timeOfYMDHMS year month day hour minute sec
···194195 $ Thyme.TimeOfDay hour minute
195196 $ Thyme.secondsToDiffTime
196197 $ fromIntegral sec
197197- in Time $ Thyme.mkUTCTime ymd hms
198198+ in Time $ Thyme.UTCTime ymd hms
198199199200-- Unpack the word into an icicle Time
200201timeOfPacked :: Word64 -> Time
···225226226227getCurrentDate :: MonadIO m => m Date
227228getCurrentDate =
228228- Date . Thyme.utctDay . Thyme.unUTCTime <$> liftIO Thyme.getCurrentTime
229229+ Date . Thyme.utctDay <$> liftIO Thyme.getCurrentTime
229230230231midnight :: Date -> Time
231232midnight (Date date) =
232232- Time $ Thyme.mkUTCTime date 0
233233+ Time $ Thyme.UTCTime date 0
233234234235exclusiveSnapshotTime :: Date -> Time
235236exclusiveSnapshotTime (Date date) =
236236- Time $ Thyme.mkUTCTime (Thyme.addDays 1 date) 0
237237+ Time $ Thyme.UTCTime (Thyme.addDays 1 date) 0
237238238239dateOfYMD :: Int -> Int -> Int -> Maybe Date
239240dateOfYMD y m d =
···308309minusDays :: Time -> Int -> Time
309310minusDays d i
310311 = Time
311311- $ flip Thyme.mkUTCTime (Thyme.utctDayTime view)
312312+ $ flip Thyme.UTCTime (Thyme.utctDayTime view)
312313 $ Thyme.addDays (-i) (Thyme.utctDay view)
313314 where
314314- view = getDateTime d ^. Thyme.utcTime
315315+ view = getDateTime d
315316316317minusMonths :: Time -> Int -> Time
317318minusMonths d i
318319 = Time
319319- $ flip Thyme.mkUTCTime (Thyme.utctDayTime view)
320320+ $ flip Thyme.UTCTime (Thyme.utctDayTime view)
320321 $ Thyme.addGregorianMonthsClip (-i) (Thyme.utctDay view)
321322 where
322322- view = getDateTime d ^. Thyme.utcTime
323323+ view = getDateTime d
···157157 | otherwise
158158 -> Nothing
159159160160- SumT a1 a2
161161- | SumT b1 b2 <- sig
160160+ SumT a1 a2
161161+ | SumT b1 b2 <- sig
162162 -> join $ combine <$> subsumeT a1 b1 <*> subsumeT a2 b2
163163 | otherwise
164164 -> Nothing
165165166166 StructT as
167167- | StructT bs <- sig
167167+ | StructT bs <- sig
168168 , Map.keysSet as == Map.keysSet bs
169169- , m' <- Map.intersectionWith (,) as bs
169169+ , m' <- Map.intersectionWith (,) as bs
170170 -> do recordSubs <- traverse (uncurry subsumeT) m'
171171 foldM combine Map.empty recordSubs
172172 | otherwise
173173 -> Nothing
174174175175+ -- Here we have a special case for pure subsumptions.
176176+ -- If the temporality is of the inferred site is pure,
177177+ -- then we accept the unadorned type as the signature.
175178 Temporality at ar
176179 | Temporality bt br <- sig
177180 -> join $ combine <$> subsumeT at bt <*> subsumeT ar br
181181+ | TemporalityPure <- at
182182+ -> subsumeT ar sig
178183 | otherwise
179184 -> Nothing
180185181181- TemporalityPure -> eq
182182- TemporalityElement -> eq
183183- TemporalityAggregate -> eq
184184-186186+ -- Likewise for possibilities, if the adornment is
187187+ -- definitely, then the unadorned type is fine.
185188 Possibility at ar
186189 | Possibility bt br <- sig
187190 -> join $ combine <$> subsumeT at bt <*> subsumeT ar br
191191+ | PossibilityDefinitely <- at
192192+ -> subsumeT ar sig
188193 | otherwise
189194 -> Nothing
190195191191- PossibilityPossibly -> eq
196196+ TemporalityPure -> eq
197197+ TemporalityElement -> eq
198198+ TemporalityAggregate -> eq
199199+192200 PossibilityDefinitely -> eq
201201+ PossibilityPossibly -> eq
193202194203 TypeArrow at ar
195204 | TypeArrow bt br <- sig