ndmitchell / hoogle

Haskell API search engine
http://hoogle.haskell.org/
Other
738 stars 134 forks source link

Add function to provide default database location to the API #209

Closed alanz closed 7 years ago

alanz commented 7 years ago

At the moment the search options are limited, and the most useful one seems to be

withDatabase :: NFData a => FilePath -> (Database -> IO a) -> IO a 

Which requires the FilePath of the installed database.

It would be useful to have a function something like

defaultDatabase :: IO FilePath

that would provide the platform-specific default database location.

ndmitchell commented 7 years ago

I added defaultDatabaseLocation. Can you give that a go and confirm it does what you are after? Assuming it does I'll make a release including it.

alanz commented 7 years ago

Without building, it looks like you have factored out the original logic for choosing the location, and exposed it.

Which is exactly what I was wanting.

Do you need more of a test?

FYI it is for use here, by using the API directly instead of invoking a process, with all the issues around that.

ndmitchell commented 7 years ago

OK, I'll make a release on that later tonight.

ndmitchell commented 7 years ago

hoogle-5.0.11 released.