GHC embeds linker flags into the final ELF binary:

$ readelf --wide -p '.debug-ghc-link-info' $(which pandoc)

String dump of section '.debug-ghc-link-info': [ 5] N [ c] GHC link info [ 1c] ((["-lHSpandoc-lua-engine-","-lHSpandoc-lua-marshal-0.2.5-0deef7d815299deb5526d783f5979edc594f47f77130efe42c050d8dd42808b5","-lHSpandoc-","-lHStypst-","-lHSyaml-","-lHSlibyaml-0.1.4-92b1a3458081e5f4498d0f0fdfa3b4e8cfb67c5b5287400da56162f66835b6f4","-lHSlibyaml-clib-0.2.5-614a97b700b9c01920bafbc8ae0186891e625529c2d9b802e1c5590db65826d2","-lHStoml-parser-","-lHSprettyprinter-1.7.1-dfb64044a224449573283d83bd6d502ad28b8e31f614e8dc5aca87385604ee15","-lHSregex-tdfa-","-lHSregex-base-","-lHSordered-containers-0.2.3-0847dd85ed47ea6614302f67f376356d83975aa18a4b6b4014283ca6a8e215bf","-lHScassava- ...

We can use the above to get library version info, splitting into fields based on commas and extracting with a simple-minded regular expression, viz.

$ readelf -p '.debug-ghc-link-info' $(which pandoc) | \ ja -R, '.?{|`0 ~* 1 /-lHS([A-Aa-z][A-Za-z0-9\-]*\d+(\.\d+)*)/}' pandoc-lua-engine- pandoc-lua-marshal-0.2.5 pandoc- typst- yaml- ...

This uses Jacinda's ~* : Str -> Int -> Regex -> Option Str to specify the first capture group.

That the shell can present library versions is almost miraculous: operating system tools output text, pipes supply this as input to another program, and adroit use of regular expressions filters and presents this text.

This is tortuous and ill-defined, but the interactivity makes this excusable. In any case, no IDE offers such a feature; one sees why Unix endures.