❄️ The Icicle Streaming Query Language ❄️
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update Thyme and improve subsumption of pure and definitely types

+35 -26
+2 -2
data/example/requiring.icicle
··· 5 5 -- Only return the result computation 6 6 -- if there was at least `i` facts in 7 7 -- the stream. 8 - requiring : Aggregate (Definitely Int) -> Aggregate a -> Aggregate (Possibly a) 8 + requiring : Aggregate Int -> Aggregate a -> Aggregate (Possibly a) 9 9 requiring i x = 10 - case (fold x = 0 then x + 1 in x) < i of 10 + case count () < i of 11 11 True then 12 12 missing 13 13 False then
+2 -2
icicle-data/src/Icicle/Data/Regex.hs
··· 215 215 c' == c 216 216 checkAcceptor c (AcceptRange s fe) = 217 217 c >= s && c <= fe 218 - negs neg = if neg then not else id 219 - 218 + negs neg = 219 + if neg then not else id 220 220 221 221 step s0 c = 222 222 let
+13 -12
icicle-data/src/Icicle/Data/Time.hs
··· 1 1 {-# LANGUAGE NoImplicitPrelude #-} 2 2 {-# LANGUAGE OverloadedStrings #-} 3 3 {-# LANGUAGE ViewPatterns #-} 4 + {-# LANGUAGE PatternSynonyms #-} 4 5 module Icicle.Data.Time ( 5 6 Date(..) 6 7 , Time(..) ··· 168 169 timeOfDays :: Int -> Time 169 170 timeOfDays d 170 171 = Time 171 - $ flip Thyme.mkUTCTime 0 172 + $ flip Thyme.UTCTime 0 172 173 $ Thyme.ModifiedJulianDay d 173 174 174 175 unsafeTimeOfYMD :: Int -> Int -> Int -> Time 175 176 unsafeTimeOfYMD y m d 176 177 = Time 177 - $ flip Thyme.mkUTCTime 0 178 + $ flip Thyme.UTCTime 0 178 179 $ Thyme.fromGregorian y m d 179 180 180 181 timeOfYMD :: Int -> Int -> Int -> Maybe Time 181 182 timeOfYMD y m d 182 183 = Time 183 - . flip Thyme.mkUTCTime 0 184 + . flip Thyme.UTCTime 0 184 185 <$> Thyme.fromGregorianValid y m d 185 186 186 187 timeOfIvorySeconds :: Int64 -> Time 187 188 timeOfIvorySeconds seconds = 188 - Time $ Thyme.addUTCTime (fromIntegral seconds) (Thyme.mkUTCTime ivoryEpoch 0) 189 + Time $ Thyme.addUTCTime (fromIntegral seconds) (Thyme.UTCTime ivoryEpoch 0) 189 190 190 191 timeOfYMDHMS :: Int -> Int -> Int -> Int -> Int -> Int -> Time 191 192 timeOfYMDHMS year month day hour minute sec ··· 194 195 $ Thyme.TimeOfDay hour minute 195 196 $ Thyme.secondsToDiffTime 196 197 $ fromIntegral sec 197 - in Time $ Thyme.mkUTCTime ymd hms 198 + in Time $ Thyme.UTCTime ymd hms 198 199 199 200 -- Unpack the word into an icicle Time 200 201 timeOfPacked :: Word64 -> Time ··· 225 226 226 227 getCurrentDate :: MonadIO m => m Date 227 228 getCurrentDate = 228 - Date . Thyme.utctDay . Thyme.unUTCTime <$> liftIO Thyme.getCurrentTime 229 + Date . Thyme.utctDay <$> liftIO Thyme.getCurrentTime 229 230 230 231 midnight :: Date -> Time 231 232 midnight (Date date) = 232 - Time $ Thyme.mkUTCTime date 0 233 + Time $ Thyme.UTCTime date 0 233 234 234 235 exclusiveSnapshotTime :: Date -> Time 235 236 exclusiveSnapshotTime (Date date) = 236 - Time $ Thyme.mkUTCTime (Thyme.addDays 1 date) 0 237 + Time $ Thyme.UTCTime (Thyme.addDays 1 date) 0 237 238 238 239 dateOfYMD :: Int -> Int -> Int -> Maybe Date 239 240 dateOfYMD y m d = ··· 308 309 minusDays :: Time -> Int -> Time 309 310 minusDays d i 310 311 = Time 311 - $ flip Thyme.mkUTCTime (Thyme.utctDayTime view) 312 + $ flip Thyme.UTCTime (Thyme.utctDayTime view) 312 313 $ Thyme.addDays (-i) (Thyme.utctDay view) 313 314 where 314 - view = getDateTime d ^. Thyme.utcTime 315 + view = getDateTime d 315 316 316 317 minusMonths :: Time -> Int -> Time 317 318 minusMonths d i 318 319 = Time 319 - $ flip Thyme.mkUTCTime (Thyme.utctDayTime view) 320 + $ flip Thyme.UTCTime (Thyme.utctDayTime view) 320 321 $ Thyme.addGregorianMonthsClip (-i) (Thyme.utctDay view) 321 322 where 322 - view = getDateTime d ^. Thyme.utcTime 323 + view = getDateTime d
-1
icicle-source/src/Icicle/Source/Checker/Function.hs
··· 23 23 import Icicle.Source.Type 24 24 import Icicle.Source.Lexer.Token (Variable (..)) 25 25 26 - import Icicle.Common.Base 27 26 import qualified Icicle.Common.Fresh as Fresh 28 27 29 28 import Icicle.Internal.Pretty (Pretty, pretty)
+18 -9
icicle-source/src/Icicle/Source/Checker/Subsumption.hs
··· 157 157 | otherwise 158 158 -> Nothing 159 159 160 - SumT a1 a2 161 - | SumT b1 b2 <- sig 160 + SumT a1 a2 161 + | SumT b1 b2 <- sig 162 162 -> join $ combine <$> subsumeT a1 b1 <*> subsumeT a2 b2 163 163 | otherwise 164 164 -> Nothing 165 165 166 166 StructT as 167 - | StructT bs <- sig 167 + | StructT bs <- sig 168 168 , Map.keysSet as == Map.keysSet bs 169 - , m' <- Map.intersectionWith (,) as bs 169 + , m' <- Map.intersectionWith (,) as bs 170 170 -> do recordSubs <- traverse (uncurry subsumeT) m' 171 171 foldM combine Map.empty recordSubs 172 172 | otherwise 173 173 -> Nothing 174 174 175 + -- Here we have a special case for pure subsumptions. 176 + -- If the temporality is of the inferred site is pure, 177 + -- then we accept the unadorned type as the signature. 175 178 Temporality at ar 176 179 | Temporality bt br <- sig 177 180 -> join $ combine <$> subsumeT at bt <*> subsumeT ar br 181 + | TemporalityPure <- at 182 + -> subsumeT ar sig 178 183 | otherwise 179 184 -> Nothing 180 185 181 - TemporalityPure -> eq 182 - TemporalityElement -> eq 183 - TemporalityAggregate -> eq 184 - 186 + -- Likewise for possibilities, if the adornment is 187 + -- definitely, then the unadorned type is fine. 185 188 Possibility at ar 186 189 | Possibility bt br <- sig 187 190 -> join $ combine <$> subsumeT at bt <*> subsumeT ar br 191 + | PossibilityDefinitely <- at 192 + -> subsumeT ar sig 188 193 | otherwise 189 194 -> Nothing 190 195 191 - PossibilityPossibly -> eq 196 + TemporalityPure -> eq 197 + TemporalityElement -> eq 198 + TemporalityAggregate -> eq 199 + 192 200 PossibilityDefinitely -> eq 201 + PossibilityPossibly -> eq 193 202 194 203 TypeArrow at ar 195 204 | TypeArrow bt br <- sig