diff --git a/src/Lib/Search.elm b/src/Lib/Search.elm index 7028857f..f975cef6 100644 --- a/src/Lib/Search.elm +++ b/src/Lib/Search.elm @@ -7,6 +7,7 @@ module Lib.Search exposing , fromResult , hasSubstantialQuery , isEmptyQuery + , isEmptyResults , isSearching , queriesEquals , query @@ -182,6 +183,25 @@ isEmptyQuery = query >> String.isEmpty +isEmptyResults : Search a -> Maybe Bool +isEmptyResults s = + case s of + NotAsked _ -> + Nothing + + Searching _ (Just r) -> + Just (SearchResults.isEmpty r) + + Searching _ Nothing -> + Nothing + + Success _ r -> + Just (SearchResults.isEmpty r) + + Failure _ _ -> + Nothing + + isSearching : Search a -> Bool isSearching search_ = case search_ of