diff options
Diffstat (limited to 'src/client/Debug.hs')
-rw-r--r-- | src/client/Debug.hs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/Debug.hs b/src/client/Debug.hs new file mode 100644 index 0000000..0c5c979 --- /dev/null +++ b/src/client/Debug.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} + +module Debug + ( event + ) where + +import Data.Text (Text) +import qualified Data.Text as T +import Reflex.Dom (MonadWidget, Event, Dynamic) +import qualified Reflex.Dom as R + +event :: forall t m a. MonadWidget t m => Text -> Event t a -> m () +event name e = do + count <- R.count e :: m (Dynamic t Int) + let text = fmap (\c -> T.concat [name, " ", (T.pack . show $ c)]) count + R.el "div" $ R.dynText text |