module
Control.Arrow.Machine.Event.Internal
(
Event (..),
)
where
import Control.Applicative
import Data.Foldable
import Data.Traversable
import Data.Monoid (mappend, mconcat, mempty)
data Event a = Event a | NoEvent | End deriving (Eq, Show)
instance
Functor Event
where
fmap f NoEvent = NoEvent
fmap f End = End
fmap f (Event x) = Event (f x)
instance
Foldable Event
where
foldMap f (Event x) = f x
foldMap _ NoEvent = mempty
foldMap _ End = mempty
instance
Traversable Event
where
traverse f (Event x) = Event <$> f x
traverse f NoEvent = pure NoEvent
traverse f End = pure End