Let's say I have
x :: Event t (A,B)
I can get the first component of it:
fst <$> x :: Event t A
However, this event will fire even when the first component doesn't change. I want to avoid that, because it would trigger an expensive recomputation.
A
is an instance of Eq
, so I want to be able to remove the successive events where the first component is not changed compared to its last value.
Ideally, I'd like a function
filterDups :: Eq a => Event t a -> Event t a
which would do that without resorting to the Moment
monad. Is it possible? Or what's the best way to do this?