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

27872 Commits

Author SHA1 Message Date
Josh Vera
bfb844a3b5 Merge branch 'master' into alephd-feature-flag 2019-03-04 13:14:31 -05:00
Timothy Clem
76dbbf8aae Merge pull request #2415 from github/alephd-improvements
Alephd improvements
2019-03-04 10:13:02 -08:00
Patrick Thomson
6eb1fe3403 WIP 2019-03-04 12:54:21 -05:00
Patrick Thomson
8285c3f680 WIP 2019-03-04 12:00:19 -05:00
Timothy Clem
656e962027 Merge branch 'master' into alephd-improvements 2019-03-04 08:29:40 -08:00
Patrick Thomson
ae8b87a19c Bump fused-effects version. 2019-03-04 10:47:31 -05:00
Rob Rix
cd52b5d932 Update src/Semantic/Api/Bridge.hs
Co-Authored-By: patrickt <patrickt@github.com>
2019-03-04 10:44:20 -05:00
Patrick Thomson
aa2f6b2391 use #? properly 2019-03-04 10:34:48 -05:00
Patrick Thomson
9a71bdcc32 English is hard. 2019-03-04 10:31:43 -05:00
Patrick Thomson
5205e44e1c One more clarification in the docs. 2019-03-02 01:56:13 -05:00
Timothy Clem
a558067129 Merge branch 'master' into alephd-improvements 2019-03-01 15:18:58 -08:00
Patrick Thomson
86607363cf Merge branch 'master' into pattern-synonyms-for-blobpair 2019-03-01 18:04:36 -05:00
Rick Winfrey
bc1b8a438d Merge pull request #2416 from github/env-var-name-update
Small correction to env var
2019-03-01 14:23:31 -08:00
Patrick Thomson
ebbe50a080 Stray import 2019-03-01 16:54:02 -05:00
Patrick Thomson
6a0c0e67c5 Document APIConvert and APIBridge. 2019-03-01 16:45:26 -05:00
Patrick Thomson
37d697f0da Remove unlawful lens. 2019-03-01 16:38:37 -05:00
Patrick Thomson
c316b20f07 Isolate the pattern of a ^? re b into its own combinator. 2019-03-01 16:25:59 -05:00
Josh Vera
403c97abf3 Merge branch 'master' into env-var-name-update 2019-03-01 16:19:03 -05:00
Patrick Thomson
a66407ec02 Merge remote-tracking branch 'origin/master' into converting-api-rfc 2019-03-01 16:17:03 -05:00
Patrick Thomson
e5563f39d5 Merge branch 'master' into pattern-synonyms-for-blobpair 2019-03-01 16:16:53 -05:00
Patrick Thomson
f7aa57a123 Merge pull request #2414 from github/bump-python-ts
Bump python-tree-sitter to avoid dirty worktrees.
2019-03-01 16:16:36 -05:00
Josh Vera
734fa692e2 Merge branch 'master' into alephd-feature-flag 2019-03-01 15:35:36 -05:00
Patrick Thomson
83322e9f94 Fix lints. 2019-03-01 15:28:22 -05:00
Patrick Thomson
b92d9a5382 Rename Helpers to Bridge. 2019-03-01 15:27:13 -05:00
Patrick Thomson
7204da3951 RFC: unified interface for converting API/legacy/native types.
As we've brought up a Twirp-based API, we've found a need to convert
between several different "views" of the same data, such as position
or span information. Because all protobuf fields are optional, we have
to juggle the `Maybe` values associated with the protobuf fields that
we are converting. While I think this approach has merit, there is a
complexity overhead associated with these conversions: we currently
have around ten ad-hoc functions that perform these conversions, often
containing superfluous `Maybe`s for the sake of convenience.

I've replaced these ad-hoc functions with two classes: `APIBridge` and
`APIConvert`. An instance of `APIBridge` between types `a` and `b`
means that we can convert between `a` and `b` and vice versa
losslessly; in other words, there is an isomorphism between them.
`APIConvert` means that you can convert from an `a` to a `b`, but you
may not be able to convert from all `b`s to an `a` (such as in the
case of missing fields); in other words, there is a partial isomorphism.

These are implemented with concepts from `lens`, namely an `Iso` for
`APIBridge` and a `Prism` for `APIConvert`.

Advantages of this approach:
* Lawful API. We can now clearly delineate the fact that converting a
  native data type to an API data type always succeeds, but the
  reverse may fail: an API `Span` may have missing position
  information, and we want to handle that explicitly, rather than
  paper over it with these helper functions. Both the APIBridge and
  APIConvert typeclasses provide a set of strong laws re. behavior,
  since they provide a lens-y interface.
* Unified API. No longer do we have to juggle a set of functions in
  our heads - no need to choose between `spanToSpan`,
  `spanToLegacySpan`, or `apiSpanToSpan`. `converting` and `bridging`
  do the work for you. Everything is much cleaner.
* Fewer partial functions. The converter from API blob pairs to native
  blob pairs no longer calls `error`, which is definitely a good
  thing.
* Historical precedent. Prisms and isomorphisms are a fluent way to
  express data transformations; the team behind Minecraft uses
  isomorphisms and prisms [to transfer data between versions][minecraft].

Disadvantages:
* Complexity overhead. You have to learn about prisms, reviews,
  isomorphisms, neither of which is the world's hardest concept but
  which take a little while to internalize.
* This might be polymorphism for polymorphism's sake.

Something we could do is postpone this patch until I have a chance to
give a lens tutorial in a Codex.

[minecraft]: https://github.com/Mojang/DataFixerUpper
2019-03-01 14:17:23 -05:00
Patrick Thomson
39ff80f652 Merge branch 'bump-python-ts' into converting-api-rfc 2019-03-01 14:01:40 -05:00
Patrick Thomson
2eb1280681 WIP 2019-03-01 14:01:27 -05:00
Patrick Thomson
e7c4884cb6 Otiose parentheses. 2019-03-01 13:00:12 -05:00
Patrick Thomson
77672564eb unused imports 2019-03-01 12:58:51 -05:00
Patrick Thomson
a2772e4338 Bump python-tree-sitter so to avoid dirty worktrees.
Because of Python grammar changes, this removes the `Identifier'` token.
2019-03-01 12:53:19 -05:00
Patrick Thomson
f29f26cc71 Fix some errors that crept in. 2019-03-01 12:36:16 -05:00
Patrick Thomson
079ce8baa0 Eliminate other places where These leaked to implementation. 2019-03-01 11:52:21 -05:00
Patrick Thomson
c41d60548c Use pattern synonyms in API helpers. 2019-03-01 11:50:46 -05:00
Patrick Thomson
060c8f50ff Refactor: use pattern synonyms to construct BlobPairs.
The `BlobPair` type is defined as an alias for `Join These Blob`. Though
this sacrifices a degree of type safety, it's extremely convenient, as
you can get to a Functor and Bifunctor instance very quickly.
Pattern-matching on `BlobPair` is less elegant though, as it requires
a nested Join then a match on `These`, which is not immediately
indicative of what a given pair might do.

This adds pattern synonyms for the `Inserting`, `Deleting`, and
`Diffing` cases, and removes the less-expressive functions returning such.
2019-03-01 11:19:24 -05:00
joshvera
a7a975f00b Merge remote-tracking branch 'origin/master' into alephd-feature-flag 2019-02-28 17:47:27 -05:00
joshvera
7dad030d34 Update repository push proto schema using twirp-haskell 2019-02-28 16:05:00 -05:00
Timothy Clem
4b449170f0 Merge pull request #2407 from github/bump-alephd-resources
Give alephd a few more resources
2019-02-28 09:07:23 -08:00
Josh Vera
6de8ae0128 Merge branch 'master' into bump-alephd-resources 2019-02-28 10:46:07 -05:00
Josh Vera
3df675606d Merge pull request #2406 from github/rename-aleph-flags
Rename env flags to have an ALEPHD prefix
2019-02-28 10:45:29 -05:00
Josh Vera
b525bad1ba Merge branch 'master' into rename-aleph-flags 2019-02-27 18:23:56 -05:00
Timothy Clem
d0c6513d30 Merge pull request #2405 from github/alephd-github-api
Allow querying regular github.com api
2019-02-27 15:09:53 -08:00
Josh Vera
fb4aaf9a53 Merge branch 'master' into rename-aleph-flags 2019-02-27 18:02:05 -05:00
Timothy Clem
229592411a Merge branch 'master' into alephd-github-api 2019-02-27 14:55:37 -08:00
Timothy Clem
59ab1c7758 Merge pull request #2404 from github/slurp-enhancements
Slurp enhancements to publish RepositoryPush Event to kafka
2019-02-27 14:55:27 -08:00
Timothy Clem
1ad07234c9 Merge branch 'master' into slurp-enhancements 2019-02-27 14:08:21 -08:00
Josh Vera
1e52628324 Merge pull request #2403 from github/kafka-config-changes
Add env vars for kafka broker and topic name
2019-02-27 16:53:38 -05:00
Patrick Thomson
aa197eb107 Something in that last revision made licensed segfault. 2019-02-27 16:18:42 -05:00
Rick Winfrey
e7942347b7 Merge branch 'master' into kafka-config-changes 2019-02-27 13:09:02 -08:00
Rick Winfrey
b8c25e0bab Merge pull request #2401 from github/indexer-setup
Wrap up alephd-setup
2019-02-27 12:56:19 -08:00
Patrick Thomson
fd76bfe42f After removing --depth=1. 2019-02-27 15:34:47 -05:00