Skip to content

ghc with incorrect arguments deletes source file

I'm just learning haskell and I mistakenly passed the -o argument to ghc instead of -c. When combined with the -i argument (which I also mistakenly supplied, thinking of ghci), this unlinks the file named by -o.

This is certainly a case of PEBKAC, but ghc should probably do something other than unlinking the file.

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.3
$ ls path/to/
source.hs
$ ghc -i . -o path/to/source.hs 
/usr/bin/ld: cannot find .: File format not recognized
collect2: ld returned 1 exit status
$ ls path/to/
$
Trac metadata
Trac field Value
Version 7.0.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information