Pragmas for FFI imports

Einar Karttunen ekarttun at cs.helsinki.fi
Tue Feb 21 13:13:52 EST 2006


On 21.02 16:50, Simon Marlow wrote:
> I lost the argument for include files, but this is why libraries cannot
> currently be specified inside source files.  Back in the FFI discussion,
> we didn't have Cabal, but now that we do, Cabal is the natural place to
> specify these things.

Cabal is a good place, but does not handle very well optional 
dependencies that most programs linking against the library 
don't need.

> I don't understand this - surely if you just put those two modules in
> separate packages, then everything works?  Or is it that you don't want
> to do that?

Think about a database library supporting e.g. mysql, postgresql,
sqlite and odbc. Now it needs six packages to do this:
1) foo-common for common code that does not import any of the implementations
2) foo-mysql (depends on 1)
3) foo-pgsql (depends on 1)
4) foo-sqlit (depends on 1)
5) foo-odbc  (depends on 1)
6) foo (this has a connect function which uses any of the above, thus
   depends on 1, 2, 3, 4, 5)

I don't consider this very good design and in practise this is quite
tedious for the library writer.

- Einar Karttunen


More information about the Haskell-prime mailing list