Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,313
    • Issues 4,313
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 385
    • Merge Requests 385
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #4063

Closed
Open
Opened May 11, 2010 by beroal@trac-beroal

target "is not a module name or a source file"

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 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.

Trac metadata
Trac field Value
Version 6.12.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#4063