Description: Use Debian's hoogle database Allow hoogle to fall back to the Debian's global database if the default doesn't exist. Author: Ilias Tsitsimpis Forwarded: no, Debian specific Index: b/src/Action/CmdLine.hs =================================================================== --- a/src/Action/CmdLine.hs +++ b/src/Action/CmdLine.hs @@ -88,8 +88,16 @@ getCmdLine args = do args <- withArgs args $ cmdArgsRun cmdLineMode -- fill in the default database + -- If a database has not been given, and the default does not exist, + -- and this is not a generate command, fallback to the Debian database. args <- if database args /= "" then pure args else do - db <- defaultDatabaseLang $ language args; pure args{database=db} + db <- defaultDatabaseLang $ language args + let debdb = "/var/lib/hoogle/databases/default.hoo" + db_exists <- doesFileExist db + case args of + Generate{..} -> pure $ args{database=db} + _ | db_exists -> pure $ args{database=db} + _ -> pure $ args{database=debdb} -- fix up people using Hoogle 4 instructions args <- case args of