Export functions for extracting exported declarations

Move functions for extracting exported declarations out of psc-docs and
into Language.PureScript so that they may be used in other programs,
such as Pursuit.

Refs purescript/pursuit#1
Should this function refer to `exported` rather than `ds` throughout? At the moment it seems that if a module includes type declarations but doesn't export them, a heading will be rendered but it will have nothing underneath it.