What is the canonical way to exchange modules between projects?

Suppose there are three projects A, B and C. The modules in C will be separated by A and B. Since Java does not have CLASSPATH, then do we need to use the absolute path when importing modules from C?

Any suggestion appreciated!

+6
source share
3 answers

The canonical way is to carefully choose where they should sit in the module hierarchy, and turn each project into a fully functional Cabal package, and then install them locally so that they are part of the namespace for your compiler locally.

Thus, each module is available for any source code that you write.

If (for example) you use the leksah IDE, this will do most of the work for you.

+7
source

I urge you to block your projects .

But if for some reason you do not want to do this, then the closest thing to the java -i class path is to switch to ghc . Please note that the current directory must be displayed explicitly in the list.

+8
source

If by β€œprojects” you mean Cabal packages, the standard task is to export any modules from C, and then A and B depend on C and import them. It is not good for the source files in a package to directly depend on files that are not part of this package.

+4
source

All Articles