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

9157 Commits

Author SHA1 Message Date
Rob Rix
2838447f04 Define Diff using BindingF and recursively constructed diffs. 2017-09-11 12:02:22 -04:00
Rob Rix
946ee44707 Spacing. 2017-09-11 11:57:36 -04:00
Rob Rix
3d5e359f44 Define a Pretty1 instance for DiffF. 2017-09-11 11:57:30 -04:00
Rob Rix
583249fce9 Define hoisting of TermFs. 2017-09-11 11:06:41 -04:00
Rob Rix
e745372f61 Define Pretty instances for products/sums of unions. 2017-09-11 11:00:31 -04:00
Rob Rix
42b5fbdcd3 Define ToJSONFields instances over Data.Functor.{Product,Sum} instead of the GHC.Generics types. 2017-09-11 10:39:26 -04:00
Rob Rix
1f64d68023 Let holds an Env. 2017-09-11 10:20:54 -04:00
Rob Rix
6dc4cf310e Define a Show1 instance for Env. 2017-09-11 10:20:48 -04:00
Rob Rix
98cd5eb860 Define an Eq1 instance for Env. 2017-09-11 10:20:42 -04:00
Rob Rix
649aad3f8a Derive a Semigroup instance for Env. 2017-09-11 10:14:36 -04:00
Rob Rix
5c49c98255 Define a hoisting operation for bindings. 2017-09-11 09:52:28 -04:00
Rob Rix
c8706d6c4b Spacing. 2017-09-11 09:50:14 -04:00
Rob Rix
8e12798a05 Define a let binding smart constructor using circular programming. 2017-09-11 09:41:46 -04:00
Rob Rix
7e55483157 Derive Foldable, Functor, & Traversable instances for BindingF. 2017-09-11 09:40:14 -04:00
Rob Rix
4d818304fb Compute the max bound metavariable in an ABT. 2017-09-11 09:36:00 -04:00
Rob Rix
d064e3f1e5 Compute the free metavariables in an ABT. 2017-09-11 09:35:51 -04:00
Rob Rix
65c418359a List the exports explicitly. 2017-09-11 09:34:57 -04:00
Rob Rix
77cac93526 Define a ToJSONFields instance for BindingF. 2017-09-11 09:33:49 -04:00
Rob Rix
7a80201f99 Rename VarF to Var. 2017-09-11 09:33:39 -04:00
Rob Rix
127980698e List the imports from Data.Functor.Binding explicitly. 2017-09-11 09:32:07 -04:00
Rob Rix
4a7b93042c Define a ToJSONFields1 instance for JSONFields1. 2017-09-10 22:40:55 -04:00
Rob Rix
475e12d038 Define a ToJSONFields instance for JSONFields. 2017-09-10 22:40:13 -04:00
Rob Rix
fb26ef6b34 Define a ToJSONFields instance for JSONFields1. 2017-09-10 22:39:27 -04:00
Rob Rix
4955524c29 Lift the ToJSONFields instance for pairs over ToJSONFields instances. 2017-09-10 22:37:39 -04:00
Rob Rix
ccabc81192 Define a ToJSONFields1 instance for sums. 2017-09-10 22:33:29 -04:00
Rob Rix
66e866427f Define a ToJSONFields1 instance for products. 2017-09-10 22:32:34 -04:00
Rob Rix
f8f3e6466d Define a JSONFields1 bridge for ToJSON instances. 2017-09-10 22:32:07 -04:00
Rob Rix
f43dc62d12 Define a JSONFields bridge for ToJSON instances. 2017-09-10 22:31:57 -04:00
Rob Rix
8c205e7114 Generalize the ToJSONFields instance for pairs. 2017-09-10 22:26:59 -04:00
Rob Rix
f06b155f1d Define a ToJSONFields instance for pairs. 2017-09-10 22:26:32 -04:00
Rob Rix
db7301fba2 Define a ToJSON instance for DiffF. 2017-09-10 22:24:08 -04:00
Rob Rix
26e3ca425b Define a ToJSON instance for BindingF. 2017-09-10 22:23:16 -04:00
Rob Rix
48a4a5f6ce Define a ToJSON instance for TermF. 2017-09-10 22:21:47 -04:00
Rob Rix
6186ef3ae7 Define a bindings getter for BindingF. 2017-09-10 21:58:18 -04:00
Rob Rix
9a5711cb41 Define a pretty instance for BindingF. 2017-09-10 21:53:14 -04:00
Rob Rix
8a41498ffd Define a Show instance for BindingF. 2017-09-10 21:52:30 -04:00
Rob Rix
831eb67de8 Define a Show1 instance for BindingF. 2017-09-10 21:51:57 -04:00
Rob Rix
5956cc77ae Define an Eq instance for BindingF. 2017-09-10 21:48:19 -04:00
Rob Rix
bc7ed4420e Define an Eq1 instance for BindingF. 2017-09-10 21:47:43 -04:00
Rob Rix
ad83303071 Define a ToJSONFields1 instance for BindingF. 2017-09-10 21:45:02 -04:00
Rob Rix
82897fa5e9 Define a Pretty1 instance for BindingF. 2017-09-10 21:41:41 -04:00
Rob Rix
78ad302339 Define an abstract binding functor. 2017-09-10 21:35:54 -04:00
Rob Rix
a77f9c36d2 Move Metavar & Env to Data.Functor.Binding. 2017-09-10 21:22:32 -04:00
Rob Rix
9b66f548c0 Stub in a module for bindings. 2017-09-10 21:18:31 -04:00
Rob Rix
13accbf65d Partially apply the Both type synonym. 2017-09-10 20:53:51 -04:00
Rob Rix
c067153077 🔥 the metavariable eliminator. 2017-09-10 20:04:53 +01:00
Rob Rix
5ac5d80875 Define a smart constructor for metavariable diffs. 2017-09-10 20:03:32 +01:00
Rob Rix
289cb11912 Define a smart constructor for let-binding diffs. 2017-09-10 19:56:06 +01:00
Rob Rix
d68a8790ce Define maxBoundMetavariable using a helper. 2017-09-10 19:55:08 +01:00
Rob Rix
3e2c883b3a Define a function computing the maximum metavariable bound in a diff. 2017-09-10 19:50:01 +01:00
Rob Rix
7ada1dea20 🔥 liftShowsPrecBoth & liftShowListBoth. 2017-09-10 19:41:13 +01:00
Rob Rix
90496bdc1c Copy holds a TermF. 2017-09-10 19:40:48 +01:00
Rob Rix
1ccff72b08 Define a Pretty1 instance for Join. 2017-09-10 19:36:22 +01:00
Rob Rix
13c0b6d496 Define a Show1 instance for Join. 2017-09-10 19:34:49 +01:00
Rob Rix
bb11787db9 Define an Eq1 instance for Join. 2017-09-10 19:33:57 +01:00
Rob Rix
62a6235161 Define lifted showing for Both. 2017-09-10 19:32:25 +01:00
Rob Rix
4490297bb5 Derive an Enum instance. 2017-09-10 19:16:29 +01:00
Rob Rix
92e157cfb0 Use the newtype deriving strategy to define the ToJSON instance for Metavar. 2017-09-10 19:15:55 +01:00
Rob Rix
8b6b4dcc00 Define metavariables as Ints. 2017-09-10 19:14:44 +01:00
Rob Rix
8b1eb1e8be Compute the set of free metavariables in a diff. 2017-09-10 19:07:14 +01:00
Rob Rix
b4ca3be640 Simplify with a foldMap. 2017-09-10 18:34:42 +01:00
Rob Rix
36ac6a4104 Rename MetaVar to Metavar. 2017-09-10 18:28:21 +01:00
Rob Rix
a0de82e88e Simplify the non-Copy evalDiffR cases. 2017-09-10 18:01:55 +01:00
Rob Rix
f33cf1a3c5 Pull the extension of the environment into a helper. 2017-09-10 17:48:49 +01:00
Rob Rix
7020f5ffaa Parens. 2017-09-10 17:47:07 +01:00
Rob Rix
606b89772e Simplify evalDiffRM. 2017-09-10 17:46:54 +01:00
Rob Rix
80994e27dc 🔥 the helper function. 2017-09-10 17:46:25 +01:00
Rob Rix
49fd598b92 Define a getter for bindings. 2017-09-10 17:45:41 +01:00
Rob Rix
ebcaa3fb27 Simplify the Copy case. 2017-09-10 17:43:35 +01:00
Rob Rix
dbc79d8ab0 Simplify the non-Copy cases. 2017-09-10 17:43:12 +01:00
Rob Rix
472363e3e9 Define an effectful evaluator using Reader for the environment. 2017-09-10 17:41:48 +01:00
Rob Rix
65c7a5ae0b Produce multiple entries inside patches. 2017-09-10 17:12:44 +01:00
Rob Rix
6ee5c2d261 Force the after branch of replacements onto the next line. 2017-09-10 16:11:07 +01:00
Rob Rix
a2d9decbf0 Reformat replacements in sexpression rendering. 2017-09-10 16:03:36 +01:00
Rob Rix
5f7adb59be Dedupe replacements. 2017-09-10 15:54:40 +01:00
Rob Rix
b330eb45eb Produce only a single entry for patches. 2017-09-10 15:38:09 +01:00
Rob Rix
cc1f75cb1a Place entries for patch nodes above the body of the patch. 2017-09-10 15:25:38 +01:00
Rob Rix
fd05f7cb80 Patches count as changes. 2017-09-10 15:23:22 +01:00
Rob Rix
e5d345dca7 Simplify the selection of patches. 2017-09-10 15:15:14 +01:00
Rob Rix
d678048dfd Fix tables of contents for patches. 2017-09-10 10:46:04 +01:00
Rob Rix
8fff046b02 Correct s-expression output on the first line. 2017-09-09 23:16:24 +01:00
Rob Rix
760955c120 Apply padding to terms in renderSExpressionTerm. 2017-09-09 23:06:31 +01:00
Rob Rix
b7fa780060 Simplify some folds. 2017-09-09 23:01:51 +01:00
Rob Rix
e57beaeb9f Tweaks to s-expression rendering. 2017-09-09 22:56:41 +01:00
Rob Rix
66fc464357 Get rid of the other padding mechanism. 2017-09-09 22:27:46 +01:00
Rob Rix
5baab6ea6b Avoid extra newlines on the first line. 2017-09-09 21:48:40 +01:00
Rob Rix
ad6f618f56 Move the environment/metavar stuff down. 2017-09-09 21:37:11 +01:00
Rob Rix
da5bdac3d8 🔥 patchSum. 2017-09-09 21:36:22 +01:00
Rob Rix
987dcb7839 Patches recur through Diff. 2017-09-09 21:36:18 +01:00
Rob Rix
67cb8799ba Define an operator producing a Term from a SplitDiff. 2017-09-09 21:32:22 +01:00
Rob Rix
f064360d8c Rename some type parameters. 2017-09-09 21:32:12 +01:00
Rob Rix
114d5aa2d9 Derive some more instances for SplitPatch. 2017-09-09 21:24:46 +01:00
Rob Rix
a80ee2cdb4 Derive hella instances for Env. 2017-09-09 19:03:15 +01:00
Rob Rix
7374994127 Simplify the Eq1 instance for Term. 2017-09-09 18:58:56 +01:00
Rob Rix
345a96eca0 Simplify the Foldable, Functor, & Traversable instances for Term. 2017-09-09 18:57:58 +01:00
Rob Rix
280e3b2084 Specialize the Pretty instances over TermF for Unions. 2017-09-09 18:56:47 +01:00
Rob Rix
6eb0f7cff6 Add bindings & variables to diffs. 2017-09-09 18:14:05 +01:00
Rob Rix
19febc23aa Define diffCost as a catamorphism. 2017-09-09 18:03:07 +01:00
Rob Rix
0bfd29fddc Merge branch 'relocate-json-fields' into directed-acyclic-diffs 2017-09-09 17:49:12 +01:00
Rob Rix
d0a2687edc 🔥 all the LANGUAGE pragmas in Renderer.JSON. 2017-09-09 17:46:35 +01:00
Rob Rix
7404b41717 Renderer.JSON no longer contains orphan instances. 2017-09-09 17:46:08 +01:00
Rob Rix
c83746e74e Move the Output instance for [Value] to Data.Output. 2017-09-09 17:45:49 +01:00
Rob Rix
f6f1b21d94 Move the Output instance for maps to Data.Output. 2017-09-09 17:45:01 +01:00
Rob Rix
5be89f11ee 🔥 Renderer.JSON’s export of ToJSONFields. 2017-09-09 17:41:24 +01:00
Rob Rix
44aab0edcf Renderer.JSON is decidable. 2017-09-09 17:39:46 +01:00
Rob Rix
c6a111b71d 🔥 the ToJSON instance for Both. 2017-09-09 17:39:08 +01:00
Rob Rix
f30a5d0754 Move the ToJSON/ToJSONFields instances for Diff into Diff. 2017-09-09 17:37:26 +01:00
Rob Rix
c449ad481e Move the ToJSON/ToJSONFields instances for Term into Term. 2017-09-09 17:36:35 +01:00
Rob Rix
8ce60eecb8 Lift the Term/Diff ToJSONFields instances to * -> *. 2017-09-09 17:35:45 +01:00
Rob Rix
3231d85347 Define a lifting of ToJSONFields to * -> *. 2017-09-09 17:31:45 +01:00
Rob Rix
aa78f3eaeb Move the ToJSONFields instance for Category into Category. 2017-09-09 17:30:34 +01:00
Rob Rix
0845687d51 Move the ToJSONFields instance for Syntax into Syntax. 2017-09-09 17:25:55 +01:00
Rob Rix
4e3c34d8f7 Move the ToJSONFields instance for Patch into Patch. 2017-09-09 17:24:56 +01:00
Rob Rix
41ecede023 🔥 the ToJSONFields instance for unpopulated Unions. 2017-09-09 17:23:58 +01:00
Rob Rix
5b62e4bf5c Move the ToJSONFields instance for populated Unions into Data.JSON.Fields. 2017-09-09 17:23:49 +01:00
Rob Rix
7bb92dfd98 Move the ToJSONFields instance for [] into Data.JSON.Fields. 2017-09-09 17:23:28 +01:00
Rob Rix
c1b521ab9b Move the ToJSONFields instance for Maybe into Data.JSON.Fields. 2017-09-09 17:23:14 +01:00
Rob Rix
d7a5ea152d Move the ToJSONFields instance for Span into Data.Span. 2017-09-09 17:20:43 +01:00
Rob Rix
42c1795c0a Move the ToJSONFields instance for Range into Data.Range. 2017-09-09 17:19:46 +01:00
Rob Rix
62603c803c Move the ToJSONFields/ToJSON instances for Records into Data.Record. 2017-09-09 17:18:24 +01:00
Rob Rix
7a88cad094 Move the ToJSONFields instance for Both into the Data.JSON.Fields module. 2017-09-09 17:18:10 +01:00
Rob Rix
3e12a91359 Move ToJSONFields into its own module. 2017-09-09 17:16:00 +01:00
Rob Rix
c69e3383e3 Define a module for JSONFields. 2017-09-09 17:15:22 +01:00
Rob Rix
acff088e68 Define printTerm as a catamorphism. 2017-09-09 16:58:41 +01:00
Rob Rix
9765775242 Define printDiff as a catamorphism. 2017-09-09 16:55:32 +01:00
Rob Rix
1801fdc1a8 Define a diff evaluator. 2017-09-09 16:52:06 +01:00
Rob Rix
1637fa62a4 Define diffSum as a simpler catamorphism. 2017-09-09 16:09:55 +01:00
Rob Rix
9f795e0c54 Define an environment type. 2017-09-09 16:08:54 +01:00
Rob Rix
4c2ce050de Define a metavariable type. 2017-09-09 15:52:33 +01:00
Rob Rix
24914eeb05 Move the remaining Listable instances into the tests. 2017-09-09 14:51:37 +01:00
Rob Rix
3ad5374b94 Move all the Listable stuff into the tests. 2017-09-09 14:44:57 +01:00
Rob Rix
f01c65a0a2 Define a function computing the list of patches in a diff. 2017-09-09 14:23:20 +01:00
Rob Rix
0282bf1dae Define a Listable instance for Diff. 2017-09-09 13:48:48 +01:00
Rob Rix
63f2961e4b Define a Listable1 instance for Diff. 2017-09-09 13:48:25 +01:00
Rob Rix
32984965f8 Add Patch to the Listable2 instance for DiffF. 2017-09-09 13:47:51 +01:00
Rob Rix
a4e98d4318 Define a Listable instance for DiffF. 2017-09-09 13:46:21 +01:00
Rob Rix
6c744336a8 Define a Listable1 instance for DiffF. 2017-09-09 13:45:52 +01:00
Rob Rix
923a39faae Define Listable instances for TermF & Term. 2017-09-09 13:45:22 +01:00
Rob Rix
fa5aeb6ee6 Define a Listable2 instance for DiffF. 2017-09-09 13:44:07 +01:00
Rob Rix
1e6bd6e27e Define a Traversable instance for Diff. 2017-09-09 13:41:10 +01:00
Rob Rix
ff1cc394c4 Define a Foldable instance for Diff. 2017-09-09 13:40:07 +01:00
Rob Rix
a9ac82819c Give a different instance of Functor for Diff. 2017-09-09 13:39:04 +01:00
Rob Rix
8df8b345e7 Define a Bitraversable instance for DiffF. 2017-09-09 13:37:11 +01:00
Rob Rix
e42152dca8 Define a Bifoldable instance for DiffF. 2017-09-09 13:35:59 +01:00
Rob Rix
2094dd059b Derive Foldable & Traversable instances for DiffF. 2017-09-09 13:34:08 +01:00
Rob Rix
48175bb9b0 Define a Show instance for Diff. 2017-09-09 12:35:20 +01:00
Rob Rix
0df5175798 Define a Show1 instance for Diff. 2017-09-09 12:34:47 +01:00
Rob Rix
e7735ad131 Define an Eq instance for Diff. 2017-09-09 12:33:35 +01:00
Rob Rix
b4e02d41fd Define an Eq1 instance for Diff. 2017-09-09 12:33:09 +01:00
Rob Rix
03eb93db31 Define an Eq instance for DiffF. 2017-09-09 12:31:58 +01:00
Rob Rix
2f63aca72f Define an Eq1 instance for DiffF. 2017-09-09 12:31:30 +01:00
Rob Rix
f65fb137fa Define a Show instance for DiffF. 2017-09-09 12:31:04 +01:00
Rob Rix
e68d46081c Define a Show1 instance for DiffF. 2017-09-09 12:30:33 +01:00
Rob Rix
6837ee44e4 Define a Show2 instance for DiffF. 2017-09-09 12:30:06 +01:00
Rob Rix
33192c3ce0 Define lifted showing of Both. 2017-09-09 12:28:54 +01:00
Rob Rix
cd154559c4 Reformat the exports from Both. 2017-09-09 12:28:47 +01:00
Rob Rix
af31840ee9 Define an Eq2 instance for DiffF. 2017-09-09 12:24:55 +01:00
Rob Rix
221cf89b5b Derive Eq1 & Show1 instances for Patch. 2017-09-09 12:24:48 +01:00
Rob Rix
dab0e4d044 Define a Show1 instance for Syntax. 2017-09-09 12:15:54 +01:00
Rob Rix
7ca2e9ed4d Define a Traversable instance for Term. 2017-09-09 12:04:37 +01:00
Rob Rix
748ecbb104 Define a Bitraversable instance for TermF. 2017-09-09 12:03:55 +01:00
Rob Rix
ce02539dab Define a Foldable instance for Term. 2017-09-09 12:02:11 +01:00
Rob Rix
a358be60cc 🔥 a redundant Functor constraint. 2017-09-09 12:01:17 +01:00
Rob Rix
cfd583cd51 Define a Bifoldable instance for TermF. 2017-09-09 12:00:28 +01:00
Rob Rix
2454096b2b Spacing. 2017-09-09 12:00:21 +01:00
Rob Rix
3e496176cc Use the copy helper widely. 2017-09-09 11:57:56 +01:00
Rob Rix
30fe4d520b Define a copy helper. 2017-09-09 11:54:29 +01:00
Rob Rix
69cba8430f 🔥 wrapTermF. 2017-09-09 11:53:57 +01:00
Rob Rix
9d1d1717d9 Rename tailF to termSyntax. 2017-09-09 11:51:41 +01:00
Rob Rix
e2ffba2401 Rename headF to termAnnotation. 2017-09-09 11:50:29 +01:00
Rob Rix
b7e211c9c2 Redefine Term as a wrapper for TermF. 2017-09-09 11:47:10 +01:00
Rob Rix
1267fe5ea7 Rename the In constructor to Copy. 2017-09-09 11:27:04 +01:00
Rob Rix
9e40e9a09a Give our own definition of Diff. 2017-09-09 11:23:57 +01:00
Rob Rix
adf884def0 Rename expr to syntax. 2017-09-08 17:41:31 +01:00
Rob Rix
14e8bb46ec 🔥 UndecidableInstances in Assignment. 2017-09-08 17:40:54 +01:00
Rob Rix
e4c5d6bb82 Rename the Term/TermF type parameters. 2017-09-08 17:40:35 +01:00
Rob Rix
20758f1c31 🔥 the orphan instance disabling in Diff. 2017-09-08 17:38:51 +01:00
Rob Rix
c551923eff 🔥 some unnecessary extensions. 2017-09-08 17:38:35 +01:00
Rob Rix
d5af300094 Specialize the Pretty1 instance for Term to only apply to Terms of Unions. 2017-09-08 17:38:12 +01:00
Rob Rix
07bef3f75e 🔥 deepseq. 2017-09-08 17:35:55 +01:00
Rob Rix
d1ced22ce8 🔥 the NFData instances for Term. 2017-09-08 17:32:24 +01:00
Rob Rix
0ce48d5248 🔥 the NFData instances for Diff. 2017-09-08 17:32:05 +01:00
Rob Rix
ec8f535b2a Define decidable NFData instances. 2017-09-08 17:31:17 +01:00
Rob Rix
9e4ae0ee34 Rename cofree to term. 2017-09-08 17:23:16 +01:00
Rob Rix
dfccae778a Rename hoistCofree to hoistTerm. 2017-09-08 17:21:39 +01:00
Rob Rix
a16c6e4f75 Extract union pretty-printing to the top level. 2017-09-08 17:20:55 +01:00
Rob Rix
053954cc97 🔥 alignTermWith. 2017-09-08 17:18:46 +01:00
Rob Rix
ee27d73747 🔥 zipTerms. 2017-09-08 17:18:03 +01:00
Rob Rix
fe3fa0e811 Define Pretty, Pretty1, & Pretty2 instances for TermF. 2017-09-08 17:02:30 +01:00
Rob Rix
c358bfad08 Define a Show1 instance for TermF. 2017-09-08 17:00:09 +01:00
Rob Rix
0ca7a4bdcf Define a Show2 instance for TermF. 2017-09-08 16:59:40 +01:00
Rob Rix
3231b16399 Define Term printing via Show1. 2017-09-08 16:58:15 +01:00
Rob Rix
a8f0a965c3 Give fixity for :<<. 2017-09-08 16:56:29 +01:00
Rob Rix
d572c64b32 Define Term equality via Eq1. 2017-09-08 16:55:36 +01:00
Rob Rix
ea5107c484 Define Listable instances for Term/TermF. 2017-09-08 16:50:21 +01:00
Rob Rix
185818d8bd Rename runCofree to unTerm. 2017-09-08 16:46:35 +01:00
Rob Rix
f2cd05d5fc Rename Cofree/CofreeF to Term/TermF. 2017-09-08 16:45:08 +01:00
Rob Rix
aa9d4c4f19 Give our own definition of CofreeF. 2017-09-08 16:40:23 +01:00
Rob Rix
1a6af2179b Give our own definition of Cofree. 2017-09-08 16:24:11 +01:00
Rob Rix
a296ec4ca3 Re-enable the orphan instance warning in Term. 2017-09-08 15:54:35 +01:00