[Haskell-cafe] Still having problems building a very simple "Executable" ....

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Sat Jun 6 21:43:10 EDT 2009


Hi Vasili,

Vasili I. Galchin wrote:
> I picked an exceedingly case to build an "Executable":
> 
> Executable         QNameTest
>    Hs-source-dirs: Swish/
>    Main-Is:        HaskellUtils/QNameTest.hs
>    Other-Modules:  HaskellUtils.QName

I'm not sure what you did; the original Swish code doesn't have any
hierarchical modules. Starting with that, I could build QNameTest like
this:

    executable QNameTest
        hs-source-dirs: HaskellUtils HaskellRDF HaskellRDF/HUnit
        main-is: QNameTest.hs
        other-modules: HUnitLang HUnitBase HUnitText QName QNameTest
        build-depends: base, haskell98
        ghc-options: -main-is QNameTest

The trick here is to list all used subdirectories in hs-source-dirs;
the module HUnit for example will be found in HaskellRDF/HUnit/ under
the name HUnit.lhs.

If you have a module A.B.C then the source file should be in
  foo/A/B/C.hs (or lhs or some other recognized extension)
and foo should be listed in hs-source-dirs.

Also note the ghc-options line: it tells ghc to use QNameTest instead of
Main for the main module.

I also managed to produce a Swish executable after a bit of tweaking;
you can find my changes in

    http://int-e.home.tlink.de/haskell/Swish.diff

The cabal file is at the end of the diff.

HTH,

Bertram

P.S. I took Swish code from here:
    http://www.ninebynine.org/RDFNotes/Swish/Intro.html#SwishLinks


More information about the Haskell-Cafe mailing list