HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulesydtest-mutation-runtime-0.2.0.0Haskell2010

Test.Syd.Mutation.Manifest.Render

Colored text rendering for MutationRecord / MutationManifest.

Shared between the plugin's manifest-emission step (which writes a .txt next to each .json) and the test runner's surviving-mutation report. See renderMutationRecord for the unit of rendering.

  • 9 values

Render a single MutationRecord as a header line followed by either:

  • a unified diff body, when the record carries mutRecSourceLines / mutRecMutatedLines / context, or

  • a one-line - original / + replacement fallback when source lines are not available (e.g. mutations whose source span was UnhelpfulSpan and so the plugin couldn't extract any line text).

The header is operator at file:line:colStart-colEnd[ #variant], matching the existing surviving-mutation report so reviewers see a single consistent format whether they look at the runtime report or the per-module manifest .txt.

Render every record in a manifest, one per group with a blank line in between. The leading argument is the module name, used for the top-of-file header.

The header is followed by a count line ("N mutations in M groups") so an empty manifest doesn't look like a rendering accident, and so reviewers can sanity-check the totals at a glance.

Records appear in manifest order (which mirrors plugin discovery order); the renderer makes no attempt to re-sort.

Write the rendered manifest to dir/moduleName.txt with 8-bit ANSI escapes embedded. Reviewers can read with cat foo.txt or less -R foo.txt.

Writes UTF-8 bytes directly, like the driver's report.txt: the rendering embeds source lines verbatim, so it carries whatever characters the mutated module contains, and the plugin runs in build sandboxes where the locale's encoding is not UTF-8.

An empty manifest still produces a file (containing just the module header) so the directory keeps a 1:1 correspondence between .json and .txt entries.

valuerenderUnifiedDiff
  1. :: Int
  2. -> [Text]
  3. -> [Text]
  4. -> [Text]
  5. -> [Text]
  6. -> [[Chunk]]
#

Render a unified-diff hunk with intra-line colouring. Used by both renderMutationRecord and the runtime mutation report.

startLine is the 1-based source line of the first srcLines entry; the @@@ -a,b +c,d @@ header is computed from there and the lengths of context, source, and mutated lines.

Colour helpers (also used by sydtest)

5 declarations
valuedelColour :: Colour
#

Foreground colour used on deletion lines (the "-" side of a diff). Plain red rather than a 256-colour shade so each terminal applies its own palette.

valueaddColour :: Colour
#

Foreground colour used on addition lines (the "+" side).

Emphasise an intra-line changed substring. Non-whitespace text gets bold + the brighter shade of the side's colour, so it stands out within a line that is otherwise foreground-coloured with the dull shade. Whitespace-only text has no glyph to colour, so fill the background instead.