[Haskell-beginners] Cabal modules and directories

Daniel Fischer daniel.is.fischer at web.de
Wed Mar 3 14:19:24 EST 2010


Am Mittwoch 03 März 2010 19:57:13 schrieb Rehno Lindeque:
> I'm sorry because this is a very elementary question but despite my
> attempts I can't seem to get cabal working for my project structure.
>
> I have two main source directories:
>   src\haskell
>   src\semanticdb
>
> Inside src\haskell I have main.hs with the module Main.
> Inside src\semanticdb I have semanticdb.hs with module OSIX.SemanticDB

module OSIX.SemanticDB

must be in the file 'SemanticDB.hs' (or .lhs), in the subdirectory OSIX of 
the source directory listed in the .cabal file, here src/semanticdb, so

file:

src/semanticdb/OSIX/SemanticDB.hs

>
> My cabal file contains the following 3 lines:
>   main-is: main.hs
>   hs-source-dirs: src/haskell src/semanticdb
>   other-modules: OSIX.SemanticDB

That is in an executable-stanza,

executable whatever
  main-is:   ...

, right?

>
> Then when I build with 'cabal build'

Did you `cabal configure` before?

> I get the following error:
>   cabal: can't find source for OSIX.SemanticDB in src/haskell,
> src/semanticdb, dist/build/autogen
>
> cabal --version gives:
>   cabal-install version 0.6.4
>   using version 1.6.0.3 of the Cabal library
>
> I'd prefer to keep my directory structure as is if possible, but it
> doesn't seem to be working for me... Is there anything I can do or
> should I just restructure the directories?
> (NOTE: I'm using leksah as my IDE, so the cabal file is mostly generated
> automatically)
>
> Thanks,
> -Rehno



More information about the Beginners mailing list