generic-diff
Safe HaskellSafe-Inferred
LanguageHaskell2010

Generics.Diff.Special.List

Description

Diffs on lists as a special case. See Generics.Diff.Special for a detailed explanation of the implementation.

Synopsis

Documentation

data ListDiffError a Source #

If we did a normal gdiff on a linked list, we'd have to recurse through one "level" of Diffs for each element of the input lists. The output would be really hard to read or understand. Therefore this type lets us treat lists as a special case, depending on how they differ.

Constructors

DiffAtIndex Int (DiffError a)

If we find a difference when comparing the two lists pointwise, we report the index of the error and the error caused by the elements at that index of the input lists.

WrongLengths Int Int

The two lists have different lengths. If we get a WrongLengths instead of an Equal or a DiffAtIndex , we know that one of the lists must be a subset of the other.

Instances

Instances details
Show (ListDiffError a) Source # 
Instance details

Defined in Generics.Diff.Type

Eq (ListDiffError a) Source # 
Instance details

Defined in Generics.Diff.Type

diffListWith :: (a -> a -> DiffResult a) -> [a] -> [a] -> Maybe (ListDiffError a) Source #

Given two lists and a way to diff the elements of the list, return a ListDiffError. Used to implement specialDiff for list-like types. See Generics.Diff.Special for an example.

Orphan instances