    {-# LANGUAGE DeriveDataTypeable, RecordWildCards #-}
    {-# OPTIONS_GHC -fno-warn-missing-fields -fno-cse #-}

    module Action.CmdLine(
        CmdLine(..), Language(..),
        getCmdLine, defaultDatabaseLang,
        defaultGenerate,
        whenLoud, whenNormal
        ) where

    import Data.List.Extra
    import Data.Version
    import General.Util
    import Paths_hoogle (version)
    import System.Console.CmdArgs
    import System.Directory
    import System.Environment
    import System.FilePath

    data Language = Haskell | Frege deriving (Typeable Language
    Typeable Language =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> Language -> c Language)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c Language)
    -> (Language -> Constr)
    -> (Language -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c Language))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Language))
    -> ((forall b. Data b => b -> b) -> Language -> Language)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> Language -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> Language -> r)
    -> (forall u. (forall d. Data d => d -> u) -> Language -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> Language -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> Language -> m Language)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Language -> m Language)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Language -> m Language)
    -> Data Language
    Language -> Constr
    Language -> DataType
    (forall b. Data b => b -> b) -> Language -> Language
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> Language -> u
    forall u. (forall d. Data d => d -> u) -> Language -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Language -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Language -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Language -> m Language
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Language -> m Language
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Language
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Language -> c Language
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Language)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Language)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Language -> c Language
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Language -> c Language
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Language
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Language
    $ctoConstr :: Language -> Constr
    toConstr :: Language -> Constr
    $cdataTypeOf :: Language -> DataType
    dataTypeOf :: Language -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Language)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Language)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Language)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Language)
    $cgmapT :: (forall b. Data b => b -> b) -> Language -> Language
    gmapT :: (forall b. Data b => b -> b) -> Language -> Language
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Language -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Language -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Language -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Language -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> Language -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> Language -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Language -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Language -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Language -> m Language
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Language -> m Language
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Language -> m Language
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Language -> m Language
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Language -> m Language
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Language -> m Language
    Data,Typeable,Int -> Language -> ShowS
    [Language] -> ShowS
    Language -> FilePath
    (Int -> Language -> ShowS)
    -> (Language -> FilePath) -> ([Language] -> ShowS) -> Show Language
    forall a.
    (Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Language -> ShowS
    showsPrec :: Int -> Language -> ShowS
    $cshow :: Language -> FilePath
    show :: Language -> FilePath
    $cshowList :: [Language] -> ShowS
    showList :: [Language] -> ShowS
    Show,Language -> Language -> Bool
    (Language -> Language -> Bool)
    -> (Language -> Language -> Bool) -> Eq Language
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Language -> Language -> Bool
    == :: Language -> Language -> Bool
    $c/= :: Language -> Language -> Bool
    /= :: Language -> Language -> Bool
    Eq,Int -> Language
    Language -> Int
    Language -> [Language]
    Language -> Language
    Language -> Language -> [Language]
    Language -> Language -> Language -> [Language]
    (Language -> Language)
    -> (Language -> Language)
    -> (Int -> Language)
    -> (Language -> Int)
    -> (Language -> [Language])
    -> (Language -> Language -> [Language])
    -> (Language -> Language -> [Language])
    -> (Language -> Language -> Language -> [Language])
    -> Enum Language
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: Language -> Language
    succ :: Language -> Language
    $cpred :: Language -> Language
    pred :: Language -> Language
    $ctoEnum :: Int -> Language
    toEnum :: Int -> Language
    $cfromEnum :: Language -> Int
    fromEnum :: Language -> Int
    $cenumFrom :: Language -> [Language]
    enumFrom :: Language -> [Language]
    $cenumFromThen :: Language -> Language -> [Language]
    enumFromThen :: Language -> Language -> [Language]
    $cenumFromTo :: Language -> Language -> [Language]
    enumFromTo :: Language -> Language -> [Language]
    $cenumFromThenTo :: Language -> Language -> Language -> [Language]
    enumFromThenTo :: Language -> Language -> Language -> [Language]
    Enum,Language
    Language -> Language -> Bounded Language
    forall a. a -> a -> Bounded a
    $cminBound :: Language
    minBound :: Language
    $cmaxBound :: Language
    maxBound :: Language
    Bounded)

    data CmdLine
        = Search
            {CmdLine -> Maybe Bool
    color :: Maybe Bool
            ,CmdLine -> Bool
    json :: Bool
            ,CmdLine -> Bool
    jsonl :: Bool
            ,CmdLine -> Bool
    link :: Bool
            ,CmdLine -> Bool
    numbers :: Bool
            ,CmdLine -> Bool
    info :: Bool
            ,CmdLine -> FilePath
    database :: FilePath
            ,CmdLine -> Maybe Int
    count :: Maybe Int
            ,CmdLine -> [FilePath]
    query :: [String]
            ,CmdLine -> Int
    repeat_ :: Int
            ,CmdLine -> Language
    language :: Language
            ,CmdLine -> [FilePath]
    compare_ :: [String]
            }
        | Generate
            {CmdLine -> Maybe Bool
    download :: Maybe Bool
            ,database :: FilePath
            ,CmdLine -> Bool
    insecure :: Bool
            ,CmdLine -> [FilePath]
    include :: [String]
            ,count :: Maybe Int
            ,CmdLine -> [FilePath]
    local_ :: [FilePath]
            ,CmdLine -> Maybe FilePath
    haddock :: Maybe FilePath
            ,CmdLine -> Bool
    debug :: Bool
            ,language :: Language
            }
        | Server
            {CmdLine -> Int
    port :: Int
            ,database :: FilePath
            ,CmdLine -> FilePath
    cdn :: String
            ,CmdLine -> FilePath
    logs :: FilePath
            ,CmdLine -> Bool
    local :: Bool
            ,haddock :: Maybe FilePath
            ,CmdLine -> Bool
    links :: Bool
            ,language :: Language
            ,CmdLine -> FilePath
    scope :: String
            ,CmdLine -> FilePath
    home :: String
            ,CmdLine -> FilePath
    host :: String
            ,CmdLine -> Bool
    https :: Bool
            ,CmdLine -> FilePath
    cert :: FilePath
            ,CmdLine -> FilePath
    key :: FilePath
            ,CmdLine -> Maybe FilePath
    datadir :: Maybe FilePath
            ,CmdLine -> Bool
    no_security_headers :: Bool
            }
        | Replay
            {logs :: FilePath
            ,database :: FilePath
            ,repeat_ :: Int
            ,language :: Language
            ,scope :: String
            }
        | Test
            { CmdLine -> Bool
    deep :: Bool
            , CmdLine -> Bool
    disable_network_tests  :: Bool
            , database :: FilePath
            , language :: Language
            }
          deriving (Typeable CmdLine
    Typeable CmdLine =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> CmdLine -> c CmdLine)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c CmdLine)
    -> (CmdLine -> Constr)
    -> (CmdLine -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c CmdLine))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CmdLine))
    -> ((forall b. Data b => b -> b) -> CmdLine -> CmdLine)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> CmdLine -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> CmdLine -> r)
    -> (forall u. (forall d. Data d => d -> u) -> CmdLine -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> CmdLine -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine)
    -> Data CmdLine
    CmdLine -> Constr
    CmdLine -> DataType
    (forall b. Data b => b -> b) -> CmdLine -> CmdLine
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> CmdLine -> u
    forall u. (forall d. Data d => d -> u) -> CmdLine -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CmdLine -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CmdLine -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CmdLine
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CmdLine -> c CmdLine
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CmdLine)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CmdLine)
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CmdLine -> c CmdLine
    gfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CmdLine -> c CmdLine
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CmdLine
    gunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CmdLine
    $ctoConstr :: CmdLine -> Constr
    toConstr :: CmdLine -> Constr
    $cdataTypeOf :: CmdLine -> DataType
    dataTypeOf :: CmdLine -> DataType
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CmdLine)
    dataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CmdLine)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CmdLine)
    dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CmdLine)
    $cgmapT :: (forall b. Data b => b -> b) -> CmdLine -> CmdLine
    gmapT :: (forall b. Data b => b -> b) -> CmdLine -> CmdLine
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CmdLine -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CmdLine -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CmdLine -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CmdLine -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> CmdLine -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> CmdLine -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CmdLine -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CmdLine -> u
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine
    gmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine
    gmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine
    gmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CmdLine -> m CmdLine
    Data,Typeable,Int -> CmdLine -> ShowS
    [CmdLine] -> ShowS
    CmdLine -> FilePath
    (Int -> CmdLine -> ShowS)
    -> (CmdLine -> FilePath) -> ([CmdLine] -> ShowS) -> Show CmdLine
    forall a.
    (Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> CmdLine -> ShowS
    showsPrec :: Int -> CmdLine -> ShowS
    $cshow :: CmdLine -> FilePath
    show :: CmdLine -> FilePath
    $cshowList :: [CmdLine] -> ShowS
    showList :: [CmdLine] -> ShowS
    Show)

    defaultDatabaseLang :: Language -> IO FilePath
    defaultDatabaseLang :: Language -> IO FilePath
    defaultDatabaseLang Language
    lang = do
        dir <- FilePath -> IO FilePath
    getAppUserDataDirectory FilePath
    "hoogle"
        pure $ dir </> "default-" ++ lower (show lang) ++ "-" ++ showVersion (trimVersion 3 version) ++ ".hoo"

    getCmdLine :: [String] -> IO CmdLine
    getCmdLine :: [FilePath] -> IO CmdLine
    getCmdLine [FilePath]
    args = do
        args <- [FilePath] -> IO CmdLine -> IO CmdLine
    forall a. [FilePath] -> IO a -> IO a
    withArgs [FilePath]
    args (IO CmdLine -> IO CmdLine) -> IO CmdLine -> IO CmdLine
    forall a b. (a -> b) -> a -> b
    $ Mode (CmdArgs CmdLine) -> IO CmdLine
    forall a. Mode (CmdArgs a) -> IO a
    cmdArgsRun Mode (CmdArgs CmdLine)
    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
            let debdb = FilePath
    "/var/lib/hoogle/databases/default.hoo"
            db_exists <- doesFileExist db
            case args of
              Generate{Bool
    FilePath
    [FilePath]
    Maybe Bool
    Maybe Int
    Maybe FilePath
    Language
    database :: CmdLine -> FilePath
    count :: CmdLine -> Maybe Int
    language :: CmdLine -> Language
    download :: CmdLine -> Maybe Bool
    insecure :: CmdLine -> Bool
    include :: CmdLine -> [FilePath]
    local_ :: CmdLine -> [FilePath]
    haddock :: CmdLine -> Maybe FilePath
    debug :: CmdLine -> Bool
    download :: Maybe Bool
    database :: FilePath
    insecure :: Bool
    include :: [FilePath]
    count :: Maybe Int
    local_ :: [FilePath]
    haddock :: Maybe FilePath
    debug :: Bool
    language :: Language
    ..} -> CmdLine -> IO CmdLine
    forall a. a -> IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (CmdLine -> IO CmdLine) -> CmdLine -> IO CmdLine
    forall a b. (a -> b) -> a -> b
    $ CmdLine
    args{database=db}
              CmdLine
    _ | Bool
    db_exists -> CmdLine -> IO CmdLine
    forall a. a -> IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (CmdLine -> IO CmdLine) -> CmdLine -> IO CmdLine
    forall a b. (a -> b) -> a -> b
    $ CmdLine
    args{database=db}
              CmdLine
    _ -> CmdLine -> IO CmdLine
    forall a. a -> IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (CmdLine -> IO CmdLine) -> CmdLine -> IO CmdLine
    forall a b. (a -> b) -> a -> b
    $ CmdLine
    args{database=debdb}

        -- fix up people using Hoogle 4 instructions
        args <- case args of
            Generate{Bool
    FilePath
    [FilePath]
    Maybe Bool
    Maybe Int
    Maybe FilePath
    Language
    database :: CmdLine -> FilePath
    count :: CmdLine -> Maybe Int
    language :: CmdLine -> Language
    download :: CmdLine -> Maybe Bool
    insecure :: CmdLine -> Bool
    include :: CmdLine -> [FilePath]
    local_ :: CmdLine -> [FilePath]
    haddock :: CmdLine -> Maybe FilePath
    debug :: CmdLine -> Bool
    download :: Maybe Bool
    database :: FilePath
    insecure :: Bool
    include :: [FilePath]
    count :: Maybe Int
    local_ :: [FilePath]
    haddock :: Maybe FilePath
    debug :: Bool
    language :: Language
    ..} | FilePath
    "all" FilePath -> [FilePath] -> Bool
    forall a. Eq a => a -> [a] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `elem` [FilePath]
    include -> do
                FilePath -> IO ()
    putStrLn FilePath
    "Warning: 'all' argument is no longer required, and has been ignored."
                CmdLine -> IO CmdLine
    forall a. a -> IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (CmdLine -> IO CmdLine) -> CmdLine -> IO CmdLine
    forall a b. (a -> b) -> a -> b
    $ CmdLine
    args{include = delete "all" include}
            CmdLine
    _ -> CmdLine -> IO CmdLine
    forall a. a -> IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure CmdLine
    args

        pure args

    defaultGenerate :: CmdLine
    defaultGenerate :: CmdLine
    defaultGenerate = CmdLine
    generate{language=Haskell}

    cmdLineMode :: Mode (CmdArgs CmdLine)
    cmdLineMode = CmdLine -> Mode (CmdArgs CmdLine)
    forall a. Data a => a -> Mode (CmdArgs a)
    cmdArgsMode (CmdLine -> Mode (CmdArgs CmdLine))
    -> CmdLine -> Mode (CmdArgs CmdLine)
    forall a b. (a -> b) -> a -> b
    $ [CmdLine] -> CmdLine
    forall val. Data val => [val] -> val
    modes [CmdLine
    search_ CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= Ann
    auto,CmdLine
    generate,CmdLine
    server,CmdLine
    replay,CmdLine
    test]
        CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= Ann
    verbosity CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    program FilePath
    "hoogle"
        CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    summary (FilePath
    "Hoogle " FilePath -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Version -> FilePath
    showVersion Version
    version FilePath -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ FilePath
    ", https://hoogle.haskell.org/")

    search_ :: CmdLine
    search_ = Search
        {color :: Maybe Bool
    color = Maybe Bool
    forall a. Default a => a
    def Maybe Bool -> Ann -> Maybe Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    name FilePath
    "colour" Maybe Bool -> Ann -> Maybe Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Use colored output (requires ANSI terminal)"
        ,json :: Bool
    json = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    name FilePath
    "json" Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Get result as JSON"
        ,jsonl :: Bool
    jsonl = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    name FilePath
    "jsonl" Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Get result as JSONL (JSON Lines)"
        ,link :: Bool
    link = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Give URL's for each result"
        ,numbers :: Bool
    numbers = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Give counter for each result"
        ,info :: Bool
    info = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Give extended information about the first result"
        ,database :: FilePath
    database = FilePath
    forall a. Default a => a
    def FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= Ann
    typFile FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Name of database to use (use .hoo extension)"
        ,count :: Maybe Int
    count = Maybe Int
    forall a. Maybe a
    Nothing Maybe Int -> Ann -> Maybe Int
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    name FilePath
    "n" Maybe Int -> Ann -> Maybe Int
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Maximum number of results to return (defaults to 10)"
        ,query :: [FilePath]
    query = [FilePath]
    forall a. Default a => a
    def [FilePath] -> Ann -> [FilePath]
    forall val. Data val => val -> Ann -> val
    &= Ann
    args [FilePath] -> Ann -> [FilePath]
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    typ FilePath
    "QUERY"
        ,repeat_ :: Int
    repeat_ = Int
    1 Int -> Ann -> Int
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Number of times to repeat (for benchmarking)"
        ,language :: Language
    language = [Language] -> Language
    forall val. Data val => [val] -> val
    enum [Language
    x Language -> Ann -> Language
    forall val. Data val => val -> Ann -> val
    &= Ann
    explicit Language -> Ann -> Language
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    name (ShowS
    lower ShowS -> ShowS
    forall a b. (a -> b) -> a -> b
    $ Language -> FilePath
    forall a. Show a => a -> FilePath
    show Language
    x) Language -> Ann -> Language
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help (FilePath
    "Work with " FilePath -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Language -> FilePath
    forall a. Show a => a -> FilePath
    show Language
    x) | Language
    x <- [Language]
    forall a. (Enum a, Bounded a) => [a]
    enumerate] Language -> Ann -> Language
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    groupname FilePath
    "Language"
        ,compare_ :: [FilePath]
    compare_ = [FilePath]
    forall a. Default a => a
    def [FilePath] -> Ann -> [FilePath]
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Type signatures to compare against"
        } CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Perform a search"

    generate :: CmdLine
    generate = Generate
        {download :: Maybe Bool
    download = Maybe Bool
    forall a. Default a => a
    def Maybe Bool -> Ann -> Maybe Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Download all files from the web"
        ,insecure :: Bool
    insecure = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Allow insecure HTTPS connections"
        ,include :: [FilePath]
    include = [FilePath]
    forall a. Default a => a
    def [FilePath] -> Ann -> [FilePath]
    forall val. Data val => val -> Ann -> val
    &= Ann
    args [FilePath] -> Ann -> [FilePath]
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    typ FilePath
    "PACKAGE"
        ,local_ :: [FilePath]
    local_ = [FilePath]
    forall a. Default a => a
    def [FilePath] -> Ann -> [FilePath]
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    forall a. (Show a, Typeable a) => a -> Ann
    opt FilePath
    "" [FilePath] -> Ann -> [FilePath]
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Index local packages and link to local haddock docs"
        ,count :: Maybe Int
    count = Maybe Int
    forall a. Maybe a
    Nothing Maybe Int -> Ann -> Maybe Int
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    name FilePath
    "n" Maybe Int -> Ann -> Maybe Int
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Maximum number of packages to index (defaults to all)"
        ,haddock :: Maybe FilePath
    haddock = Maybe FilePath
    forall a. Default a => a
    def Maybe FilePath -> Ann -> Maybe FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Use local haddocks"
        ,debug :: Bool
    debug = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Generate debug information"
        } CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Generate Hoogle databases"

    server :: CmdLine
    server = Server
        {port :: Int
    port = Int
    8080 Int -> Ann -> Int
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    typ FilePath
    "INT" Int -> Ann -> Int
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Port number"
        ,cdn :: FilePath
    cdn = FilePath
    "" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    typ FilePath
    "URL" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "URL prefix to use"
        ,logs :: FilePath
    logs = FilePath
    "" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    forall a. (Show a, Typeable a) => a -> Ann
    opt FilePath
    "log.txt" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= Ann
    typFile FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "File to log requests to (defaults to stdout)"
        ,local :: Bool
    local = Bool
    False Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Allow following file:// links, restricts to 127.0.0.1  Set --host explicitely (including to '*' for any host) to override the localhost-only behaviour"
        ,haddock :: Maybe FilePath
    haddock = Maybe FilePath
    forall a. Default a => a
    def Maybe FilePath -> Ann -> Maybe FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Serve local haddocks from a specified directory"
        ,scope :: FilePath
    scope = FilePath
    forall a. Default a => a
    def FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Default scope to start with"
        ,links :: Bool
    links = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Display extra links"
        ,home :: FilePath
    home = FilePath
    "https://hoogle.haskell.org" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    typ FilePath
    "URL" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Set the URL linked to by the Hoogle logo."
        ,host :: FilePath
    host = FilePath
    "" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Set the host to bind on (e.g., an ip address; '!4' for ipv4-only; '!6' for ipv6-only; default: '*' for any host)."
        ,https :: Bool
    https = Bool
    forall a. Default a => a
    def Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Start an https server (use --cert and --key to specify paths to the .pem files)"
        ,cert :: FilePath
    cert = FilePath
    "cert.pem" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= Ann
    typFile FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Path to the certificate pem file (when running an https server)"
        ,key :: FilePath
    key = FilePath
    "key.pem" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= Ann
    typFile FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Path to the key pem file (when running an https server)"
        ,datadir :: Maybe FilePath
    datadir = Maybe FilePath
    forall a. Default a => a
    def Maybe FilePath -> Ann -> Maybe FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Override data directory paths"
        ,no_security_headers :: Bool
    no_security_headers = Bool
    False Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Don't send CSP security headers"
        } CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Start a Hoogle server"

    replay :: CmdLine
    replay = Replay
        {logs :: FilePath
    logs = FilePath
    "log.txt" FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= Ann
    args FilePath -> Ann -> FilePath
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    typ FilePath
    "FILE"
        } CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Replay a log file"

    test :: CmdLine
    test = Test
        { deep :: Bool
    deep    = Bool
    False Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Run extra long tests"
        , disable_network_tests :: Bool
    disable_network_tests = Bool
    False  Bool -> Ann -> Bool
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Disables the use of network tests"
        } CmdLine -> Ann -> CmdLine
    forall val. Data val => val -> Ann -> val
    &= FilePath -> Ann
    help FilePath
    "Run the test suite"