uni-util-2.2.1.2: Utilities for the uniform workbench

Safe HaskellSafe-Infered

Util.Myers

Description

Implementation of the Myers algorithm, from An O(ND) Difference Algorithm and Its Variations, by Eugene Myers page 6 (figure 2).

Specification: if

f1 (InBoth v) = Just v f1 (InFirst v) = Just v f1 (InSecond v) = Nothing

and

f2 (InBoth v) = Just v f2 (InFirst v) = Nothing f2 (InSecond v) = Just v

then

mapPartial f1 (diff l1 l2) == l1

and

mapPartial f2 (diff l1 l2) == l2

Documentation

diff :: Eq a => [a] -> [a] -> [DiffElement a]Source

diff2 :: Eq v => [v] -> [v] -> [DiffElement v]Source

data DiffElement v Source

Constructors

InBoth [v] 
InFirst [v] 
InSecond [v] 

Instances

Show v => Show (DiffElement v)