Rob Rix
02e8e7d5c7
Define contiguousChanges
in terms of changeIncludingContext
.
2015-12-30 17:52:18 -05:00
Rob Rix
ed9b57af4e
Define nextChange
in terms of changeIncludingContext
.
2015-12-30 17:43:46 -05:00
Rob Rix
4e10072341
Hide Source.break
.
2015-12-30 17:42:18 -05:00
Rob Rix
e65ea093d4
Add a function constructing a Change which includes all leading context.
2015-12-30 17:41:24 -05:00
joshvera
6790640915
Move pack into getSubstring
2015-12-30 17:36:41 -05:00
Rob Rix
159f39b1dc
Bind the last change in a let statement.
2015-12-30 17:35:04 -05:00
Rob Rix
d64cb6f757
Accumulate contiguous changes into a single hunk.
2015-12-30 17:32:07 -05:00
Rob Rix
c1722fec1a
Diff lines are evidently 1-indexed.
2015-12-30 16:39:23 -05:00
Rob Rix
06a9d6489b
Remove takeLast
.
2015-12-30 16:35:34 -05:00
Rob Rix
21eadcd28b
Take the size of the correct list.
2015-12-30 16:33:45 -05:00
Rob Rix
2c7302b770
Only count the skipped context.
2015-12-30 16:32:42 -05:00
Rob Rix
78bd3783d2
Split the leading context with splitAt
.
2015-12-30 16:32:29 -05:00
Rob Rix
0cf930efb4
Sum the lengths of the leading rows for the offset.
2015-12-30 16:30:52 -05:00
Rob Rix
61ddae853c
Compute (wrong) offsets to changes and hunks.
2015-12-30 16:26:02 -05:00
Rob Rix
8a22a8a0c8
Leave Hunk
lengths in Sum
.
2015-12-30 16:25:18 -05:00
Rob Rix
b20aca9459
Leave Hunk
offsets in Sum
.
2015-12-30 16:24:33 -05:00
Rob Rix
a842048ae1
Offsets are pairs.
2015-12-30 16:05:42 -05:00
Rob Rix
2b352e44d4
Render lines in Maybe.
2015-12-30 16:03:38 -05:00
Rob Rix
0fff708848
Render empty lines to empty strings.
2015-12-30 16:00:56 -05:00
Rob Rix
72f5e22fde
Hunk headers include the hunk lengths.
2015-12-30 15:59:00 -05:00
Rob Rix
2547306a56
Add a function to compute the lengths of hunks in Sum.
2015-12-30 15:57:36 -05:00
Rob Rix
f6fbefb36e
changeLength doesn’t unpack the Sums.
2015-12-30 15:56:52 -05:00
Rob Rix
bf2651da67
Sum the lengths of changes.
2015-12-30 15:56:12 -05:00
Rob Rix
e7dc4e89ae
Add a rowLength function in Sum.
2015-12-30 15:56:03 -05:00
Rob Rix
def3237ace
Add a lineLength function in Sum.
2015-12-30 15:55:55 -05:00
Rob Rix
dc39aa4007
Remove the Eq constraints.
2015-12-30 15:38:53 -05:00
Rob Rix
ebaf291a33
Render context rows with showRow
.
2015-12-30 15:38:11 -05:00
Rob Rix
0010ec796a
Rename lineString to showLine.
2015-12-30 15:37:04 -05:00
Rob Rix
3c4cf3c514
Remove showLine.
2015-12-30 15:36:51 -05:00
Rob Rix
386ae52c77
Test string equality when rendering rows as changes.
2015-12-30 15:36:31 -05:00
Rob Rix
7763423e9d
Capture strings for row lines.
2015-12-30 15:36:11 -05:00
Rob Rix
4c31d94350
Use lineString to render leading context.
2015-12-30 15:35:21 -05:00
Rob Rix
2647390232
Use lineString to render trailing context.
2015-12-30 15:34:53 -05:00
Rob Rix
8d0df93193
Use lineString to show rows.
2015-12-30 15:34:05 -05:00
Rob Rix
4b222e6fbd
Add a lineString
function.
2015-12-30 15:32:51 -05:00
Rob Rix
d2f63f77f1
Render hunks’ trailing context.
2015-12-30 15:29:17 -05:00
Rob Rix
2fc7d8f537
Move showRow to the top level.
2015-12-30 15:27:04 -05:00
Rob Rix
636e526311
Move showLine to the top level.
2015-12-30 15:27:00 -05:00
Rob Rix
be2476cfda
Move getRange to the top level.
2015-12-30 15:26:49 -05:00
Rob Rix
725ef9c1d0
Pass the sources around as a pair.
2015-12-30 15:23:52 -05:00
Rob Rix
ebafcab8df
Add trailing context to hunks.
2015-12-30 15:21:26 -05:00
Rob Rix
27a877e861
Generalize unionRanges
to Foldable
Functor
s.
...
We use `Foldable` and `Functor`, and not `Traversable`, because the
latter is not automatically implied by the former. I.e. we use the
minimum necessary set of constraints.
2015-12-30 13:45:04 -05:00
Rob Rix
176d45b59d
Union the ranges rather than concatenating them.
2015-12-30 12:35:27 -05:00
Rob Rix
a225fb20fe
Workaround default Num constraint warnings.
2015-12-30 12:31:38 -05:00
Rob Rix
4e96478cbb
Merge branch 'diff-performance' into patch
...
# Conflicts:
# src/Split.hs
2015-12-30 12:17:33 -05:00
Rob Rix
e1fa8d089e
Merge branch 'master' into diff-performance
2015-12-30 12:14:44 -05:00
joshvera
c69cd164cd
Merge remote-tracking branch 'origin/master' into use-text
2015-12-30 12:07:52 -05:00
Rob Rix
20b87aff70
Revert "Info is a Monoid."
...
This reverts commit f7dad5a28dcd7fb693f2d13c8e2d6ad0b893957e.
2015-12-30 10:37:17 -05:00
Rob Rix
6f415c577f
Generalize split
rendering to arbitrary leaf type.
2015-12-30 10:35:25 -05:00
Rob Rix
722422108f
contextRows
doesn’t take categories.
2015-12-30 10:23:51 -05:00
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