Store a custom snapshot of lights

This commit is contained in:
MasseR committed 2026-09-29 22:51:37 +03:00
1 parent fcaccfdeb0
commit fefeae6301
15 files changed
+173 -24

No files matched your search

+6
View File
@@ -42,6 +42,7 @@ module AFRP
, load
, stepAuto
, stepAutoSerializing
, snapshot
) where
import Control.Category (Category(..), (>>>))
@@ -325,6 +326,11 @@ hold def = mapAccum step def id
Tick -> prev
Event new -> new
snapshot :: (Serialize a, Eq a) => a -> Mealy m (Event (), a) a
snapshot def = mapAccum step def id
where
step prev (Tick, _) = prev
step _prev (Event _, a) = a
events :: Mealy eff (Event a) (Either () a)
events = arr $ \case