3

Is it possible to get the compiler args programmatically in Haskell?

I am writing a stack trace formatting library and I would find it very useful to know if "-prof" and "-fprof-auto" were used when compiling.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Michael Lafayette
  • 2,972
  • 3
  • 20
  • 54
  • As far as I know, no. There's an interface for RTS options, but none for compiler options. – Zeta Feb 15 '16 at 06:18

1 Answers1

1

Perhaps GHC.RTS.Flags.getProfFlags provides enough information?

No profiling:

ProfFlags {doHeapProfile = NoHeapProfiling, 
           heapProfileInterval = 100000000, heapProfileIntervalTicks = 10,
           includeTSOs = False, showCCSOnException = False, 
           maxRetainerSetSize = 0, ccsLength = 0, modSelector = Nothing, 
           descrSelector = Nothing, typeSelector = Nothing, ccSelector = Nothing,
           ccsSelector = Nothing, retainerSelector = Nothing, bioSelector = Nothing}

With -prof:

ProfFlags {doHeapProfile = NoHeapProfiling, heapProfileInterval = 100000000,
           heapProfileIntervalTicks = 100, includeTSOs = False,
           showCCSOnException = False, maxRetainerSetSize = 107374182408,
           ccsLength = 25, modSelector = Nothing, descrSelector = Nothing, 
           typeSelector = Nothing, ccSelector = Nothing, ccsSelector = Nothing,
           retainerSelector = Nothing, bioSelector = Nothing}

I guess that these are dynamic parameters, but they seem to be affected by -prof. So, perhaps it's enough for your purposes (?)

chi
  • 111,837
  • 3
  • 133
  • 218