{-# LANGUAGE MultiParamTypeClasses #-}
module Reflex.Dom.Class ( module Reflex.Dom.Class
                        , module Foreign.JavaScript.TH
                        , module Web.KeyCode
                        ) where

import Control.Lens
import Reflex.Class
import Web.KeyCode

import Foreign.JavaScript.TH
import Reflex.PerformEvent.Class
import Reflex.PostBuild.Class

-- | Previously an alias for 'Data.Map.singleton', but now generalised to 'At'
(=:) :: (At m, Monoid m) => Index m -> IxValue m -> m
k :: Index m
k =: :: Index m -> IxValue m -> m
=: a :: IxValue m
a = Index m -> Lens' m (Maybe (IxValue m))
forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Index m
k ((Maybe (IxValue m) -> Identity (Maybe (IxValue m)))
 -> m -> Identity m)
-> IxValue m -> m -> m
forall s t a b. ASetter s t a (Maybe b) -> b -> s -> t
?~ IxValue m
a (m -> m) -> m -> m
forall a b. (a -> b) -> a -> b
$ m
forall a. Monoid a => a
mempty
infixr 7 =: -- Ought to bind tighter than <>, which is infixr 6

{-# DEPRECATED keycodeEnter "Instead of `x == keycodeEnter`, use `keyCodeLookup x == Enter`" #-}
keycodeEnter :: Int
keycodeEnter :: Int
keycodeEnter = 13

{-# DEPRECATED keycodeEscape "Instead of `x == keycodeEscape`, use `keyCodeLookup x == Escape`" #-}
keycodeEscape :: Int
keycodeEscape :: Int
keycodeEscape = 27

{-# INLINABLE holdOnStartup #-}
holdOnStartup :: (PostBuild t m, PerformEvent t m, MonadHold t m) => a -> Performable m a -> m (Behavior t a)
holdOnStartup :: a -> Performable m a -> m (Behavior t a)
holdOnStartup a0 :: a
a0 ma :: Performable m a
ma = do
  a -> Event t a -> m (Behavior t a)
forall k (t :: k) (m :: * -> *) a.
MonadHold t m =>
a -> Event t a -> m (Behavior t a)
hold a
a0 (Event t a -> m (Behavior t a))
-> m (Event t a) -> m (Behavior t a)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Event t (Performable m a) -> m (Event t a)
forall t (m :: * -> *) a.
PerformEvent t m =>
Event t (Performable m a) -> m (Event t a)
performEvent (Event t (Performable m a) -> m (Event t a))
-> (Event t () -> Event t (Performable m a))
-> Event t ()
-> m (Event t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Performable m a
ma Performable m a -> Event t () -> Event t (Performable m a)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$) (Event t () -> m (Event t a)) -> m (Event t ()) -> m (Event t a)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< m (Event t ())
forall t (m :: * -> *). PostBuild t m => m (Event t ())
getPostBuild