Much improved hallway handling
This commit is contained in:
1 parent
95fcc61c4f
commit
6e35445090
9 files changed
+354
-100
No files matched your search
+8
-2
@@ -31,6 +31,7 @@ module AFRP
|
||||
, SerializeUTCTime(..)
|
||||
, SerializeLocalTime(..)
|
||||
, edge
|
||||
, edgeFrom
|
||||
, waitFor
|
||||
, duration
|
||||
, tag
|
||||
@@ -528,10 +529,15 @@ lMerge (Event a) _ = Event a
|
||||
lMerge Tick (Event a) = Event a
|
||||
|
||||
edge :: Mealy eff Bool (Event ())
|
||||
edge =
|
||||
edge = edgeFrom False
|
||||
|
||||
-- | Edge that behaves as if the input has been `start` forever, so the first
|
||||
-- True input does not fire when `start` is already True (no transition).
|
||||
edgeFrom :: Bool -> Mealy eff Bool (Event ())
|
||||
edgeFrom start =
|
||||
mapAccum
|
||||
(\(_, current) new -> (current, new))
|
||||
(False, False)
|
||||
(start, start)
|
||||
(\(old, current) ->
|
||||
if not old && current
|
||||
then Event ()
|
||||
|
||||
Reference in new issue
Block a user