~jack/casaaaaa

3fe8c6988f06f35cdbdfac921cb19ff9edc2b6a0 — Jack Kelly 2 years ago b0dddd9
Uniq the Dynamic of search inputs to avoid redundant searches
1 files changed, 4 insertions(+), 2 deletions(-)

M Main.hs
M Main.hs => Main.hs +4 -2
@@ 119,7 119,8 @@ form :: forall t m a. DomBuilder t m => m a -> m (Event t (), a)
form children = do
  let config =
        (def :: ElementConfig EventResult t (DomBuilderSpace m))
          & elementConfig_eventSpec %~ addEventSpecFlags (Proxy :: Proxy (DomBuilderSpace m)) Submit (const preventDefault)
          & elementConfig_eventSpec
          %~ addEventSpecFlags (Proxy :: Proxy (DomBuilderSpace m)) Submit (const preventDefault)
  (domElement, a) <- element "form" config children
  pure (domEvent Submit domElement, a)



@@ 148,7 149,8 @@ searchWidget searchNowE = do
            [ searchTimeoutE,
              current (value searchBox) <@ searchNowE
            ]
  holdDyn Nothing (Just <$> searchE) >>= improvingMaybe
  holdDyn Nothing (Just <$> searchE)
    >>= improvingMaybe <&> (uniqDynamic >>> fromUniqDynamic)

type SearchFunc = String -> String -> String -> Bool -> [Fuzzy Acronym String]