[Haskell-cafe] Run time module definition file location information?

11 views
Skip to first unread message

David Banas

unread,
Nov 25, 2015, 9:13:08 AM11/25/15
to Haskell Cafe
Hi all,

How can I get a running Haskell program to tell me where it’s looking, in order to satisfy “import …” statements?

Thanks,
-db

_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

David Kraeutmann

unread,
Nov 25, 2015, 10:43:02 AM11/25/15
to David Banas, Haskell Cafe (haskell-cafe@haskell.org)

Imports are resolved at compile time and linked statically into the executable unless you tell GHC to use dynamic linking. In that case, `ldd` will tell you the files it's linked against. In any case, that information is unavailable at runtime.

Note that generally static linking is preferred over dynamic linking.

Silvio Frischknecht

unread,
Nov 25, 2015, 10:51:48 AM11/25/15
to haskel...@haskell.org
> How can I get a running Haskell program to tell me where it’s looking, in order to satisfy “import …” statements?

Short answer: You can't.

Long answer:
Everything is imported at compile time. GHC for instance usually links
all imports statically. I.e. no files will be opened for the import
statements. The only dynamically linked libraries are libc, posix, ...


Maybe if you clarify what you want to do, I can be more helpful.

Cheers

Silvio
Reply all
Reply to author
Forward
0 new messages