-- | Register a callback to be run whenever the URL hash changes.
--   The two arguments of the callback are the new and old hash respectively.
onHashChange :: MonadIO m
             => (String -> String -> IO ())
             -> m ()
onHashChange f = do
    firsthash <- getHash'
    liftIO $ jsOnHashChange firsthash cb
  where
    cb = \old new -> f (fromJSStr old) (fromJSStr new)

-- | JSString version of @onHashChange@.
onHashChange :: MonadIO m
             => (String -> String -> IO ())
             -> m ()
onHashChange f = do
    firsthash <- getHash'
    liftIO $ jsOnHashChange firsthash cb
  where
    cb = \old new -> f (fromJSStr old) (fromJSStr new)

-- | JSString version of @onHashChange@.
onHashChange f = do
    firsthash <- getHash'
    liftIO $ jsOnHashChange firsthash cb
  where
    cb = \old new -> f (fromJSStr old) (fromJSStr new)

-- | JSString version of @onHashChange@.