| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Generics.Diff.Special.Set
Contents
Description
A worked example of implementing SpecialDiff (and thereby Diff) for Sets.
We make the choice to prioritise speed over exhaustiveness: in other words we stop when we find one difference between the two input sets. 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.
Note that the implementation for maps in Generics.Diff.Special.Map is very similar; this is since a
can be seen as equivalent to Set kMap k ().
Synopsis
- data SetDiffError k
- = LeftMissingKey k
- | RightMissingKey k
Documentation
data SetDiffError k Source #
For Sets, we only pick out (maximum) one difference between the two inputs. There are two possibilities:
Constructors
| 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 (SetDiffError k) Source # | |
Defined in Generics.Diff.Special.Set Methods showsPrec :: Int -> SetDiffError k -> ShowS # show :: SetDiffError k -> String # showList :: [SetDiffError k] -> ShowS # | |
| Eq k => Eq (SetDiffError k) Source # | |
Defined in Generics.Diff.Special.Set Methods (==) :: SetDiffError k -> SetDiffError k -> Bool # (/=) :: SetDiffError k -> SetDiffError k -> Bool # | |
Orphan instances
| (Show k, Ord k) => Diff (Set k) Source # | |
| (Show k, Eq k, Ord k) => SpecialDiff (Set k) Source # | |
Associated Types type SpecialDiffError (Set k) # Methods specialDiff :: Set k -> Set k -> Maybe (SpecialDiffError (Set k)) # renderSpecialDiffError :: SpecialDiffError (Set k) -> Doc # | |