1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00
Commit Graph

206 Commits

Author SHA1 Message Date
Josh Vera
50d96751e3 Merge branch 'master' into alephd-threading 2019-03-14 12:02:04 -04:00
joshvera
29b774c22d WIP async effect 2019-03-12 18:41:20 -04:00
Timothy Clem
498bd79f25 Start vertex ids at 1 2019-03-11 13:10:37 -07:00
Patrick Thomson
9fbc0ea0d0 Merge branch 'master' into bump-fused-effects-03-03-2019 2019-03-07 09:38:16 -05:00
Patrick Thomson
2fa32624ac lints 2019-03-06 10:43:12 -05:00
Patrick Thomson
4cfcda5aaf WIP 2019-03-05 16:22:59 -05: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
Patrick Thomson
ebbe50a080 Stray import 2019-03-01 16:54:02 -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
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
2eb1280681 WIP 2019-03-01 14:01:27 -05:00
Timothy Clem
cc78c0d8d5 Case Api as generated 2019-02-12 12:49:34 -08:00
Timothy Clem
6083803d68 Bring in twirp-haskell and generate everything from protos 2019-02-08 13:52:34 -08:00
Timothy Clem
ed47f27c1f Fix lints now that we are on a newer version of hlint 2019-02-04 15:19:21 -08:00
Timothy Clem
d3330aa9f3 Dedicated input types for Blob and BlobPair 2019-01-28 14:37:50 -08:00
Timothy Clem
1faff05a2b Remove some un-used code 2019-01-25 10:12:38 -08:00
Timothy Clem
55bcef9093 Enum for change type 2019-01-24 12:53:30 -08:00
Timothy Clem
29e9678572 diff graphs (adj list format) in the twirp api 2019-01-23 14:10:15 -08:00
Timothy Clem
6befe07ea3 Remove rest of old diff renderers and Diff.hs 2019-01-22 12:05:45 -07:00
Timothy Clem
5e6d0240b2 Use the new diff api from the CLI, fix up tests again 2019-01-22 11:42:06 -07:00
Timothy Clem
dad86f11e7 No more TermRenderer and all tests passing 2019-01-18 15:54:55 -08:00
Timothy Clem
9f222adcd3 Show and Quiet outputs 2019-01-18 12:37:49 -08:00
Timothy Clem
f23110a73a Transition sexpression term rendering 2019-01-18 09:29:51 -08:00
Timothy Clem
45df906304 Not using these 2019-01-17 16:40:16 -08:00
Timothy Clem
d39b019c3b Get the structure right for new toc summaries response 2019-01-17 16:30:48 -08:00
Timothy Clem
15643e1d4f Switch over ToCDiffRenderer (will fix the tests next) 2019-01-17 15:58:49 -08:00
Timothy Clem
e3afd9d684 Symbol rendering is entirely on the new path 2019-01-17 15:13:39 -08:00
Timothy Clem
8346f6aaa2 Start to fill out toc summaries endpoint 2019-01-16 15:49:36 -08:00
Timothy Clem
d80098615d Fill out rest of languages, little bit of cleanup 2019-01-16 10:52:31 -08:00
Timothy Clem
26b771715f Wire in Twirp ping and symbols endpoints, disable grpc entirely 2019-01-15 08:45:20 -08:00
Patrick Thomson
1302fe4ac8 Use -XDerivingVia to clean up our Semigroup/Monoid instances.
Now that we're on GHC 8.6, we can use `-XDerivingVia` in many cases
where we previously had to write instances by hand. If you're not
familiar with `-XDerivingVia`, the [GHC proposal][ghc] is a good place
to start.

[ghc]: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0023-deriving-via.rst

Thanks to the `generic-monoid` package, we can derive a `Semigroup`
instance for any product type whose members are `Semigroups`, and the
same goes for `Monoid`. This entails an extra dependency, but it is
better than the `generic-deriving` package, which is way too much overhead.
I've also switched some trivial definitions to newtype-deriving.

Please be aware that this bumps `hlint` and `haskell-src-exts` so that
`hlint` doesn't choke on the `DerivingVia` extension. You'll need to
`stack install hlint` to get it on your `PATH`. Apologies!
2019-01-07 11:23:11 -05:00
Timothy Clem
2e1626d949 Make symbols output also return partial results 2018-11-13 11:02:23 -08:00
Timothy Clem
d33b4a5f3d Better error structure for Tocs 2018-11-10 09:40:29 -08:00
Timothy Clem
09e6046763 Be consistent with other responses 2018-11-10 09:40:19 -08:00
Timothy Clem
bc9f85fdef Catch errors for some diff outputs 2018-11-09 16:44:10 -08:00
Timothy Clem
57f284f847 Streamline the declarations for toc summaries 2018-11-08 08:33:26 -08:00
Timothy Clem
fa60a394b4 Fully commit to new method of generating symbols 2018-11-05 08:03:09 -08:00
Timothy Clem
92f9f8373e Render to same output format, respecting field choice 2018-11-01 15:48:47 -07:00
Timothy Clem
460ea0cf67 Rough, but WORKING symbols output with doc strings 2018-11-01 14:31:19 -07:00
Timothy Clem
77f5b0a1d6 Introduce new renderToSymbols 2018-11-01 07:55:34 -07:00
Rob Rix
034e2469ff Bump higher-order-effects. 2018-10-22 10:26:15 -04:00
Rob Rix
3ef2efa73a Merge branch 'master' into higher-order-effects 2018-10-22 09:45:57 -04:00
Rob Rix
c9e6912068 Port most of the system over to higher-order-effects. 2018-10-16 18:48:08 -04:00
Timothy Clem
7663c46d79 New cli switch for quiet parsing with timing stats 2018-10-12 12:47:11 -07:00
Timothy Clem
ac70c565cc Change up what Declarations we identify 2018-10-05 09:54:57 -07:00
Timothy Clem
35d77b505e Revert tableOfContentsBy removal of extra Maybe 2018-09-27 13:05:11 -05:00
Timothy Clem
1913277e74 Replace the annotation necessary for toc
Includes span in Declaration, refactors toc functions to remove a layer of maybe
2018-09-26 13:54:16 -05:00