1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00
Commit Graph

3465 Commits

Author SHA1 Message Date
Rob Rix
8754120403 🔥 the size/setSize accessors. 2016-07-15 11:18:21 -04:00
Rob Rix
5bc2cd93f1 Only annotate terms & diffs with costs, not sizes. 2016-07-15 11:17:53 -04:00
Rob Rix
e08fbd141f 📝 Cell. 2016-07-15 11:16:30 -04:00
Rob Rix
9a75c03c1e 🔥 unused field accessors. 2016-07-15 11:15:42 -04:00
Rob Rix
aa5c870e52 🔥 maybeFirst. 2016-07-15 11:15:04 -04:00
Rob Rix
6f0a55a487 Only export split. 2016-07-15 11:14:43 -04:00
Rob Rix
6859cba690 Don’t annotate with term costs. 2016-07-15 11:13:59 -04:00
Rob Rix
274c831e72 Don’t annotate zero-cost nodes. 2016-07-15 11:11:04 -04:00
Rob Rix
81279c910e Split out the attributes into separate functions. 2016-07-15 11:05:39 -04:00
Rob Rix
1cb3656502 Uniform split rendering of branches. 2016-07-15 10:53:43 -04:00
Rob Rix
08246f3a4c Simplify the catamorphism over terms/split diffs. 2016-07-15 10:52:28 -04:00
Rob Rix
7e3b470631 Repackage Renderable up with source & other. 2016-07-15 10:51:18 -04:00
Rob Rix
29812c4095 Use a strict Line type in split rendering. 2016-07-15 10:46:51 -04:00
Rob Rix
e5ad1d1c42 Use a strict Cell type in split rendering. 2016-07-15 09:59:23 -04:00
Rob Rix
7e4c68d182 Group all the ToMarkup instances together. 2016-07-15 09:55:29 -04:00
Rob Rix
b2fdfdba66 Placate hlint. 2016-07-15 09:55:00 -04:00
Rob Rix
aad375951f Render the Cost instead of the Size in Split diffs. 2016-07-15 09:52:25 -04:00
Rob Rix
747ae7cbfb 🔥 the InfoFields and Info type synonyms. 2016-07-15 09:41:22 -04:00
joshvera
13671e5d14 Add patchAnnotations to DiffInfo to track discarded branch nodes 2016-07-14 19:35:23 -04:00
Rob Rix
0a4c91c784 Remove some redundant imports. 2016-07-14 16:38:44 -04:00
Rob Rix
300bd2b84c Renderer takes an annotation type parameter. 2016-07-14 16:36:47 -04:00
Rob Rix
1e88543504 Generalize breakDownLeavesByWord over extensible record annotations. 2016-07-14 16:35:49 -04:00
Rob Rix
d1ed015446 Parser takes a list of field types. 2016-07-14 16:35:20 -04:00
Rob Rix
c59bb6ebfe 🔥 the Constructor type synonym. 2016-07-14 16:34:02 -04:00
Rob Rix
7c2a0d5cbb Generalize termConstructor over extensible record annotations. 2016-07-14 16:33:53 -04:00
Rob Rix
74df628f17 Weaken Interpreter’s constraint on annotations to Eq. 2016-07-14 16:18:06 -04:00
Rob Rix
1a2004fc78 Generalize split rendering over extensible record annotations. 2016-07-14 16:11:06 -04:00
Rob Rix
548b7936a7 Generalize patch rendering over extensible record annotations. 2016-07-14 16:10:51 -04:00
Rob Rix
efe868b01a Generalize the ToJSON instances over extensible record annotations. 2016-07-14 16:10:29 -04:00
Rob Rix
cd19193471 Avoid requiring Show instances everywhere. 2016-07-14 15:59:23 -04:00
Rob Rix
4d6ab97691 Placate hlint. 2016-07-14 15:53:52 -04:00
Rob Rix
edaf78c7ce 🔥 the import of the Info symbol. 2016-07-14 15:51:30 -04:00
Rob Rix
3166b53f52 Generalize diffSummary to extensible record annotations. 2016-07-14 15:51:09 -04:00
Rob Rix
0bbe856d3d Generalize diffSummary' to extensible record annotations. 2016-07-14 15:50:38 -04:00
Rob Rix
ea6ff00a7a Generalize the HasCategory instance over terms to extensible record annotations. 2016-07-14 15:49:58 -04:00
Rob Rix
8828adf0bd Generalize maybeTermName over HasField. 2016-07-14 15:49:10 -04:00
joshvera
9a01466bfc Merge branch 'syntax-redux' into pretty-print-summaries 2016-07-14 15:30:15 -04:00
joshvera
27c338331f Merge remote-tracking branch 'origin/master' into syntax-redux 2016-07-14 15:22:46 -04:00
joshvera
453334d966 Use wl-pprint-text to pretty print diff summaries 2016-07-14 14:44:18 -04:00
joshvera
58ff433dd0 Merge remote-tracking branch 'origin/master' into pretty-print-summaries 2016-07-14 14:38:46 -04:00
Rob Rix
9e9622ef10 🔥 a redundant import. 2016-07-14 14:25:49 -04:00
Rob Rix
7304d79e53 Don’t import the Info type synonym. 2016-07-14 14:25:43 -04:00
Rob Rix
f51b1724fe Generalize diffSummary over records. 2016-07-14 14:25:37 -04:00
Rob Rix
13d2dfc24f Generalize termToDiffInfo over records. 2016-07-14 14:25:27 -04:00
Rob Rix
fa44ef74d8 🔥 the HasCategory instance over Info. 2016-07-14 14:23:51 -04:00
Rob Rix
577ca768bb Get the category name from the Term instance. 2016-07-14 14:23:44 -04:00
Rob Rix
63a37920ac Generalize HasCategory over categorizable terms. 2016-07-14 14:19:47 -04:00
Rob Rix
51b55cc1b4 Generalize toTermName over record annotations. 2016-07-14 14:19:15 -04:00
Rob Rix
323c426e24 Rename the diff cost function & generalize over records. 2016-07-14 14:14:21 -04:00
Rob Rix
2d910a6668 Placate hlint a little further. 2016-07-14 14:12:15 -04:00
Rob Rix
2826a7948a 🔥 a redundant definition. 2016-07-14 14:07:33 -04:00
Rob Rix
b9b0bda2bd 🔥 a redundant import. 2016-07-14 14:07:22 -04:00
Rob Rix
2a85ef7668 Placate hlint. 2016-07-14 14:07:15 -04:00
joshvera
1c65d03618 Output a diff summary for empty branch syntax nodes 2016-07-14 13:01:33 -04:00
joshvera
2ebbe72a76 Add Categorizable newtype for HasCategory (Record fields) 2016-07-14 11:52:03 -04:00
Rob Rix
02e836d364 Equate terms with respect to their categories. 2016-07-14 11:27:54 -04:00
Rob Rix
56fbaaf8e5 Merge branch 'master' into equal-term-costs 2016-07-14 09:52:45 -04:00
joshvera
27fab0b289 Merge remote-tracking branch 'origin/master' into pretty-print-summaries 2016-07-13 15:48:44 -04:00
Rob Rix
50c9d37cb1 Placate hlint. 2016-07-13 15:33:53 -04:00
Rob Rix
45b0571221 Add an Arbitrary instance over Range. 2016-07-13 15:33:44 -04:00
Rob Rix
a6eace739c Section header for instances. 2016-07-13 15:31:09 -04:00
Rob Rix
b45329e94b Add Arbitrary instances over Size and Cost. 2016-07-13 15:30:37 -04:00
Rob Rix
8b9e92440f Add an instance over empty records. 2016-07-13 15:28:58 -04:00
Rob Rix
636fbd102b Generalize the Arbitrary instance over Records of multiple fields. 2016-07-13 15:24:35 -04:00
Rob Rix
742f2fcc24 🔥 the set of keyed categories. 2016-07-13 15:02:26 -04:00
joshvera
59426b86f6 Add megaparsec to pretty print summaries 2016-07-13 14:32:53 -04:00
joshvera
7169a51265 Use wl-pprint-text to pretty print diff summaries 2016-07-13 11:58:43 -04:00
Rob Rix
4f967e0e1a 🔥 Data.OrderedMap. 2016-07-12 23:27:20 -04:00
Rob Rix
bc05e694a3 🔥 Keyed syntax nodes. 2016-07-12 23:27:09 -04:00
Rob Rix
c3f060d65b 🔥 ByKey operations. 2016-07-12 23:26:14 -04:00
Rob Rix
7370e927b8 Pattern guards. 2016-07-12 18:39:43 -04:00
Rob Rix
a1bfe55742 Handle ByKey using OrderedMap’s Align instance. 2016-07-12 18:20:31 -04:00
Rob Rix
7af6915a75 Align OrderedMap using the same logic as ByKey. 2016-07-12 18:20:19 -04:00
Rick Winfrey
177af03bd3 Merge branch 'master' into syntax-redux 2016-07-12 17:03:35 -05:00
Rob Rix
a327ab67a4 Export the OrderedMap constructor. 2016-07-12 17:57:58 -04:00
Rob Rix
89b7c451bf Parenthesize records where appropriate. 2016-07-12 17:55:49 -04:00
Rob Rix
a43400b920 Add field names to ArbitraryTerm. 2016-07-12 17:45:50 -04:00
Rob Rix
657d6dc72e Use the correct constructor. 2016-07-12 17:44:48 -04:00
Rob Rix
ccf78456f2 🔥 a redundant import. 2016-07-12 17:26:21 -04:00
Josh Vera
b801683254 Merge branch 'master' into ses-parallelism 2016-07-12 13:12:26 -04:00
Rob Rix
0ebfb1e441 Back out the SES parallelism stuff. 2016-07-12 09:51:41 -04:00
Rob Rix
a0a86a0d01 Merge branch 'master' into ses-parallelism
# Conflicts:
#	semantic-diff.cabal
#	src/Patch.hs
2016-07-12 09:50:02 -04:00
joshvera
38cf7bee62 Add regex tests 2016-07-11 16:18:10 -04:00
Rob Rix
36528d4b37 📝 galignAlign. 2016-07-11 15:39:33 -04:00
Rob Rix
56b248d390 Document the equality constraint. 2016-07-11 15:39:00 -04:00
Rob Rix
23b7fa4f87 Correct the docs for the GAlign instance over K1. 2016-07-11 15:38:17 -04:00
Rob Rix
63832980ba Non-parameter fields are only zipped if equal. 2016-07-11 15:37:48 -04:00
Rob Rix
cf3690f28a Implement recur using galign. 2016-07-11 15:35:13 -04:00
joshvera
904a5ae9ea Use alignWith diffThese instead of zipWith so we don't drop children when diffing 2016-07-11 15:26:08 -04:00
joshvera
68a14d0d74 Use null 2016-07-11 15:13:20 -04:00
Rob Rix
ce500a822f Define zipTerms using galign. 2016-07-11 15:13:16 -04:00
Rob Rix
06fce4f0ca 📝 the GAlign instances. 2016-07-11 14:55:39 -04:00
Rob Rix
d6dbc24056 Move the GAlign instance over Syntax a into its own section. 2016-07-11 14:52:13 -04:00
Rob Rix
ee60b4be7a Use galignAlign explicitly. 2016-07-11 14:51:09 -04:00
Rob Rix
45c0a582b8 Add a function implementing galign’s type using align. 2016-07-11 14:50:13 -04:00
Rob Rix
a7ee001f4d Move the Data.Align.Align implementations into their own section. 2016-07-11 14:48:39 -04:00
Rob Rix
8fb0ba59c6 📝 GAlign. 2016-07-11 14:47:12 -04:00
Rob Rix
f277956c55 Move the section header down. 2016-07-11 14:47:06 -04:00
Rob Rix
2c5810324a 🔥 the (bogus) pair implementation. 2016-07-11 14:46:57 -04:00
Rob Rix
b1b9806e61 📝 alignCofreeWith’s parameters. 2016-07-11 14:41:59 -04:00
Rob Rix
c830c818f4 📝 alignCofreeWith. 2016-07-11 14:33:51 -04:00
Rob Rix
2870cdf1dd Add a function parameter contrasting two terms into e.g. a patch. 2016-07-11 14:33:05 -04:00
Rob Rix
b4c6d92301 Rename c to combined. 2016-07-11 14:29:57 -04:00
Rob Rix
d9c5411568 Rename contrast to compare. 2016-07-11 14:27:38 -04:00
Rob Rix
42f18e9b4f Use the getters instead of destructuring. 2016-07-11 14:03:54 -04:00
Rob Rix
26757185d9 Use a more efficient pattern of recursion. 2016-07-11 14:03:05 -04:00
Rob Rix
40df2f9576 Add an annotation-combining function to alignCofreeWith. 2016-07-11 14:01:45 -04:00
Rob Rix
e23fa323db Rename some type parameters for tidiness’ sake. 2016-07-11 14:00:36 -04:00
Rob Rix
921d0d9356 Clean up the language extensions for the Term module. 2016-07-11 13:59:27 -04:00
Rob Rix
d1219d04f2 🔥 a redundant import. 2016-07-11 13:58:28 -04:00
Rob Rix
a9577a2037 🔥 the hand-rolled alignSyntax' function. 2016-07-11 13:57:53 -04:00
Rob Rix
ee260949ea Move GAlign into its own module. 2016-07-11 13:57:11 -04:00
Rob Rix
6c16a071bb Stub in a generic align module. 2016-07-11 13:55:27 -04:00
Rob Rix
119c2350d4 Use the Data.Align instances for generic alignment of lists and ordered maps. 2016-07-11 13:54:04 -04:00
joshvera
680fe1304c Delete or Insert entire diff if one side of the source blobs is empty 2016-07-11 12:57:10 -04:00
joshvera
1dfae9a1b9 Add Object/Pair/Commented/Comment cases to diffSummary 2016-07-11 12:56:00 -04:00
joshvera
6c58c1b50a Add Object/Pair/Comment to toTermName 2016-07-11 12:55:32 -04:00
Rob Rix
f1f542cc2c Add an instance for Syntax. 2016-07-11 12:21:40 -04:00
Rob Rix
796aa327f0 Tidy up the GAlign instance over sums. 2016-07-11 12:20:47 -04:00
joshvera
830a81774a Capture the rest of termToDiffInfo cases as a function of their toTermName 2016-07-11 12:20:40 -04:00
Rob Rix
d9e5a633b8 🔥 galignDefault. 2016-07-11 12:20:09 -04:00
Rob Rix
2e15957f01 Just use the default galign definition. 2016-07-11 12:19:58 -04:00
Rob Rix
03871b56be Give a default signature and definition of galign. 2016-07-11 12:19:28 -04:00
Rob Rix
b7a1609845 Add a GAlign instance for OrderedMap. 2016-07-11 12:18:32 -04:00
Rob Rix
ba71516f02 Derive a Generic1 instance for Syntax. 2016-07-11 12:18:20 -04:00
Rob Rix
cc24872a46 Derive a Generic1 instance for OrderedMap. 2016-07-11 12:18:11 -04:00
Rob Rix
05a2266aca Implement alignment over compositions of functors. 2016-07-11 12:18:00 -04:00
Rob Rix
8b7bbc5195 Try defining GAlign over pairs. 2016-07-11 12:13:17 -04:00
Rob Rix
598a716f38 Turn off the warning about our use of error. 2016-07-11 12:09:09 -04:00
Rob Rix
34c59cc70e Placate hlint. 2016-07-11 12:08:58 -04:00
Rob Rix
6b7f315987 Make generic alignment explicitly partial instead. 2016-07-11 11:57:46 -04:00
Rob Rix
fa88b23fdc Contrast sums. 2016-07-11 11:54:16 -04:00
Rob Rix
57cfaa3e36 GAlign implies Functor. 2016-07-11 11:54:11 -04:00
Rob Rix
bf98d23d8f The contrasting function takes functors. 2016-07-11 11:54:03 -04:00
Rob Rix
c597a8cfa6 Pass a contrasting function around. 2016-07-11 11:47:16 -04:00
Rob Rix
748bdbfc72 Merge branch 'master' into generic-zip 2016-07-11 11:41:58 -04:00
Rob Rix
dd4c1d9fde Replace alignF with a typeclass for alignment. 2016-07-11 11:39:02 -04:00
Rob Rix
5ffecda63c Pretty sure that guard is redundant to the one in alignM. 2016-07-08 18:00:28 -04:00
Rob Rix
6c2948e317 Try to implement alignment over functors. Try, and fail miserably. 2016-07-08 17:59:54 -04:00
joshvera
90d514bfd2 Add Pair/Comment/Commented cases to run 2016-07-08 16:19:50 -04:00
joshvera
847465c1b5 Add more remaining symmetric cases to zipUnwrap 2016-07-08 15:48:12 -04:00
joshvera
28457049f2 Add some vertical space to ease debugging 2016-07-08 15:19:43 -04:00
Rob Rix
15a0022152 The contrasting function must be polymorphic. 2016-07-08 14:04:16 -04:00
Rob Rix
f6ba2f8408 Implement a partial alignment function for Syntax. 2016-07-08 14:01:09 -04:00
Rob Rix
59bc42b731 Don’t attempt to align non-overlapping terms. 2016-07-08 14:00:07 -04:00
Rob Rix
032dcb047b Pass both the syntaxes to the helper function directly. 2016-07-08 13:57:25 -04:00
Rob Rix
9242d2fe7c Add an alignment function over Cofree f a. 2016-07-08 13:44:29 -04:00
Rob Rix
39a1869bf5 Add a (naïve) Align instance over OrderedMap. 2016-07-08 13:38:48 -04:00
joshvera
772575dffd Add zipUnwrap cases for Comment and Commented 2016-07-08 13:27:41 -04:00
joshvera
3ee4c062d6 import Category as C 2016-07-08 13:16:23 -04:00
joshvera
73afe7d1e9 Add zipTerms to Pairs 2016-07-08 13:16:06 -04:00
Rob Rix
1bf9d63acf Whoops. 2016-07-08 12:17:38 -04:00
Rob Rix
51d8fcd99a Match the parameters only once. 2016-07-08 12:14:42 -04:00
Rob Rix
6961a9ac9c Use wrap. 2016-07-08 12:14:21 -04:00
joshvera
d99df9b8cb Add Comment/Commented/Pair cases to Renderer.Split 2016-07-08 12:04:24 -04:00
joshvera
fdb7a8bc04 Add more JSON cases 2016-07-08 12:01:10 -04:00
joshvera
576b5ef4fb import Syntax as S 2016-07-08 11:50:25 -04:00
joshvera
567e815f28 s/CommentedSyntax/Commented 2016-07-08 11:48:20 -04:00
joshvera
d3a9866305 Map Object leaves to Comments and Fixed/Indexed nodes to pairs 2016-07-08 11:48:05 -04:00
joshvera
8c3fc4b0b3 Align comments, pairs, and Commented terms 2016-07-08 11:47:39 -04:00
joshvera
8755c84466 scope Pair 2016-07-08 11:18:02 -04:00
joshvera
19b0bca394 Remove redundant imports 2016-07-08 11:17:55 -04:00
joshvera
99b05ebdc1 Object takes a list of f now 2016-07-08 11:17:46 -04:00
joshvera
4c3288b6b1 Return replacements for all other cases against 2016-07-07 13:52:24 -04:00
Rob Rix
bdda261c60 Correct the predicate on i/previous. 2016-07-07 12:23:31 -04:00
Rob Rix
ee212caad6 Allow i to equal the previous index. 2016-07-07 12:21:54 -04:00
Rob Rix
983719e9aa Use accessors instead of destructuring. 2016-07-07 12:21:42 -04:00
Rob Rix
66a38fc95e Avoid unnecessary nesting. 2016-07-07 11:58:31 -04:00
Rob Rix
433db16783 📝 UnmappedTerm. 2016-07-07 11:50:09 -04:00
Rob Rix
372943aee9 🔥 the lis/isSorted machinery. 2016-07-07 11:48:58 -04:00
Rob Rix
9c0bab1e6f Revert "Add a function to lift a boolean into Maybe."
This reverts commit db5ff0e1cbeeaf093c495058d44b9b8143abec05.
2016-07-07 11:47:27 -04:00
Rob Rix
4ea8844b58 Skip reorders. 2016-07-07 11:47:17 -04:00
Rob Rix
ded6e48477 Add a function to lift a boolean into Maybe. 2016-07-07 11:45:01 -04:00
Rob Rix
34363d4eee Insertions don’t really have indices. 2016-07-07 11:41:21 -04:00
Rob Rix
b543dfb0ac Correct the recorded indices for deletions. 2016-07-07 11:25:28 -04:00
Rob Rix
cf7d4414f7 Go back to recording the positions in A. 2016-07-07 11:20:08 -04:00
Rob Rix
1c8113b184 Record the most recently seen index. 2016-07-07 11:11:02 -04:00
Rob Rix
6f59440684 Rename the index getter to termIndex. 2016-07-07 11:10:42 -04:00
Rob Rix
65cf0d223c 🔥 redundant handling of the Nothing case. 2016-07-07 11:08:55 -04:00
Rob Rix
f042889223 Use UnmappedTerm instead of nested tuples. 2016-07-07 11:06:05 -04:00
Rob Rix
09ea3c1a76 Add an UnmappedTerm type to clarify control flow. 2016-07-07 11:05:50 -04:00
Rob Rix
524f71916b 🔥 a redundant import. 2016-07-07 10:56:03 -04:00
Rob Rix
2d4ca17812 Assign diffs the indices from bs. 2016-07-07 10:52:44 -04:00
joshvera
1efd68d122 Merge remote-tracking branch 'origin/master' into syntax-redux 2016-07-06 16:22:25 -04:00
Rob Rix
6747e92e0b 🔥 firstAnnotation. 2016-07-06 15:55:11 -04:00
joshvera
9f8ddbd64d Add Object case to styleName 2016-07-06 12:38:47 -04:00
joshvera
ee599f6fa0 Add an Object case to Split 2016-07-06 12:38:47 -04:00
joshvera
4ada4ca991 Use the applicative instance of Join 2016-07-06 12:38:47 -04:00
joshvera
28a06eaec4 Diff objects 2016-07-06 12:38:47 -04:00
joshvera
4d2716c5a4 Add Ternary/Operator/MathAssignment/SubscriptAccess to Alignment 2016-07-06 12:38:47 -04:00
Rob Rix
e664aa9ab1 🔥 some parens. 2016-07-06 11:15:42 -04:00
Rob Rix
5428115895 Don’t unique the lists. 2016-07-06 10:26:05 -04:00
Rob Rix
04eb0126e2 Generalize longestIncreasingSubsequence with a function parameter. 2016-07-06 10:25:24 -04:00
Rob Rix
eb6967d006 Generalize isSorted with a function parameter. 2016-07-06 10:23:21 -04:00
Rob Rix
32a69b05c6 O(n) test for sortedness. 2016-07-06 10:01:07 -04:00
Rob Rix
5d091abc97 Add a (terrible, naïve, gross) implementation of the longest increasing subsequence. 2016-07-06 09:53:17 -04:00
Rob Rix
21f331cee9 Skip invalid comparisons. 2016-07-05 16:45:54 -04:00
Rob Rix
ef916364e5 Use the element’s index for replacements/comparisons. 2016-07-05 16:23:28 -04:00
Rob Rix
1037bab2d6 Swap the feature vector and index. 2016-07-05 15:23:02 -04:00
Rob Rix
1323455da4 Index the diffs. 2016-07-05 14:57:11 -04:00