#4063: target "is not a module name or a source file"
---------------------------------+------------------------------------------
    Reporter:  beroal            |       Owner:                                 
    
        Type:  feature request   |      Status:  new                            
    
    Priority:  normal            |   Component:  Compiler                       
    
     Version:  6.12.2            |    Keywords:  target,module name,source 
file,flag
          Os:  Unknown/Multiple  |    Testcase:                                 
    
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown                   
    
---------------------------------+------------------------------------------
 Create a standalone Haskell program "/tmp/delme.hs". Then do

 {{{
 $ cd /tmp
 {- 0 -}$ ghc --make -o delme.exe /tmp/delme.hs
 [1 of 1] Compiling Main ( /tmp/delme.hs, /tmp/delme.o )
 Linking delme.exe ...
 $ rm delme.o
 {- 1 -}$ ghc --make -o delme.exe /tmp/delme
 [1 of 1] Compiling Main ( /tmp/delme.hs, /tmp/delme.o )
 Linking delme.exe ...
 $ rm delme.o
 $ mv delme.hs delme
 {- 2 -}$ ghc --make -o delme.exe /tmp/delme
 target `/tmp/delme' is not a module name or a source file
 }}}

 We see that:[[BR]]
 - in "1" GHC compiles "/tmp/delme.hs" though I say "/tmp/delme";[[BR]]
 - in "2" GHC can not see file "/tmp/delme".

 The problem is that a target (the last argument) may be a module name or a
 source file. GHC uses heuristics to determine this. Though heuristics may
 seem neat and clever, they draw GHC more '''intricate and unpredictable'''
 (see also [http://en.wikipedia.org/wiki/KISS_principle KISS]).

 I encountered this intricacy when ran "ghc" on a shell script. Shell
 scripts in Unix commonly do not have extensions, because interpreter name
 is included in a shell script. And "runghc" runs them fine. "ghc" in
 theory also does not require a file to have an extension because it
 clearly contains Haskell source code — what else?

 I propose to introduce a GHC flag which says explicitly which type a
 target is of.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4063>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to