[Haskell-cafe] totally confused about Haskell namespace issue conventions

Magnus Therning magnus at therning.org
Sun Jun 7 05:47:28 EDT 2009

Vasili I. Galchin wrote:
> Hello,
>       Should namespace designation be specified in modules or in the 
> .cabal file? Or to put it another way should a relative namespace be 
> specified in a Haskell module and the remaining "top" part be specified 
> in the associated .cabal file? Of course, yes/no answers are probably 
> not sufficient ... i.e. please elaborate.

This is my, probably incomplete, understanding of how things work.

The module statement at the top of a Haskell source file should contain the 
complete name, e.g.

     module Foo.Bar.Baz

If you use GHC directly to build (e.g. using --make) then it will look for the 
module above at $x/Foo/Bar/Baz.hs, where $x is on of the paths where GHC has 
been told to look (e.g. using -i).

In a Cabal file you mention the complete names of module you use/build (e.g. 
Foo.Bar.Baz above).  Hs-Source-Dirs adds directories to the paths where GHC 
looks for modules ($x above).


Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090607/472a142a/signature.bin

More information about the Haskell-Cafe mailing list