aboutsummaryrefslogtreecommitdiff
path: root/src/client/Debug.hs
blob: 0c5c979bd5b5349905abe03043faf9cb8fe322d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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