Currently cabal list foo only looks at the available packages and not at the installed ones.
The cabal list command output needs improving. It currently lists all available versions of available (but not installed) packages. That's both too much and too little info. We want to know for each matching package the installed versions and we probably do not need to know every single available version.
There are already RepoIndex and LocalIndex types for doing lookups so this task is just to format the information nicely. See the Hackage.List module in cabal-install.
For reference you might like to look at what other similar tools do. For example Gentoo's esearch utility gives us:
$ esearch xmonad
[ Results for search key : xmonad ]
[ Applications found : 2 ]
* x11-wm/xmonad
Latest version available: 0.5-r1
Latest version installed: 0.5
Size of downloaded files: [no/bad digest]
Homepage: http://www.xmonad.org/
Description: A lightweight X11 window manager
License: BSD
* x11-wm/xmonad-contrib
Latest version available: 0.5-r1
Latest version installed: [ Not Installed ]
Size of downloaded files: [no/bad digest]
Homepage: http://www.xmonad.org/
Description: Third party extentions for xmonad
License: BSD