[Haskell-cafe] runghc and linking in libraries

Brian Sammon haskell-cafe at brisammon.fastmail.fm
Thu Jul 20 06:25:09 UTC 2017

If I want to have (and run without explicitly invoking ghc or runghc) a script that starts as follows:
    module Main where
    import MyLib

I can do it just fine if MyLib is a pure-haskell MyLib.hs -- it doesn't have to be packaged or installed or anything complicated.

If I want to create a MyLib that uses C code (that I wrote) through FFI, it doesn't seem to be possible to use it in a runghc script like this, unless I create a package and install it.  Am I correct about this?

In the course of researching this, I realized that I have a rather poor understanding of what "packages" are in ghc-land.  I have a 
high-level-overview understanding ("It's like rubygems, but for haskell"), but I'm rather unclear about the nuts-and-bolts of it.
The tight coupling between packages and the ghc core is rather different than what I've seen in other programming languages I've used (I haven't programmed in Java though) 

It would be useful if ghc had an argument to take a "MyLib.lib" file (or maybe a directory) and temporarily act like it's an installed package for the one invocation.

Unsurprisingly, web-searching for "haskell" and "package" doesn't give me the focused result set that I want.
I found the relevant section of the GHC Users Guide
but links to other reading materials would be appreciated.

More information about the Haskell-Cafe mailing list