connectPlaybackControls :: MonadWidget t m
  => Event t a
  -> Event t a
  -> Event t ()
  -> Event t ()
  -> Dynamic t c
  -> Dynamic t (Maybe (SourceNodeSpec, Maybe Time))
  -> Dynamic t (Map String AudioBuffer)
  -> (Map String AudioBuffer -> c -> (SourceNodeSpec, Maybe Time) -> Maybe a -> Synth ())
  -> m (Event t (Maybe (Synth ())))
connectPlaybackControls playQuestion exploreAnswer playReference stop dynConfig dynSrc sysResources render = do
  let triggerPlay = leftmost [Just <$> playQuestion, Just <$> exploreAnswer, Nothing <$ playReference]
  let triggerStop = Nothing <$ stop
  render' <- mapDyn render sysResources -- Dynamic t (c -> (SourceNodeSpec, Maybe Time) -> Maybe a -> Synth ())
  render'' <- combineDyn ($) render' dynConfig -- Dynamic t ((SourceNodeSpec,Maybe Time) -> Maybe a -> Synth ())
  render''' <- combineDyn (\x y -> maybe (const Nothing) (\z -> Just . x z) y) render'' dynSrc
  let triggerPlay' = attachDynWith ($) render''' triggerPlay
  return $ leftmost [triggerStop, triggerPlay']
connectPlaybackControls :: MonadWidget t m
  => Event t a
  -> Event t a
  -> Event t ()
  -> Event t ()
  -> Dynamic t c
  -> Dynamic t (Maybe (SourceNodeSpec, Maybe Time))
  -> Dynamic t (Map String AudioBuffer)
  -> (Map String AudioBuffer -> c -> (SourceNodeSpec, Maybe Time) -> Maybe a -> Synth ())
  -> m (Event t (Maybe (Synth ())))
connectPlaybackControls playQuestion exploreAnswer playReference stop dynConfig dynSrc sysResources render = do
  let triggerPlay = leftmost [Just <$> playQuestion, Just <$> exploreAnswer, Nothing <$ playReference]
  let triggerStop = Nothing <$ stop
  render' <- mapDyn render sysResources -- Dynamic t (c -> (SourceNodeSpec, Maybe Time) -> Maybe a -> Synth ())
  render'' <- combineDyn ($) render' dynConfig -- Dynamic t ((SourceNodeSpec,Maybe Time) -> Maybe a -> Synth ())
  render''' <- combineDyn (\x y -> maybe (const Nothing) (\z -> Just . x z) y) render'' dynSrc
  let triggerPlay' = attachDynWith ($) render''' triggerPlay
  return $ leftmost [triggerStop, triggerPlay']
connectPlaybackControls playQuestion exploreAnswer playReference stop dynConfig dynSrc sysResources render = do
  let triggerPlay = leftmost [Just <$> playQuestion, Just <$> exploreAnswer, Nothing <$ playReference]
  let triggerStop = Nothing <$ stop
  render' <- mapDyn render sysResources -- Dynamic t (c -> (SourceNodeSpec, Maybe Time) -> Maybe a -> Synth ())
  render'' <- combineDyn ($) render' dynConfig -- Dynamic t ((SourceNodeSpec,Maybe Time) -> Maybe a -> Synth ())
  render''' <- combineDyn (\x y -> maybe (const Nothing) (\z -> Just . x z) y) render'' dynSrc
  let triggerPlay' = attachDynWith ($) render''' triggerPlay
  return $ leftmost [triggerStop, triggerPlay']