Opened 10 years ago

Last modified 2 months ago

#2550 new feature request

Add an option to read file names from a file instead of the command line

Reported by: YitzGale Owned by:
Priority: lowest Milestone:
Component: Package system Version: 6.9
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #2551 Differential Rev(s):
Wiki Page:

Description

As discussed in the following thread:

http://www.haskell.org/pipermail/haskell-cafe/2008-August/046494.html

Add an option to look for modules using manifest files, rather than assuming that the filesystem contains a hierarchy of directories that exactly matches the module hierarchy.

This is desirable for the following reasons:

  • It avoids an ugly and ad hoc dependency between two unrelated domains.
  • In large and complex projects, it allows the project manager more flexibility in using directory structure to organize teams and manage complex version control setups.
  • It avoids problems caused by mismatch between the filesystem and the module hierarchy, such as a non-hierarchical file system or incompatibilities in the way files are named.
  • It allows for more than one module per file. This is helpful because the module system is the only way to achieve encapsulation in Haskell, so the system needs to be as lightweight and flexible as possible. It also makes it easier to share and distribute Haskell programs when it is most convenient to do so as a single file, such as literate Haskell via email.

Change History (18)

comment:1 Changed 10 years ago by simonmar

difficulty: Unknown

You can choose your own mapping between filenames and module names as long as you tell GHC about all the filenames in your project. For example:

$ cat >Foo.Burble.hs
module Foo.Burble where
$ cat >Bar.Mumble.hs 
module Bar.Mumble where
import Foo.Burble
$ cat >MyProg.hs
module Main where
import Foo.Burble
import Bar.Mumble
main = print "hello"
$ ghc --make MyProg.hs Foo.Burble.hs Bar.Mumble.hs 
[1 of 3] Compiling Foo.Burble       ( Foo.Burble.hs, Foo.Burble.o )
[2 of 3] Compiling Bar.Mumble       ( Bar.Mumble.hs, Bar.Mumble.o )
[3 of 3] Compiling Main             ( MyProg.hs, MyProg.o )
Linking MyProg ...

So your "manifest" might just be a list of filenames that you pass to ghc using ghc --make `cat manifest`.

This doesn't let you put multiple modules in one file, of course. Also, I don't think you can do this with Cabal (or maybe you can?).

comment:2 Changed 10 years ago by YitzGale

Summary: Add an option to use manifest files instead of filesystem hierarchy to find modulesAdd an option to read file names from a file instead of the command line

Nice. Could this be documented in sections 5.6.1 and 5.6.3 of the manual please?

There could be too many file names to be able to specify them on the command line. So it still would be useful to have an option to specify the file names in a file.

Multiple modules per file now sounds like an orthogonal issuse, I'll open a separate request for that. And yes, Cabal support is another orthogonal issue.

So it now sounds like this feature should be easy to do.

comment:3 Changed 10 years ago by YitzGale

Having an option to read file names from a file is also less platform dependent - the backticks trick is specific to Unix-like shells.

comment:4 Changed 10 years ago by igloo

Milestone: 6.12 branch

comment:5 Changed 10 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:6 Changed 10 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:7 Changed 9 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:8 Changed 9 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:9 Changed 8 years ago by igloo

Milestone: 7.0.17.0.2

comment:10 Changed 8 years ago by igloo

Milestone: 7.0.27.2.1

comment:11 Changed 7 years ago by igloo

Milestone: 7.2.17.4.1

comment:12 Changed 7 years ago by igloo

Milestone: 7.4.17.6.1
Priority: lowlowest

comment:13 Changed 6 years ago by igloo

Milestone: 7.6.17.6.2

comment:14 Changed 5 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:15 Changed 4 years ago by thomie

Component: CompilerPackage system
Milestone: 7.10.17.12.1
Type of failure: None/Unknown

comment:16 Changed 3 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:17 Changed 3 years ago by thomie

Milestone: 8.0.1

comment:18 Changed 2 months ago by f-a

This would of course greatly mitigate the pain of Template Hakell stage restrictions, too.

Note: See TracTickets for help on using tickets.