[Haskell-cafe] diff implementation in haskell
Victor Nazarov
asviraspossible at gmail.com
Sun Dec 6 17:31:29 EST 2009
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
More information about the Haskell-Cafe
mailing list