1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00
Commit Graph

11045 Commits

Author SHA1 Message Date
Rob Rix
bf333bc073 Add delete & insert bindings. 2015-11-30 17:25:43 -05:00
Rob Rix
37f6c02432 Add a recur function closing over the operands. 2015-11-30 17:25:18 -05:00
Rob Rix
3f6caffb04 sumCost sums the cost fields. 2015-11-30 17:24:54 -05:00
Rob Rix
1d99c50a44 Add a best function. 2015-11-30 17:08:28 -05:00
Rob Rix
f511c85691 The indices come after the functions. 2015-11-30 17:08:08 -05:00
Rob Rix
ea6369bdb1 Parameterize by the comparison function. 2015-11-30 16:58:21 -05:00
Rob Rix
29475a1ef6 Bring the sumCost function over. 2015-11-30 16:57:23 -05:00
Rob Rix
e1cd992155 Parameterize by the cost function. 2015-11-30 16:57:14 -05:00
Rob Rix
f714539691 Rename the state variable. 2015-11-30 16:55:22 -05:00
Rob Rix
461c7629c9 We’re going to need these. 2015-11-30 16:54:51 -05:00
Rob Rix
1704369fdc We don’t use these bindings. 2015-11-30 16:53:04 -05:00
Rob Rix
b0b43cf3b0 Eliminate with pattern matching. 2015-11-30 16:51:45 -05:00
Rob Rix
6b61eb7777 Attempt to stub in computation of the rest of the diff. 2015-11-30 16:48:33 -05:00
Rob Rix
3429f52e3f Move the return inside the handling of the Just case. 2015-11-30 16:45:54 -05:00
Rob Rix
7793a8de2f Stub in caching & computation. 2015-11-30 16:44:41 -05:00
Rob Rix
f81de8d289 Get the state in the general case. 2015-11-30 16:25:00 -05:00
Rob Rix
47f3b61395 Diffing a non-empty list against an empty list produces deletions. 2015-11-30 16:23:34 -05:00
Rob Rix
0d2e881405 Diffing an empty list against a non-empty list produces insertions. 2015-11-30 16:21:41 -05:00
Rob Rix
df23b3af23 Diffing empty lists produces an empty diff. 2015-11-30 16:19:34 -05:00
Rob Rix
e4c7ce28c0 Remove needless parens. 2015-11-30 16:17:37 -05:00
Rob Rix
4a3c63473e Import Map qualified. 2015-11-30 16:17:24 -05:00
Rob Rix
efee13fd63 Stub in a diffAt function. 2015-11-30 16:02:37 -05:00
Rob Rix
c520a03f7b Correct the sense of categories comparing. 2015-11-27 14:49:51 -05:00
Rob Rix
defce6edbf Doc comments 🎩 @joshvera 2015-11-27 12:19:24 -05:00
Rob Rix
a2c994b573 Avoid some other shadowing. 2015-11-27 12:12:49 -05:00
Rob Rix
332f4c2ef2 Factor out the annotations. 2015-11-27 12:10:16 -05:00
Rob Rix
60961da561 We don’t use unwrap and we would otherwise shadow it. 2015-11-27 12:07:04 -05:00
Rob Rix
5aa8d4a3c0 Rename cost to diffCost. 2015-11-27 12:06:14 -05:00
Rob Rix
2e307510b2 Don’t shadow the head function. 2015-11-27 12:03:48 -05:00
Rob Rix
dcd3fbdf8e We don’t need this import. 2015-11-27 12:03:19 -05:00
Rob Rix
4467b4444e Don’t shadow. 2015-11-27 12:02:28 -05:00
Rob Rix
2c241e8ad8 Move the Categorizable instance. 2015-11-27 12:02:15 -05:00
Rob Rix
f89e05b702 We don’t use this. 2015-11-27 11:58:20 -05:00
Josh Vera
69a0d33ffe Merge pull request #249 from github/sunshine-lollipops-and-rainbows-everywhere
Sunshine lollipops and rainbows everywhere
2015-11-27 11:50:47 -05:00
Rob Rix
95750ea60d Use the factored-out annotations. 2015-11-27 11:46:25 -05:00
Rob Rix
f4c73cb3f7 Extract the annotation of Free terms. 2015-11-27 11:46:12 -05:00
Rob Rix
b814e3c068 Merge branch 'master' into apply-review-feedback 2015-11-27 11:42:10 -05:00
Rob Rix
bb9bf71d17 Merge branch 'master' into sunshine-lollipops-and-rainbows-everywhere
# Conflicts:
#	semantic-diff.cabal
2015-11-27 11:36:18 -05:00
Rob Rix
99e383a644 Move Console and Unified into the exe. 2015-11-27 10:14:12 -05:00
Rob Rix
45a865698b Explicitly error if maybeInterpret’s assumptions are violated. 2015-11-27 10:04:53 -05:00
Rob Rix
edfc082a36 Single-line formatting. 2015-11-27 09:55:29 -05:00
Rob Rix
fe07b475e4 Use fromMaybe to unpack with a default value.
I was looking for exactly this! Very nice.
2015-11-27 09:53:37 -05:00
Rob Rix
982fe363d8 Sort imports. 2015-11-27 09:51:59 -05:00
Rob Rix
3be2d11b13 Remove the delete/insert costs. 2015-11-27 09:49:51 -05:00
Rob Rix
062d54d731 Use a better name for the argument to sum. 2015-11-27 09:49:32 -05:00
Rob Rix
53e3928b3d Don’t close over the head of the list. 2015-11-27 09:46:51 -05:00
Rob Rix
1808f61221 Remove copyCost. 2015-11-27 09:46:38 -05:00
Rob Rix
3a52a5c2b6 Use minimumBy to implement the insert/delete choice too. 2015-11-27 09:45:23 -05:00
Rob Rix
63e3252129 Use minimumBy to implement the SES choice. 2015-11-27 09:44:49 -05:00
Rob Rix
ab05599dab Sort imports. 2015-11-27 09:44:29 -05:00
Rob Rix
05fa421642 Document Syntax. 2015-11-27 09:41:43 -05:00
Rob Rix
df7d79bc62 This is also a Term. 2015-11-27 09:31:56 -05:00
Rob Rix
13edc3c832 Derive a Traversable instance for Syntax. 2015-11-25 10:58:47 -05:00
Rob Rix
abf8c693b3 Derive a Foldable instance for Syntax. 2015-11-25 10:58:02 -05:00
Rob Rix
d51c6ba618 s/recur/diffTerms/ 2015-11-25 09:40:45 -05:00
Rob Rix
9c4521bd0e Style insertions and deletions. 2015-11-20 08:06:44 -08:00
Rob Rix
5617cceee2 Format strings with attributes. 2015-11-19 23:07:43 -08:00
Rob Rix
f0286335fb Add an Attribute type with colour & style fields. 2015-11-19 21:43:19 -08:00
Rob Rix
dbaf71233b Style is an Enum. 2015-11-19 18:02:21 -08:00
Rob Rix
e9174bda71 Style is Bounded. 2015-11-19 18:02:11 -08:00
Rob Rix
38610c8336 Add Style. 2015-11-19 18:02:02 -08:00
Rob Rix
8318a8aa89 Colour is an Enum. 2015-11-19 18:01:56 -08:00
Rob Rix
0b0d8097fb Colour is Bounded. 2015-11-19 18:01:50 -08:00
Rob Rix
92a5eb1688 Add a Colour type. 2015-11-19 18:00:03 -08:00
Rob Rix
09cda9d15f Stub in a Console module. 2015-11-19 17:39:21 -08:00
Rob Rix
678c61f5b0 Only render unified. 2015-11-19 17:38:21 -08:00
Rob Rix
54e3ac9ce9 Render the after state of patches. 2015-11-19 17:37:45 -08:00
Rob Rix
55d9cfb129 Unified rendering of patches. 2015-11-19 17:36:59 -08:00
Rob Rix
cbd1c962ca Flip unifiedTerm. 2015-11-19 17:36:51 -08:00
Rob Rix
75325e7ef0 Add a change function which wraps a string in braces with some marker. 2015-11-19 17:36:38 -08:00
Rob Rix
02b07b70d8 Add a before function. 2015-11-19 17:25:28 -08:00
Rob Rix
69d797f135 Patches are annotated with Info. 2015-11-19 17:23:41 -08:00
Rob Rix
8fe1fc6ff2 Unified rendering of terms. 2015-11-19 17:23:12 -08:00
Rob Rix
7abc918f18 Hide foldl. 2015-11-19 17:23:06 -08:00
Rob Rix
389f0a0983 Unpack Annotated separately. 2015-11-19 17:22:55 -08:00
Rob Rix
f40fc7e117 cata over Term. 2015-11-19 17:17:17 -08:00
Rob Rix
d916df923c Stub in unifiedTerm. 2015-11-19 16:27:31 -08:00
Rob Rix
ec0c6fb584 Unified rendering of keyed diffs. 2015-11-19 16:24:07 -08:00
Rob Rix
7b6277994f Delete the String/Range ord. 2015-11-19 16:23:45 -08:00
Rob Rix
4474739427 Range is ordered. 2015-11-19 16:23:18 -08:00
Rob Rix
417f27cc39 String/range pairs are ordered. 2015-11-19 16:07:30 -08:00
Rob Rix
0702ad277d Import Data.Map. 2015-11-19 15:59:24 -08:00
Rob Rix
8970033077 Unified rendering of fixed diffs. 2015-11-19 15:58:56 -08:00
Rob Rix
360b134438 Unified rendering of indexed diffs. 2015-11-19 15:58:41 -08:00
Rob Rix
6fa7204728 Accumulate context between children. 2015-11-19 15:56:58 -08:00
Rob Rix
b133e572c7 Implement unifiedRange w/o initial context. 2015-11-19 15:53:37 -08:00
Rob Rix
14e7b6ae08 Return pairs of strings/ranges. 2015-11-19 15:53:23 -08:00
Rob Rix
73838c7844 Extract the range from patches. 2015-11-19 15:30:37 -08:00
Rob Rix
69e2efc977 Get the after state out of Patches. 2015-11-19 15:26:40 -08:00
Rob Rix
a254d1168e Stub in unifiedRange. 2015-11-19 15:08:11 -08:00
Rob Rix
660e21345c Unified rendering of leaves produces the substring. 2015-11-19 15:06:42 -08:00
Rob Rix
0d7261454e unified operates over diffs annotated with Info. 2015-11-19 15:06:25 -08:00
Rob Rix
4103cfb1e2 Substrings. 2015-11-19 15:05:33 -08:00
Rob Rix
222aba8e46 Ranges have Int bounds. 2015-11-19 15:05:29 -08:00
Rob Rix
0cd3b8c16c Stub in the implementation of unified over Diff. 2015-11-19 14:37:07 -08:00
Rob Rix
a5729774d0 Stub in the type of unified. 2015-11-19 14:36:32 -08:00
Rob Rix
0c6ba1f3a6 Info uses the Category type. 2015-11-19 14:36:07 -08:00
Rob Rix
1394b60d2c Add a Category type name. 2015-11-19 14:35:46 -08:00
Rob Rix
0fdb2469f9 Stub in a Unified diff renderer file. 2015-11-19 13:35:06 -08:00
Rob Rix
486f3a4732 Factor out a pattern match. 2015-11-19 12:20:57 -08:00
Rob Rix
0cced151ea Remove some obsolete imports. 2015-11-19 12:13:45 -08:00
Rob Rix
4298956f37 Info is Categorizable. 2015-11-19 12:06:34 -08:00
Rob Rix
7138d9fb1b Info has a Range and a set of categories. 2015-11-19 12:04:18 -08:00
Rob Rix
53b6c6846c Ranges are equatable and showable. 2015-11-19 12:02:53 -08:00
Rob Rix
c925543305 constructAndRun for equal terms. 2015-11-19 11:56:45 -08:00
Rob Rix
87c7a0b6b0 Implement hylomorphism. 2015-11-19 11:56:35 -08:00
Rob Rix
6c6d72601d Factor out more annotation unpacking. 2015-11-19 11:37:19 -08:00
Rob Rix
c2dc659a57 Factor out annotation unpacking. 2015-11-19 11:36:14 -08:00
Rob Rix
e6385e2832 Diffs are annotated. 2015-11-19 11:27:31 -08:00
Rob Rix
2a081c5aa0 Keyed nodes. 2015-11-18 18:00:10 -08:00
Rob Rix
21d9bb3670 Compose some more functions. 2015-11-18 17:38:48 -08:00
Rob Rix
e91bdbd981 Factor out the operator section. 2015-11-18 17:35:03 -08:00
Rob Rix
63dfb9d08b Zip Fixed terms. 2015-11-18 17:35:03 -08:00
Rob Rix
d317e32284 Zip Indexed terms. 2015-11-18 17:35:03 -08:00
Rob Rix
0b3c04fe1b Zip leaf terms. 2015-11-18 17:35:03 -08:00
Rob Rix
e8274ed379 Zip terms. 2015-11-18 17:35:03 -08:00
Rob Rix
ee4da4218d Add an Annotated syntax type. 2015-11-18 17:35:03 -08:00
Rob Rix
c595fda525 Ranges are bounded by integers. 2015-11-18 17:35:03 -08:00
Rob Rix
680465dfbf Abstract Diff over an annotation type. 2015-11-18 13:23:47 -08:00
Rob Rix
359c1818d0 Use const. 2015-11-18 12:09:08 -08:00
Rob Rix
c7336dae2c Remove Data.Fix. 2015-11-18 11:54:08 -08:00
Rob Rix
e74340d4cf 🔥 the RangedWhatever things. 2015-11-18 11:50:30 -08:00
Rob Rix
5129bc455b Move the diff fixture thing to the executable. 2015-11-18 11:45:23 -08:00
Rob Rix
1e3ae866c2 Terms with Categorizable annotations are themselves Categorizable. 2015-11-18 11:39:08 -08:00
Rob Rix
a47ad36d98 Move the definition of Term into the Term module. 2015-11-18 11:28:16 -08:00
Rob Rix
e989216361 Add a Term module. 2015-11-18 11:27:09 -08:00
Rob Rix
fba97d256b Test whether Categorizable values are comparable. 2015-11-18 11:25:53 -08:00
Rob Rix
f1eed7dac2 Categorizable things have categories. 2015-11-18 11:23:35 -08:00
Rob Rix
5fe7cecba9 Add a Categorizable module. 2015-11-18 11:23:28 -08:00
Rob Rix
092192cb14 Short-circuit for equal terms. 2015-11-18 11:21:30 -08:00
Rob Rix
09d10875c3 Info is Equatable. 2015-11-18 11:19:16 -08:00
Rob Rix
da5807180a If not comparable, don’t compare. 2015-11-18 11:13:13 -08:00
Rob Rix
6f49840fc8 Comparable tests terms. 2015-11-18 11:13:00 -08:00
Rob Rix
fc4cab8120 Export Comparable. 2015-11-18 11:09:18 -08:00
Rob Rix
0ad19372fd Parameterize interpret by a comparable function. 2015-11-18 11:09:11 -08:00
Rob Rix
6e64ada5ad Equal leaves produce equal diffs. 2015-11-18 10:59:40 -08:00
Rob Rix
7dae86cba6 Recursive for everything else. 2015-11-18 10:53:59 -08:00
Rob Rix
57e30d7a57 ByKey for Keyed nodes. 2015-11-18 10:52:49 -08:00
Rob Rix
dfbb01fda1 ByIndex for Indexed nodes. 2015-11-18 10:52:09 -08:00
Rob Rix
eeaa77812c Parameterize SES by the cost function. 2015-11-18 10:44:02 -08:00
Rob Rix
aabc5f62ee Compose. 2015-11-18 10:39:49 -08:00
Rob Rix
c2deb95a36 Recur through SES via constructAndRun. 2015-11-18 10:39:20 -08:00
Rob Rix
9fd3be3408 Capture the copy cost as well. 2015-11-18 10:38:29 -08:00
Rob Rix
0799dfa51d Capture insert/delete costs. 2015-11-18 10:37:42 -08:00
Rob Rix
40588b9942 Guards. 2015-11-18 10:36:47 -08:00
Rob Rix
7e75c662dc Diagonals. 2015-11-18 10:36:19 -08:00
Rob Rix
ad0c9ca4b2 Alias the comparison function’s type. 2015-11-18 10:28:07 -08:00
Rob Rix
e7e2f280e1 Parameterize by recur. 2015-11-18 10:26:40 -08:00
Rob Rix
2b8e3c7dbf Specialize to Term/Diff. 2015-11-18 07:44:08 -08:00
Rob Rix
08ce71953e Implement cost. 2015-11-18 07:43:10 -08:00
Rob Rix
08f3d217c0 Implement SES in terms of cost and recur functions. 2015-11-18 07:40:54 -08:00
Rob Rix
6d6fbcf797 Go back to Diff SES. 2015-11-18 07:40:30 -08:00
Rob Rix
cb6eeff9e3 Only export ses. 2015-11-18 07:27:54 -08:00
Rob Rix
676ef16162 Implement the empty cases by pattern matching. 2015-11-18 07:27:19 -08:00
Rob Rix
13499cc520 Implement the equal head case of SES. 2015-11-18 07:26:24 -08:00
Rob Rix
9bafea4749 SES returns both terms. 2015-11-18 07:25:42 -08:00
Rob Rix
8b3c1aacfd SES returns Either. 2015-11-18 07:25:26 -08:00
Rob Rix
e742cf6859 Annotate the type of SES.
I’m not at all sure this is correct.
2015-11-18 07:13:55 -08:00
Rob Rix
ae27e9cbbe Move SES into its own file. 2015-11-18 07:11:05 -08:00
Rob Rix
b122712470 Add a file for SES. 2015-11-18 07:09:49 -08:00
Rob Rix
bb43da027a SES over empty/non-empty lists. 2015-11-18 07:02:47 -08:00
Rob Rix
a7545ed749 Interpret ByKey algorithms. 2015-11-18 00:21:27 -08:00
Rob Rix
213d8fbd55 Maps all the way down. 2015-11-17 18:58:51 -08:00
Rob Rix
e01e4bb923 ByKey’s continuation takes a map. 2015-11-17 18:56:28 -08:00
Rob Rix
242ca9464b Patch is a Functor. 2015-11-17 18:51:36 -08:00
Rob Rix
da3bf047b1 Patch is algebraic. 2015-11-17 18:44:55 -08:00
Rob Rix
d881006e55 Spacing. 2015-11-17 18:26:07 -08:00
Rob Rix
e700c407f2 Move Patch into its file. 2015-11-17 18:23:53 -08:00
Rob Rix
c467437233 Add a file for Patch. 2015-11-17 18:21:51 -08:00
Rob Rix
ef1e64376c Break repacking out. 2015-11-17 18:16:39 -08:00
Rob Rix
a4f83780bd Factor some of the operands out. 2015-11-17 17:59:01 -08:00
Rob Rix
9504ebe586 Recursive interpretation of Keyed terms. 2015-11-17 17:50:15 -08:00
Rob Rix
0d8edc8272 Recur through Fixed terms. 2015-11-17 17:35:00 -08:00
Rob Rix
e26dbb1fbe Recur through indexed terms of equal length. 2015-11-17 17:34:04 -08:00
Rob Rix
e620eb76ff Stub in recurring through indexed terms. 2015-11-17 17:29:18 -08:00
Rob Rix
a30328e682 Stub in recursive diffing to always replace. 2015-11-17 17:29:12 -08:00
Rob Rix
485e947da6 Rename to constructAndRun. 2015-11-17 17:17:45 -08:00
Rob Rix
cdcb575b57 Only export interpret. 2015-11-17 17:15:10 -08:00
Rob Rix
16e4bf891d Interpretation. 2015-11-17 17:13:48 -08:00
Rob Rix
7c09fd1503 Stub in interpretation. 2015-11-17 17:05:16 -08:00
Rob Rix
3829f4492d Remove the old interpret function. 2015-11-17 17:04:05 -08:00
Rob Rix
b4450e038e Stub in a file for Interpreter. 2015-11-17 16:25:39 -08:00
Rob Rix
5438acf1fb Add Algorithm. 2015-11-17 16:24:01 -08:00
Rob Rix
aba1b31625 Add an Algorithm file. 2015-11-17 16:20:52 -08:00
Rob Rix
a71385b22e Indentation stuff. 2015-11-17 16:17:42 -08:00
Rob Rix
4028c50c84 Remove redundant DeriveFunctor. 2015-11-17 15:43:39 -08:00
Rob Rix
af280ae63d Rename the Recursive constructor. 2015-11-17 15:40:03 -08:00
Rob Rix
a700b7f7ff Derive functor. 2015-11-17 15:39:51 -08:00
Rob Rix
c8b573cb33 Move Operation into its own file. 2015-11-17 15:14:57 -08:00
Rob Rix
313019fa3a Remove all the parentheses ever. 2015-11-17 15:09:42 -08:00
Rob Rix
4f84059c0b Remove redundant. 2015-11-17 15:07:06 -08:00
Rob Rix
b2660e2b1c Parenthesize some things. 2015-11-17 15:06:24 -08:00
Rob Rix
e5282b9745 Remove Lib.hs. 2015-11-17 14:54:06 -08:00
Rob Rix
d34c71ccf1 Move the sources into the package. 2015-11-17 14:49:59 -08:00
Rob Rix
e5b35fdc4a I mean, sure. 2015-11-17 14:44:16 -08:00