diff --git a/CHANGES.txt b/CHANGES.txt
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,7 @@
 Changelog for Hoogle
 
+5.0.11
+    #209, add a defaultDatabaseLocation function
 5.0.10
     #205, change how the link URL is computed
     #206, put newer versions of a package first
diff --git a/hoogle.cabal b/hoogle.cabal
--- a/hoogle.cabal
+++ b/hoogle.cabal
@@ -1,7 +1,7 @@
 cabal-version:      >= 1.18
 build-type:         Simple
 name:               hoogle
-version:            5.0.10
+version:            5.0.11
 license:            BSD3
 license-file:       LICENSE
 category:           Development
diff --git a/src/Action/CmdLine.hs b/src/Action/CmdLine.hs
--- a/src/Action/CmdLine.hs
+++ b/src/Action/CmdLine.hs
@@ -2,7 +2,8 @@
 {-# OPTIONS_GHC -fno-warn-missing-fields -fno-cse #-}
 
 module Action.CmdLine(
-    CmdLine(..), Language(..), getCmdLine,
+    CmdLine(..), Language(..),
+    getCmdLine, defaultDatabaseLang,
     defaultGenerate,
     whenLoud, whenNormal
     ) where
@@ -69,14 +70,18 @@
         }
       deriving (Data,Typeable,Show)
 
+defaultDatabaseLang :: Language -> IO FilePath
+defaultDatabaseLang lang = do
+    dir <- getAppUserDataDirectory "hoogle"
+    return $ dir </> "default-" ++ lower (show lang) ++ "-" ++ showVersion version ++ ".hoo"
+
 getCmdLine :: [String] -> IO CmdLine
 getCmdLine args = do
     args <- withArgs args $ cmdArgsRun cmdLineMode
 
     -- fill in the default database
     args <- if database args /= "" then return args else do
-        dir <- getAppUserDataDirectory "hoogle"
-        return $ args{database=dir </> "default-" ++ lower (show $ language args) ++ "-" ++ showVersion version ++ ".hoo"}
+        db <- defaultDatabaseLang $ language args; return args{database=db}
 
     -- fix up people using Hoogle 4 instructions
     args <- case args of
diff --git a/src/Hoogle.hs b/src/Hoogle.hs
--- a/src/Hoogle.hs
+++ b/src/Hoogle.hs
@@ -1,7 +1,7 @@
 
 -- | High level Hoogle API
 module Hoogle(
-    Database, withDatabase, searchDatabase,
+    Database, withDatabase, searchDatabase, defaultDatabaseLocation,
     Target(..), URL,
     hoogle
     ) where
@@ -26,6 +26,10 @@
 -- | Load a database from a file.
 withDatabase :: NFData a => FilePath -> (Database -> IO a) -> IO a
 withDatabase file act = storeReadFile file $ act . Database
+
+-- | The default location of a database
+defaultDatabaseLocation :: IO FilePath
+defaultDatabaseLocation = defaultDatabaseLang Haskell
 
 -- | Search a database, given a query string, produces a list of results.
 searchDatabase :: Database -> String -> [Target]
