seereason / diff Goto Github PK
View Code? Open in Web Editor NEWClone of Sterling Clover's Diff repo on hub.darcs.net
License: Other
Clone of Sterling Clover's Diff repo on hub.darcs.net
License: Other
Great to have tags for v0.5 and v0.4 to automatically list the changes using the "compare" functionality.
For example, try getDiff (take 10000 (repeat 'a')) ""
- it takes quite a while and returns (replicate 10000 (First 'a'))
.
Diff/src/Data/Algorithm/Diff.hs
Lines 10 to 13 in d106e4d
The space complexity used to be O(mn) in Diff-0.1.*
, but since Diff-0.2
is at most O(max(m,n)).
Upd.: Actually, maybe my mental model of snakes is wrong? I imagine that they share initial segments, but even if they don't at all, the absolutely worst case is O(n d), where d is a number of differences, which is still much better than O(m n).
Diff> test (suite: diff-tests, args: --test-seed=-8336481659523868200)
sub props:
empty in subs: [OK, passed 100 tests]
self in subs: [OK, passed 100 tests]
count subs: [OK, passed 100 tests]
every sub is a sub: [OK, passed 100 tests]
sub prop: [OK, passed 100 tests]
diff props:
lcsEmpty: [OK, passed 100 tests]
lcsSelf: [OK, passed 100 tests]
lcsBoth: [OK, passed 100 tests]
recover first: [OK, passed 100 tests]
recover second: [OK, passed 100 tests]
lcs: [OK, passed 100 tests]
output props:
self generates empty: [OK, passed 100 tests]
compare random with diff: [Failed]
*** Failed! Falsified (after 87 tests):
DiffInput {diLeft = ["1","2","3","4","","5","6","7"], diRight = ["1","2","3","q","b","u","l","","XXX6",""]}
(used seed -8336481659523868200)
test parse: [OK, passed 100 tests]
test context: [OK, passed 1 tests]
Properties Total
Passed 14 14
Failed 1 1
Total 15 15
The following Bifunctor
instance would be very handy:
instance Bifunctor PolyDiff where
bimap f _ (First a) = First (f a)
bimap _ g (Second b) = Second (g b)
bimap f g (Both a b) = Both (f a) (g b)
I appreciate supporting base >= 3 && <= 6
makes things slightly more complicated, as Bifunctor
is only available since base-4.8.0.0
. The two options I can think of are using a CPP
macro, or increasing the minimum bounds of base
.
I'm happy to open a PR with either approach (or something else!).
Thanks for keeping a changelog!
Please add it to the package so that it also displays on Hackage.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.