On Thu, Jul 20, 2017 at 2:25 AM, Brian Sammon <haskell-cafe@brisammon.fastmail.fm> wrote:
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?

You would have to explicitly link it in: runghc Foo.hs bar.o (or -lbar if it's a library). It's not really designed for anything larger than a single source file without non-package dependencies.

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)

Have you programmed in C, especially with heavy use of inline or CPP? The cause of the tight dependencies is that ghc inlines a lot of things, even across modules; which means that even parts of a module that aren't explicitly exported are generally visible for inlining. And performance will suck if you defeat this.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net