diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-08-11 10:46:47 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-08-11 11:23:29 +0200 |
commit | 109f0c3ba7b46152bf9f4615ba8f18bb6b904669 (patch) | |
tree | 2c7a959b2f65237e54bf8516bce1313e0e7e382a /test/AggregateSpec.hs | |
parent | e35752a7c7ecd36def983762d3417360c259cec3 (diff) |
drop `MonadSensor`
Diffstat (limited to 'test/AggregateSpec.hs')
-rw-r--r-- | test/AggregateSpec.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/AggregateSpec.hs b/test/AggregateSpec.hs index 71bf420..f44ea29 100644 --- a/test/AggregateSpec.hs +++ b/test/AggregateSpec.hs @@ -46,22 +46,22 @@ diagram n sf = S.feedbackS [] $ proc ((), xs) -> do x <- sf -< () returnA -< (reverse (x : xs), take (n - 1) (x : xs)) -count :: (S.MonadSensor m) => S.Sensor m () Int +count :: (MonadIO m) => S.Sensor m () Int count = S.sensor Count data Count = Count deriving (Show) -instance (S.MonadSensor m) => S.Aggregate m Count Int where +instance (MonadIO m) => S.Aggregate m Count Int where aggregate _ = forM_ [1, 2 ..] $ \n -> do S.yield n sleep -slowCount :: (S.MonadSensor m) => S.Sensor m () Int +slowCount :: (MonadIO m) => S.Sensor m () Int slowCount = S.sensor SlowCount data SlowCount = SlowCount deriving (Show) -instance (S.MonadSensor m) => S.Aggregate m SlowCount Int where +instance (MonadIO m) => S.Aggregate m SlowCount Int where aggregate _ = forM_ [1, 2 ..] $ \n -> do S.yield n sleepLong @@ -72,16 +72,16 @@ sleep = liftIO (threadDelay 2_000) sleepLong :: (MonadIO m) => m () sleepLong = liftIO (threadDelay 3_000) -square :: (S.MonadSensor m) => Int -> S.Sensor m () Int +square :: (MonadIO m) => Int -> S.Sensor m () Int square = S.sensor . Square data Square = Square Int deriving (Show) -instance (S.MonadSensor m) => S.Aggregate m Square Int where +instance (MonadIO m) => S.Aggregate m Square Int where aggregate (Square n) = do S.yield (n * n) -currentTime :: (S.MonadSensor m) => S.Sensor m () UTCTime +currentTime :: (MonadIO m) => S.Sensor m () UTCTime currentTime = S.sensor CurrentTime data CurrentTime = CurrentTime deriving (Show) @@ -92,11 +92,11 @@ data UTCTime = UTCTime } deriving (Show) -instance (S.MonadSensor m) => S.Aggregate m CurrentTime UTCTime where +instance (MonadIO m) => S.Aggregate m CurrentTime UTCTime where aggregate _ = S.yield (UTCTime "1970-01-01" "00:00:00") -date :: (S.MonadSensor m) => S.Sensor m () String +date :: (MonadIO m) => S.Sensor m () String date = (.date) <$> currentTime -time :: (S.MonadSensor m) => S.Sensor m () String +time :: (MonadIO m) => S.Sensor m () String time = (.time) <$> currentTime |