Skip to content

An exceptionfree readFile or filtering for -xc

Motivation

In order to reduce the amount of lines in the logs that are false positives, I'd like to have a version of base's readFile that does not log exceptions. The current readFile uses ioe_eof (IIRC) to exit, and this means that if you run with +RTS -xc -RTS, an error is output to the logs.

To get past this I created a library called exceptionfree-readfile (suggestions/issues/PRs welcome, perf is 1x-10x worse than the code in base), but it was mentioned that I should submit this to the issue tracker to see if there's another way people work around it/a better way.

Alternatively a way to filter the modules that are captured by -xc would be much easier way to solve this problem -- as my goal was reducing the amount of false positives that showed up in the logs (a few libraries use exceptions in this way).

Related links/background:

Proposal (2 alternatives)

Updating base with a readFileEither

A function called readFileEither :: FilePath -> IO (Either IOError String) is created and added to base

Adding an option like --xc-ignored-modules to GHC

An option like --xc-ignored-modules is added that contains a list of modules that are checked when -xc-related logging is done, to ignore certain modules.

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