1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 17:59:10 +03:00
Commit Graph

1096 Commits

Author SHA1 Message Date
Rob Rix
8edf12573a Remove openInfo. 2015-12-30 10:23:16 -05:00
Rob Rix
cdbecea7f1 Context rows produce ranges only. 2015-12-30 10:23:08 -05:00
Rob Rix
2a646d43a1 Wrap in adjoinChildRows. 2015-12-30 10:15:27 -05:00
Rob Rix
40fc01f1b5 Wrap in adjoinChildLines. 2015-12-30 10:10:49 -05:00
Rob Rix
f8553edf70 Union the child/context ranges. 2015-12-30 10:06:39 -05:00
Rob Rix
bb5a7f6218 Remove isEmpty. 2015-12-30 10:06:16 -05:00
Rob Rix
941d4d5ddb Add a unionRanges function to Range. 2015-12-30 10:05:31 -05:00
Rob Rix
cd213e8f4a Remove contextLines. 2015-12-30 09:56:56 -05:00
Rob Rix
463266a48e Don’t bother using contextLines. 2015-12-30 09:56:45 -05:00
Rob Rix
12935f2501 Import Identity. 2015-12-30 09:51:43 -05:00
Rob Rix
a96072ac43 Don’t import Lens. 2015-12-30 09:50:45 -05:00
Rob Rix
7bd6510cfb Remove the HasTerm lens type. 2015-12-30 09:49:36 -05:00
Rob Rix
6646f56de2 Use Has to get and set split terms. 2015-12-30 09:49:12 -05:00
Rob Rix
a187138fc3 Use Has to get and set split diffs in keyed nodes. 2015-12-30 09:43:39 -05:00
Rob Rix
2ef9c33902 Remove HasDiff. 2015-12-30 09:40:44 -05:00
Rob Rix
5452191cb7 Remove HasSplitDiff. 2015-12-30 09:40:40 -05:00
Rob Rix
422fc570b1 Define openDiff over Has. 2015-12-30 09:40:09 -05:00
Rob Rix
1465e21fa4 Add a Has instance for (a, _) pairs. 2015-12-30 09:39:11 -05:00
Rob Rix
98486f6120 Add a Has instance for Identity. 2015-12-30 09:38:55 -05:00
Rob Rix
eecc6c63f2 Add a Has typeclass descending from Functor. 2015-12-30 09:38:42 -05:00
Rob Rix
c0bc19e52c Remove setSplitDiff. 2015-12-30 09:30:54 -05:00
Rob Rix
dc78803b4b HasDiff is constrained to Functors. 2015-12-30 09:30:37 -05:00
Rob Rix
dddfc77e05 openDiff takes a HasSplitDiff context. 2015-12-30 09:17:52 -05:00
Rob Rix
7209e396ec Add a HasDiff instance for string/diff pairs. 2015-12-30 09:01:49 -05:00
Rob Rix
e55fa76b5a Add a HasDiff identity instance. 2015-12-30 09:01:36 -05:00
Rob Rix
545dad88e2 Add a HasSplitDiff instance for string/split diff pairs. 2015-12-30 09:00:39 -05:00
Rob Rix
c46dda98d4 Add a HasSplitDiff identity instance. 2015-12-30 09:00:28 -05:00
Rob Rix
e6a30f7c7d Add a HasSplitDiff typeclass. 2015-12-30 09:00:16 -05:00
Rob Rix
ab61c8f76c Add a HasDiff typeclass back in. 2015-12-30 08:59:53 -05:00
joshvera
95bd3e2d93 Add fromText to Source 2015-12-29 17:34:52 -05:00
Rob Rix
88f0285b89 Info is a Monoid. 2015-12-29 16:02:42 -05:00
Rob Rix
5121c337ec Wrap lefts instead of dropping them. 2015-12-29 15:56:54 -05:00
Rob Rix
d9cc3e6558 Revert "Revert "Filter out unsemantic context nodes using Either.""
This reverts commit 5537296fc6670f6979ef341a69a08d205302d112.
2015-12-29 15:49:01 -05:00
Rob Rix
17b02a4f07 Use pure. 2015-12-29 15:41:22 -05:00
Rob Rix
ce5dddec3a Map the line ranges directly in splitTermByLines. 2015-12-29 15:39:40 -05:00
Rob Rix
79d8cff9af Line is Applicative. 2015-12-29 15:34:54 -05:00
joshvera
a3051c531d Merge remote-tracking branch 'origin/master' into use-text 2015-12-29 15:13:57 -05:00
Rob Rix
c65f18bb25 Revert "Filter out unsemantic context nodes using Either."
This reverts commit 4f0975775a648d5c277cc02cfe82aec45df12985.
2015-12-29 15:00:15 -05:00
Rob Rix
627d050f86 Revert "Add a filter function to OrderedMap."
This reverts commit 6c5ad05a702cf612cab9bbbc779f4cac7af44462.
2015-12-29 14:58:13 -05:00
Rob Rix
3ca7042ed1 Revert "Row is a Bifunctor."
This reverts commit 154dd03fabdadae14b3fd97401a663daa6ec504f.
2015-12-29 14:58:09 -05:00
Rob Rix
a402c1ec48 Revert "Remove <$$> since we aren’t using it."
This reverts commit 7b90d843b4220429f50102bce24b5f679ad6935c.
2015-12-29 14:58:03 -05:00
Rob Rix
3b9936865f Remove <$$> since we aren’t using it. 2015-12-29 14:44:02 -05:00
Rob Rix
a9bed2ba91 Row is a Bifunctor. 2015-12-29 14:42:07 -05:00
Rob Rix
b23fd6a3ad Add a filter function to OrderedMap. 2015-12-29 14:19:35 -05:00
Rob Rix
ca313e7f29 Remove HasDiff. 2015-12-29 14:12:40 -05:00
Rob Rix
8e149b54ae Replace HasDiff with a lens. 2015-12-29 12:48:37 -05:00
Rob Rix
253c3dfd7c Replace HasTerm with a lens type. 2015-12-29 12:47:06 -05:00
Rob Rix
981098f49e Add a HasDiff typeclass.
Also much like a lens, only terrible.
2015-12-29 11:48:00 -05:00
Rob Rix
3ec8ebd2c0 Rename TermContainer → HasTerm. 2015-12-29 11:42:46 -05:00
Rob Rix
1af6717201 Filter out unsemantic context nodes using Either. 2015-12-29 11:17:29 -05:00
Rob Rix
890512fafb Annotate the type of contextRows. 2015-12-29 11:02:42 -05:00
Rob Rix
36232f46a1 Annotate the type of adjoin. 2015-12-29 11:01:27 -05:00
Rob Rix
f7beee8c79 Annotate the type of wrap. 2015-12-29 11:00:33 -05:00
Rob Rix
5f9299cfe5 Annotate the type of getRange. 2015-12-29 10:57:32 -05:00
Rob Rix
2c95e64293 Annotate the type of adjoinChildRows. 2015-12-29 10:56:49 -05:00
Rob Rix
2429ac1333 Annotate the type of childRows. 2015-12-29 10:56:32 -05:00
Rob Rix
d769936602 Don’t filter out empty ranges.
This seems to be fine.
2015-12-29 10:24:47 -05:00
Rob Rix
19d0d77a0f Source is Traversable. 2015-12-29 10:21:45 -05:00
Rob Rix
d71368ffad Revert "Generalize the leaf type again (via a type family in TermContainer)."
This reverts commit af37677e344e1dd3d6a6f782186a2b0983519652.
2015-12-29 10:14:57 -05:00
Rob Rix
99220ba440 Generalize the leaf type again (via a type family in TermContainer). 2015-12-29 10:07:33 -05:00
Rob Rix
3c74757685 Use Either to filter out unnecessary context nodes. 2015-12-29 09:52:54 -05:00
Rob Rix
ac724f7d6c Use concrete leaf types everywhere. 2015-12-29 09:51:50 -05:00
Rob Rix
cadf559d8b Generalize openTerm to term containers. 2015-12-29 09:51:26 -05:00
Rob Rix
1fa2450c6e String/Term pairs are term containers. 2015-12-29 09:51:00 -05:00
Rob Rix
938468f9b4 Terms are term containers. 2015-12-29 09:50:54 -05:00
Rob Rix
b738163094 Add a TermContainer typeclass.
It’s like a lens, but terrible and ad hoc.
2015-12-29 09:50:47 -05:00
Rob Rix
465b3e5207 Add a MaybeOpen value for Info. 2015-12-28 17:11:52 -05:00
Rob Rix
2a048984e3 Use fromMaybe to unpack in splitAnnotatedByLines. 2015-12-28 17:11:37 -05:00
Rob Rix
8a9f815e4e Add an openEither MaybeOpen function. 2015-12-28 16:22:59 -05:00
Rob Rix
90cd354091 MaybeOpen characterizes adjoinRowsBy. 2015-12-28 16:20:03 -05:00
Rob Rix
79d0330df6 MaybeOpen characterizes adjoinLinesBy/openLineBy. 2015-12-28 16:19:42 -05:00
Rob Rix
c32e2c6d2f Move MaybeOpen to the Line module. 2015-12-28 16:18:41 -05:00
Rob Rix
d5b819a6ab Add a MaybeOpen type characterizing the open… functions. 2015-12-28 16:17:35 -05:00
Rob Rix
87e3fc728e Apply the constructor parameter consistently. 2015-12-28 16:11:32 -05:00
Rob Rix
0d48c8c814 Filter out context branches. 2015-12-28 14:01:19 -05:00
Rob Rix
087052b9cd Wrap Fixed line contents in a Fixed term. 2015-12-28 14:00:21 -05:00
Rob Rix
4a95975ece Wrap Indexed line contents in an Indexed term. 2015-12-28 14:00:03 -05:00
Rob Rix
5556dfb2f7 Add a function to wrap a line’s contents in a branch. 2015-12-28 13:59:45 -05:00
Rob Rix
612fa4dc65 Add a getRange function over terms. 2015-12-28 13:59:27 -05:00
Rob Rix
1394b24a68 Revert "Move getRange to the top level."
This reverts commit 507484d90a3281f5c42157d82317545a90404617.
2015-12-28 13:58:24 -05:00
Rob Rix
9916f9a12c isContextBranch doesn’t take a SplitDiff, just a Term. 2015-12-28 13:57:51 -05:00
Rob Rix
61edafe2d9 Move getRange to the top level. 2015-12-28 13:55:54 -05:00
Rob Rix
38f147c913 Require equatable leaves in terms. 2015-12-28 13:54:18 -05:00
Rob Rix
3c3221068b Add a predicate to recognize context terms. 2015-12-28 13:54:07 -05:00
Rob Rix
d9d7ebbc84 Pattern match on the categories. 2015-12-28 13:52:40 -05:00
Rob Rix
b032e4964e Don’t add context branches. 2015-12-28 13:49:01 -05:00
Rob Rix
aa4cb37eff Add a predicate to test whether a node is a context branch. 2015-12-28 13:48:57 -05:00
Rob Rix
7c419d000e Require leaves to be equatable. 2015-12-28 13:47:57 -05:00
Rob Rix
7dfc163047 Filter out empty ranges. 2015-12-28 13:03:34 -05:00
Rob Rix
989ef074df Add an isEmpty predicate on Range. 2015-12-28 13:03:26 -05:00
Rob Rix
ec1635586d Wrap the contents of Fixed nodes. 2015-12-28 12:52:53 -05:00
Rob Rix
86a2c7faaa Wrap the contents of Indexed nodes. 2015-12-28 12:52:26 -05:00
Rob Rix
0d66d2f891 Add a function to wrap a line’s contents in a branch node. 2015-12-28 12:52:16 -05:00
Rob Rix
9bc616ce4a Add a function computing the range of split diffs. 2015-12-28 12:51:30 -05:00
Rob Rix
7e2e40028f Add a Monoid instance for Range. 2015-12-28 12:35:43 -05:00
Rob Rix
ed0b0b39e9 wrapRowContents takes separate functions for each side. 2015-12-28 12:31:23 -05:00
Rob Rix
8616b797ac Add a wrapRowContents function. 2015-12-28 12:28:44 -05:00
Rob Rix
bbc3f373a6 Add a wrapLineContents function.
It’s sort of like fmap, but not!
2015-12-28 12:27:25 -05:00
Rob Rix
00863006df fmap over contextRows instead of passing it a constructor. 2015-12-28 12:14:51 -05:00
Rob Rix
58709ba050 Apply the constructor symmetrically. 2015-12-28 12:14:00 -05:00
Rob Rix
02cc84d38d contextLines produces [Line Info] 2015-12-28 12:06:22 -05:00
Rob Rix
38f4087d77 Formatting. 2015-12-28 12:03:54 -05:00
Rob Rix
f95ca49ae1 Briefer definition of hunks. 2015-12-28 10:04:47 -05:00
Rob Rix
27e40a4954 Show lines prefixed with '+', '-', or ' '. 2015-12-28 10:02:50 -05:00
Rob Rix
f0b026f07f Revert "Diffs are Church-encoded."
This reverts commit 84e126cb18397fd85e7b12ee0ce2bbde770c4300.
2015-12-24 21:28:42 -05:00
Rob Rix
7695992f70 Diffs are Church-encoded. 2015-12-24 21:11:09 -05:00
Rob Rix
0f31fbceaa Define Hunk over a list of Changes. 2015-12-24 18:52:33 -05:00
Rob Rix
64a618b55b Add a showChange function analogous to showHunk. 2015-12-24 18:50:39 -05:00
Rob Rix
8cc2c072c9 Add a function to compute the next Change. 2015-12-24 18:28:37 -05:00
Rob Rix
fef60e4aca Add a Change type which encapsulates partial hunks. 2015-12-24 18:28:31 -05:00
Rob Rix
b658a311ef Abstract Hunk over arbitrary Rows. 2015-12-24 18:23:04 -05:00
Rob Rix
8dda0cbd39 Show lines with prefixes. 2015-12-24 18:20:28 -05:00
Rob Rix
6c32921b99 Add a type annotation for showHunk. 2015-12-24 18:17:25 -05:00
Rob Rix
b138e2b5b8 Move {row,line,diff}HasChanges to the top level. 2015-12-24 18:14:19 -05:00
Rob Rix
30805882b5 Derive the Show instance for Hunk. 2015-12-24 18:11:38 -05:00
Rob Rix
3fd62682d8 Show hunks in their sources. 2015-12-24 18:11:32 -05:00
Rob Rix
dadae9497d Add a showHunk function to pretty-print a hunk within a pair of sources. 2015-12-24 18:11:19 -05:00
Rob Rix
bfb553b7f1 Add a Monoid instance for Range. 2015-12-24 18:10:29 -05:00
Rob Rix
7c95ee30e2 Find (part of) the next hunk in a list of rows. 2015-12-24 17:58:09 -05:00
Rob Rix
82b054c559 Add a function to take the last n elements of a list. 2015-12-24 17:54:26 -05:00
Rob Rix
33240ced54 Find the hunks in a diff & sources. 2015-12-24 17:42:38 -05:00
Rob Rix
052217ea3b Add a function to find the hunks in a list of rows, recursively. 2015-12-24 17:42:22 -05:00
Rob Rix
b535fac1ea Stub in a function to compute the next Hunk & remaining rows in a list of rows. 2015-12-24 17:42:08 -05:00
Rob Rix
a10cc9f13e Hunks are defined over Rows. 2015-12-24 17:41:45 -05:00
Rob Rix
25b9699981 Remove Line. 2015-12-24 17:15:13 -05:00
Rob Rix
1c1da259a7 Define Hunk using record syntax. 2015-12-24 17:14:47 -05:00
Rob Rix
77b92d98a6 Eta reduction. 2015-12-24 17:02:31 -05:00
Rob Rix
5257089ad4 Patches are constructed over Source Chars. 2015-12-24 16:37:14 -05:00
Rob Rix
0866ef52bd Merge branch 'diff-performance' into patch 2015-12-24 16:33:24 -05:00
Rob Rix
63f08c406c Merge branch 'parse-performance' into diff-performance 2015-12-24 10:57:33 -05:00
Rob Rix
dfc5fbee04 Merge branch 'split-performance' into parse-performance
# Conflicts:
#	src/Range.hs
2015-12-24 10:56:51 -05:00
Rob Rix
9fdd72b8c6 Optimize maybeLast for vector access. 2015-12-24 10:48:58 -05:00
Rob Rix
c786d2d83d Lines are parameterized by Vectors. 2015-12-24 10:41:07 -05:00
Rob Rix
d6faa15321 Implement intercalate over Foldables. 2015-12-24 10:40:56 -05:00
Rob Rix
2644e8f602 Implement intersperse over Foldables. 2015-12-24 10:40:47 -05:00
Rob Rix
162f51016e Use makeLine to construct contextLines. 2015-12-24 10:38:46 -05:00
Rob Rix
d3e8dd867b Add a makeLine function constructing Lines from lists. 2015-12-24 09:53:05 -05:00
Rob Rix
e6e3d9d450 classifyMarkup takes the first category if any. 2015-12-24 09:51:56 -05:00
Rob Rix
e77b3a8bd4 Add maybeFirst over Foldables. 2015-12-24 09:51:47 -05:00
Rob Rix
e1f5986c21 Qualify the import of Source with less chaff. 2015-12-24 09:51:38 -05:00
Rob Rix
6be93fa749 Dollar sign spaceship operator to the rescue. 2015-12-24 01:10:17 -05:00
Rob Rix
671ecc2c11 Rejigger some parentheses to avoid a $. 2015-12-24 01:09:49 -05:00
Rob Rix
56aa250f96 Eta-reductions. 2015-12-24 01:09:40 -05:00
Rob Rix
d17a44221d Don’t re-sum the costs. 2015-12-24 01:08:53 -05:00
Rob Rix
dba213ebfc Remove an unnecessary $. 2015-12-24 01:08:23 -05:00
Rob Rix
093fc26d13 Use Source.null in the guard. 2015-12-24 00:23:36 -05:00
Rob Rix
9343e9d4ae Do all formatting within Sources. 2015-12-24 00:20:47 -05:00
Rob Rix
cfeb9e4ee8 Move actualLines/actualLineRanges into the Source module. 2015-12-24 00:08:17 -05:00
Rob Rix
eb461a3915 Concatenate Sources in actualLines. 2015-12-23 23:41:31 -05:00
Rob Rix
4395e49104 Define Source concatenation. 2015-12-23 23:41:08 -05:00
Rob Rix
69aadf4ec5 Rename makeSourcefromList. 2015-12-23 23:37:51 -05:00
Rob Rix
3ca9064869 O(1) indexing. 2015-12-23 23:29:27 -05:00
Rob Rix
8a2aca45e1 Tacit definition of null. 2015-12-23 23:28:13 -05:00
Rob Rix
ad6e7f2ae7 Tacit definition of slice. 2015-12-23 23:27:07 -05:00
Rob Rix
0bb6462fad Rename unSource to toList. 2015-12-23 23:26:37 -05:00
Rob Rix
e4225faa20 Rename subsourceslice. 2015-12-23 23:25:00 -05:00
Rob Rix
55d3ed38a4 A let expression makes more sense. 2015-12-23 23:23:16 -05:00
Rob Rix
83173a7b96 Fewer parens. 2015-12-23 23:22:29 -05:00
Rob Rix
03526754e9 subsource uses the correct start/length bounds. 2015-12-23 23:21:51 -05:00
Rob Rix
588b1a68ee Avoid most of the conversions into/out of Source. 2015-12-23 23:17:35 -05:00
Rob Rix
a19115b267 Define break over Source. 2015-12-23 23:16:09 -05:00
Rob Rix
b6e05008ec cons over Source. 2015-12-23 23:06:49 -05:00
Rob Rix
f89b05bb41 Define a getVector function for Source. 2015-12-23 23:06:38 -05:00
Rob Rix
ee91b130e4 Add API to destructure a Source. 2015-12-23 23:05:01 -05:00
Rob Rix
08122476e6 Add API to test whether a Source is empty. 2015-12-23 23:04:50 -05:00
Rob Rix
f3d65ea6db Define actualLines by means of a single conversion to String. 2015-12-23 22:55:44 -05:00
Rob Rix
76f11db98e Define Source over Data.Vector. 2015-12-23 22:48:31 -05:00
Rob Rix
e9449fccb8 Move Source & its API to the Source module. 2015-12-23 22:38:20 -05:00
Rob Rix
cc9dee5704 Stub in a Source module. 2015-12-23 22:38:02 -05:00
Rob Rix
75ead61274 Move getTotalRange into the tests.
It’s kind of a lie.
2015-12-23 22:20:35 -05:00
Rob Rix
62143c1acf Add a function to compute the total range of a Source. 2015-12-23 22:17:16 -05:00
Rob Rix
20fab3f0fa Use makeSource to construct the sources. 2015-12-23 21:52:44 -05:00
Rob Rix
c1f606a499 Add a makeSource function. 2015-12-23 21:51:56 -05:00
Rob Rix
b7f6b99fba Source carries an offset field. 2015-12-23 21:50:40 -05:00
Rob Rix
4ef1ddbf1d Define Source as a newtype. 2015-12-23 21:42:51 -05:00
Rob Rix
4d368b0180 substring is a synonym for sublist. 2015-12-23 21:39:50 -05:00
Rob Rix
653acdc30f Add a sublist function. 2015-12-23 21:39:35 -05:00
Rob Rix
002147ac3e Add a type parameter for the elements of Sources. 2015-12-23 21:38:23 -05:00
Rob Rix
6a879d4967 Remove the annotation from sources. 2015-12-23 21:37:53 -05:00
Rob Rix
145720123f Use toString when rendering. 2015-12-23 21:33:59 -05:00
Rob Rix
a2521837ea Stub in API to render a Source to a String. 2015-12-23 21:33:07 -05:00
Rob Rix
6fccea8ce9 Pass Sources around everywhere. 2015-12-23 21:30:12 -05:00
Rob Rix
8158386f98 Use sources, not before/after. 2015-12-23 21:29:58 -05:00
Rob Rix
09a944ecfe Add a function to find the value at an index in a Source. 2015-12-23 21:29:26 -05:00
Rob Rix
ef91c64ad7 Add a function to get a portion of a Source. 2015-12-23 21:29:11 -05:00
Rob Rix
035a4cd26b Redefine Source as a type synonym for String. 2015-12-23 21:28:49 -05:00
Rob Rix
ce8a90ad9b Use a type synonym for the sources. 2015-12-23 20:35:03 -05:00
Rob Rix
5082288b06 Stub in arrays of sources. 2015-12-23 20:33:40 -05:00
Rob Rix
46635ccb60 Merge branch 'profiling-improvements' into split-performance
# Conflicts:
#	src/Range.hs
2015-12-23 19:50:27 -05:00
Rob Rix
3097513207 The Split folds are all strict. 2015-12-23 18:11:42 -05:00
Rob Rix
4d339a84e3 Row is strict. 2015-12-23 18:08:59 -05:00
Rob Rix
0ef7cdf93b Merge branch 'strictness' into patch 2015-12-23 18:06:47 -05:00
Rob Rix
0136305f34 Merge branch 'ffi-ffs' into patch
# Conflicts:
#	src/Range.hs
2015-12-23 18:06:38 -05:00
Rob Rix
6b5339a5c2 Fold strictly. 2015-12-23 18:03:55 -05:00
Rob Rix
745ee35816 Annotated is strict in its annotation and syntax.. 2015-12-23 17:55:19 -05:00
Rob Rix
92cbad56fe Document why strict application. 2015-12-23 17:54:28 -05:00
Rob Rix
319bbecfdb We no longer need to force the evaluation of range. 2015-12-23 17:52:04 -05:00
Rob Rix
094fd90f91 Info is now strict. 2015-12-23 17:51:52 -05:00
Rob Rix
98bde6b555 Eta reduction. 2015-12-23 17:50:29 -05:00
Rob Rix
d30bc17c16 Remove redundant parentheses. 2015-12-23 17:50:26 -05:00