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-0.2.1.3-52609aae380c8c08777556235df49748f579e541c5b673cf31fe54690e95d0fe","-lHSpandoc-lua-marshal-0.2.5-0deef7d815299deb5526d783f5979edc594f47f77130efe42c050d8dd42808b5","-lHSpandoc-3.1.12.3-7bf0fdb61fdac230510fda8324ad776ac5a69eee0f814e2e17998bbe84dff329","-lHStypst-0.5.0.2-b9796e3e10c07b2c38928c04123eb3e7fd7e3a9ccede0d6201661266460fd63a","-lHSyaml-0.11.11.2-e0c43579003ce03fba014edc98f3d5904aeb40bc1cf95f38aac7a89cafa80cae","-lHSlibyaml-0.1.4-92b1a3458081e5f4498d0f0fdfa3b4e8cfb67c5b5287400da56162f66835b6f4","-lHSlibyaml-clib-0.2.5-614a97b700b9c01920bafbc8ae0186891e625529c2d9b802e1c5590db65826d2","-lHStoml-parser-2.0.0.0-fe078bf1e7c3d14f1de06c8315bf5fc81cdefecd4f4dd236e5c3737bd560c2f3","-lHSprettyprinter-1.7.1-dfb64044a224449573283d83bd6d502ad28b8e31f614e8dc5aca87385604ee15","-lHSregex-tdfa-1.3.2.2-95bf08b377f19bfaef8de29944627e2c5ab1476ca3dd5af9cbcf334dc5c11999","-lHSregex-base-0.94.0.2-3b936b536af7032b8d3ba6c4afabc9a947edc43d454b188a4ae9d4d7e26d0750","-lHSordered-containers-0.2.3-0847dd85ed47ea6614302f67f376356d83975aa18a4b6b4014283ca6a8e215bf","-lHScassava-0.5.3.0-b7d816b0b38d5
...
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-0.2.1.3
pandoc-lua-marshal-0.2.5
pandoc-3.1.12.3
typst-0.5.0.2
yaml-0.11.11.2
...
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.