| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Generics.Diff.Special.List
Contents
Description
Diffs on lists as a special case. See Generics.Diff.Special for a detailed explanation of the implementation.
Synopsis
- data ListDiffError a
- = DiffAtIndex Int (DiffError a)
- | WrongLengths Int Int
- diffListWith :: (a -> a -> DiffResult a) -> [a] -> [a] -> Maybe (ListDiffError a)
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 |
Instances
| Show (ListDiffError a) Source # | |
Defined in Generics.Diff.Type Methods showsPrec :: Int -> ListDiffError a -> ShowS # show :: ListDiffError a -> String # showList :: [ListDiffError a] -> ShowS # | |
| Eq (ListDiffError a) Source # | |
Defined in Generics.Diff.Type Methods (==) :: ListDiffError a -> ListDiffError a -> Bool # (/=) :: ListDiffError a -> ListDiffError a -> Bool # | |
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
| Diff a => SpecialDiff (NonEmpty a) Source # | |
Associated Types type SpecialDiffError (NonEmpty a) Source # Methods specialDiff :: NonEmpty a -> NonEmpty a -> Maybe (SpecialDiffError (NonEmpty a)) Source # renderSpecialDiffError :: SpecialDiffError (NonEmpty a) -> Doc Source # | |