ormolu-0.7.2.0: A formatter for Haskell source code

Safe Haskell | Safe-Inferred
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 Source #

Result of diffing two `Text`s.

#### Instances

Instances details

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

diffText Source #

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 Source #

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 Source #

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