By: Tom Sydney Kerckhove <syd@cs-syd.eu>
Add fine-grained mutation instrumentation exceptions
Introduces five granularities of exception, from coarsest to finest:
- Disable a mutation type globally via Nix: disabledMutations = ["Arith"]
- Disable all mutations on a module: {-# ANN module ("DisableMutations" :: String) #-}
- Disable specific mutation types on a module: {-# ANN module ("DisableMutations: Arith, BoolLit" :: String) #-}
- Disable all mutations on a function: {-# ANN f ("DisableMutations" :: String) #-}
- Disable specific mutation types on a function: {-# ANN f ("DisableMutation: Arith" :: String) #-}
String annotations require no import. The plugin reads them via GHC's
annotation infrastructure (tcg_ann_env / findAnns deserializeWithData).
Per-function filtering uses local on the ReaderT env inside instrumentBind.
Nix: addManifest, mutationCheck, and makeMutationReport all accept
disabledMutations, passed through as --disable-mutation= plugin opts.
Example modules ExceptionLib and FunctionExceptionLib demonstrate each
annotation form with accompanying tests.