{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE UndecidableInstances #-}
#ifdef USE_REFLEX_OPTIMIZER
{-# OPTIONS_GHC -fplugin=Reflex.Optimizer #-}
#endif
module Reflex.EventWriter.Class
( EventWriter (..)
) where
import Control.Monad.Reader (ReaderT, lift)
import Data.Semigroup (Semigroup)
import Reflex.Class (Event)
class (Monad m, Semigroup w) => EventWriter t w m | m -> t w where
tellEvent :: Event t w -> m ()
instance EventWriter t w m => EventWriter t w (ReaderT r m) where
tellEvent :: Event t w -> ReaderT r m ()
tellEvent = m () -> ReaderT r m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> ReaderT r m ())
-> (Event t w -> m ()) -> Event t w -> ReaderT r m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Event t w -> m ()
forall t w (m :: * -> *). EventWriter t w m => Event t w -> m ()
tellEvent