Skip to content

-no-keep-*-files pragmas apparently ineffective

Summary

-no-keep-hi-files and -no-keep-o-files are ignored when they appear in pragmas at the top of source files.

Steps to reproduce

Save this program as hello.hs:

{-# OPTIONS_GHC -no-keep-hi-files #-}
{-# OPTIONS_GHC -no-keep-o-files #-}

main :: IO ()
main = putStrLn "hello world"

then run ghc -dynamic hello.hs.

Expected behavior

Create an executable file hello and not create hello.hi and hello.o

Environment

  • GHC --version: The Glorious Glasgow Haskell Compilation System, version 9.0.2
  • uname -a: Linux eddie 5.16.16-arch1-1 #1 (closed) SMP PREEMPT Mon, 21 Mar 2022 22:59:40 +0000 x86_64 GNU/Linux

Relevant documentation

Section 5.6.5 of the User's Guide documents these flags as "dynamic" -- i. e. they can be invoked anywhere, including from pragmas within source files.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information