| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Generics.Diff.Special.Map
Contents
Description
A worked example of implementing SpecialDiff (and thereby Diff) for Maps.
We make the choice to prioritise speed over exhaustiveness: in other words we stop when we find one difference between the two input maps. Alternatively, we could have gone the other way and enumerated all the difference between the inputs, using some kind of intersection test. This is left as an exercise for the reader.
Synopsis
- data MapDiffError k v
- = DiffAtKey k (DiffError v)
- | LeftMissingKey k
- | RightMissingKey k
Documentation
data MapDiffError k v Source #
For Maps, we only pick out (maximum) one difference between the two inputs. There are three possibilities:
Constructors
| DiffAtKey k (DiffError v) | A key is found in both maps, but they have different values. |
| LeftMissingKey k | The right set contains an element that isn't found in the left set |
| RightMissingKey k | The left set contains an element that isn't found in the right set |
Instances
| Show k => Show (MapDiffError k v) Source # | |
Defined in Generics.Diff.Special.Map Methods showsPrec :: Int -> MapDiffError k v -> ShowS # show :: MapDiffError k v -> String # showList :: [MapDiffError k v] -> ShowS # | |
| Eq k => Eq (MapDiffError k v) Source # | |
Defined in Generics.Diff.Special.Map Methods (==) :: MapDiffError k v -> MapDiffError k v -> Bool # (/=) :: MapDiffError k v -> MapDiffError k v -> Bool # | |
Orphan instances
| (Show k, Ord k, Diff v) => Diff (Map k v) Source # | |
| (Show k, Ord k, Diff v) => SpecialDiff (Map k v) Source # | |
Associated Types type SpecialDiffError (Map k v) # Methods specialDiff :: Map k v -> Map k v -> Maybe (SpecialDiffError (Map k v)) # renderSpecialDiffError :: SpecialDiffError (Map k v) -> Doc # | |