Tests
This commit is contained in:
+2
-2
@@ -94,7 +94,7 @@ instance Applicative (Mealy eff a) where
|
||||
data Event a
|
||||
= Tick
|
||||
| Event a
|
||||
deriving (Show, Functor, Foldable, Traversable)
|
||||
deriving (Show, Eq, Functor, Foldable, Traversable)
|
||||
|
||||
hold :: a -> Mealy eff (Event a) a
|
||||
hold a = Mealy $ \_ _ -> \case
|
||||
@@ -274,7 +274,7 @@ sliding size = mapAccum go [] id
|
||||
where
|
||||
go :: [a] -> Event a -> [a]
|
||||
go acc Tick = acc
|
||||
go acc (Event a) = take size (acc ++ [a])
|
||||
go acc (Event a) = let xs = acc ++ [a] in drop (max 0 (length xs - size)) xs
|
||||
|
||||
fixed :: Int -> Mealy eff (Event a) [a]
|
||||
fixed seconds = mapAccumRequest go Nothing (maybe [] ((`appEndo` []) . snd))
|
||||
|
||||
Reference in New Issue
Block a user