
6 Dec
2009
6 Dec
'09
10:31 p.m.
Are there pure haskell implementations of diff and diff3 algorithms. Like:
data Diff a = Deleted [a] | Common [a] | Added [a]
diff :: Eq a => [a] -> [a] -> [Diff a]
diff3 :: Eq a => [a] -> [a] -> [a] -> [a]
or smth more general like:
class Diff a where type Difference a diff :: a -> a -> Difference a patch :: a -> Difference a -> a
prop_diffpatch a b = patch a (diff a b) == b
? If not, where can I start towards the implementation? What's the way to do it more functionally? -- Victor Nazarov