Is there any simple way for a program to retrieve a list of installed packages (such as ghc-pkg list returns), or would it be easier to execute phc-pkg as an external process and catch the output?