
I want to have a hierarchy of modules for a local project. Not submitting it to Hackage yet. I just want to refer to my local modules as Basics.CSound Basics.Node Algo.Fux etc. how does one set this up? Thanks, Mike

Am Samstag 31 Oktober 2009 13:32:51 schrieb Michael Mossey:
I want to have a hierarchy of modules for a local project. Not submitting it to Hackage yet. I just want to refer to my local modules as
Basics.CSound Basics.Node Algo.Fux
etc.
how does one set this up?
Top directory: project.cabal, Setup.hs (module Main where main = defaultMain) Subdirectry Basics: File CSound.hs (module Basics.CSound (exports) where...) File Node.hs (module Basics.Node (exports where...) Subdirectory Algo: File Fux.hs (module Algo.Fux (exports) where...) cd Top directory cabal install
Thanks, Mike

What if he wanted to separately have test code? e.g. Sources and Tests each
containing identical hierarchies described above. I know cabal has an option
for source directory. It appears something like [1] can be use to run all
tests, though I haven't yet looked into the details of how each file needs
to be structured so that all tests are detected (if, e.g., your using
quickcheck to implement your tests). Ideally, from the root directory I
would want to be able to do cabal install or cabal test.
[1] http://hackage.haskell.org/package/cabal-test
--
Steven
On Sat, Oct 31, 2009 at 7:54 AM, Daniel Fischer
Am Samstag 31 Oktober 2009 13:32:51 schrieb Michael Mossey:
I want to have a hierarchy of modules for a local project. Not submitting it to Hackage yet. I just want to refer to my local modules as
Basics.CSound Basics.Node Algo.Fux
etc.
how does one set this up?
Top directory: project.cabal, Setup.hs (module Main where main = defaultMain) Subdirectry Basics: File CSound.hs (module Basics.CSound (exports) where...) File Node.hs (module Basics.Node (exports where...) Subdirectory Algo: File Fux.hs (module Algo.Fux (exports) where...)
cd Top directory cabal install
Thanks, Mike
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Hi Daniel, Thanks for the information. However, does this work for a test-compile-debug cycle, or for a modify-interpret cycle? These modules would all be in development. I don't like the idea that I have to 'cabal install' after any change to any module. Is that necessary? Thanks, Mike Daniel Fischer wrote:
Am Samstag 31 Oktober 2009 13:32:51 schrieb Michael Mossey:
I want to have a hierarchy of modules for a local project. Not submitting it to Hackage yet. I just want to refer to my local modules as
Basics.CSound Basics.Node Algo.Fux
etc.
how does one set this up?
Top directory: project.cabal, Setup.hs (module Main where main = defaultMain) Subdirectry Basics: File CSound.hs (module Basics.CSound (exports) where...) File Node.hs (module Basics.Node (exports where...) Subdirectory Algo: File Fux.hs (module Algo.Fux (exports) where...)
cd Top directory cabal install
Thanks, Mike
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Am Samstag 31 Oktober 2009 18:19:24 schrieb Michael Mossey:
Hi Daniel,
Thanks for the information. However, does this work for a test-compile-debug cycle, or for a modify-interpret cycle? These modules would all be in development. I don't like the idea that I have to 'cabal install' after any change to any module. Is that necessary?
No, that would be the step when develpment is done (for the time being). While developing, have the same source-tree (you can add the .cabal file and Setup.hs later) and just work in ghci (compile what's not currently being worked on, so the code runs faster). I can't guarantee that it works everywhere and with all versions of GHC, but it works here.
Thanks, Mike
Daniel Fischer wrote:
Am Samstag 31 Oktober 2009 13:32:51 schrieb Michael Mossey:
I want to have a hierarchy of modules for a local project. Not submitting it to Hackage yet. I just want to refer to my local modules as
Basics.CSound Basics.Node Algo.Fux
etc.
how does one set this up?
Top directory: project.cabal, Setup.hs (module Main where main = defaultMain) Subdirectry Basics: File CSound.hs (module Basics.CSound (exports) where...) File Node.hs (module Basics.Node (exports where...) Subdirectory Algo: File Fux.hs (module Algo.Fux (exports) where...)
cd Top directory cabal install
Thanks, Mike

Hello Mike An option I like is to put the main project files in a top level directory called src, so your organization would look like this: ./src/Algo/Fux.hs ./src/Basics/CSound.hs ./src/Basics/Node.hs I usually have a running example which has imports for all the files in the project inside a top level folder called demo... ./demo/ImportAll.hs For a GHCi session, I cd to $PROJECT/demo then
ghci
Prelude> set -i../src This is the useful bit of having all the project files under the src hierarchy - the search path is very simple. During development adding the files needed for cabal (Setup.hs, project.cabal...) is still worthwhile - you can then generate Haddock docs very easily. If you used Haddock in standalone mode you would have to supply a few flags to tell which files to document and where to put the output. Each time you add or remove a module in the src tree, you should re-run configure...
runhaskell Setup.hs configure runhaskell Setup.hs haddock
but as your GHCi session is always using the interpreted project source you don't need to run 'runhaskell Setup.hs build' and 'runhaskell Setup.hs install'. Best wishes Stephen
participants (4)
-
Daniel Fischer
-
Michael Mossey
-
Stephen Tetley
-
Steven Cummings