Ormolu.Diff.Text

fourmolu-0.17.0.0: A formatter for Haskell source code

Safe Haskell | None
Language | GHC2021

Ormolu.Diff.Text

Description

This module allows us to diff two `Text` values.

Synopsis

- data TextDiff
- diffText :: Text -> Text -> FilePath -> Maybe TextDiff
- selectSpans :: [RealSrcSpan] -> TextDiff -> TextDiff
- printTextDiff :: TextDiff -> Term

# Documentation

data TextDiff #

Result of diffing two `Text`s.

#### Instances

Instances details

Show TextDiff # |
Instance details Defined in Ormolu.Diff.Text Methods showsPrec :: Int -> TextDiff -> ShowS # show :: TextDiff -> String # showList :: [TextDiff] -> ShowS #
Eq TextDiff # |
Instance details Defined in Ormolu.Diff.Text Methods (==) :: TextDiff -> TextDiff -> Bool # (/=) :: TextDiff -> TextDiff -> Bool #

diffText #

Arguments

:: Text | Text before
-> Text | Text after
-> FilePath | Path to use
-> Maybe TextDiff | The resulting diff or `Nothing` if the inputs are identical

Diff two texts and produce a `TextDiff`.

selectSpans :: [RealSrcSpan] -> TextDiff -> TextDiff #

Select certain spans in the diff (line numbers are interpreted as belonging to the “before” state). Only selected spans will be printed.

printTextDiff :: TextDiff -> Term #

Print the given `TextDiff` as a `Term` action. This function tries to mimic the style of `git diff`.