1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00
Commit Graph

82 Commits

Author SHA1 Message Date
Patrick Thomson
911066aaed Use fused-effects's foldMapA. 2019-11-08 16:24:50 -05:00
Rob Rix
a05533fd19
🔥 NFData & NFData1 instances wherever they may be found.
Also some Generic instances.
2019-10-25 13:52:07 -04:00
Rob Rix
9813bdd5f0
🔥 the re-export of Data.These from Prologue. 2019-10-18 11:29:03 -04:00
Rob Rix
29ceb4c8d6
Don’t export Both in the Prologue. 2019-10-18 10:26:20 -04:00
Patrick Thomson
56e0c27846 Stray whitespace. 2019-09-20 16:52:34 -04:00
Patrick Thomson
aa61e7f565 We don't even need to define our own #. 2019-09-20 16:50:25 -04:00
Patrick Thomson
803817bc92 Whoops, forgot a plugin entry. 2019-09-20 16:47:07 -04:00
Patrick Thomson
8bf42329a4 Speed up foldMapA.
Some research in https://github.com/fused-effects/diffused-effects/pull/1
revealed that GHC sometimes fails to optimize newtype-unwrappers of
the foldMapA style sufficiently, and that you get better Core if you
rub some `coerce` on it. Since we use `foldMapA` in a lot of places,
this should have a positive impact.
2019-09-20 16:44:44 -04:00
Patrick Thomson
5f719f7d17 Restore deleted comment. 2019-02-05 13:54:07 -05:00
Patrick Thomson
76a6b21d77 Better benchmarks + strategic inlining. 2019-02-04 16:56:31 -05:00
Patrick Thomson
55d22b1a0e FatalException doesn't have to be in there 2019-01-25 00:19:06 -05:00
Patrick Thomson
9c44ad374c attempt to clean up the indexer 2019-01-15 13:57:52 -05:00
Josh Vera
25f0adc9cd Merge branch 'master' into indexer-prototype 2019-01-14 13:24:15 -05:00
Patrick Thomson
716da369fe Add fromRight/fromLeft to Prologue and according hlint rules.
These are new in base-4.10; I had no idea they existed until Rob
pointed them out. This adds them to the Prologue and institutes hlint
rules to suggest when we can use them.
2019-01-11 12:49:56 -05:00
Patrick Thomson
1f4a24b569 Merge remote-tracking branch 'origin/master' into indexer-prototype 2019-01-11 12:28:29 -05:00
Patrick Thomson
f750f2952a Remove 'both' function. 2019-01-10 15:53:15 -05:00
Patrick Thomson
39bdfdf01f Add Hydro data types corresponding to proposed push schema.
Provides a `Push` type. To build that, we needed `RequestContext`,
`UserType`, `RequestMethod`, `Spamurai`, `Timestamp`, and `IPVersion`.

The schemas have all been taken from https://github.com/github/hydro-schemas/.
2019-01-08 13:55:09 -05: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
joshvera
8dd5a7e295 WIP remove current scope and frame from Heap and ScopeGraph
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-28 13:31:40 -05:00
Patrick Thomson
688219e380 Arrow instance, why not 2018-11-05 11:06:59 -05:00
Patrick Thomson
3caa753808 Add Data.Coerce to the Prologue.
This is ubiquitous enough that we should just export it.
2018-10-30 15:12:45 -04:00
Rob Rix
4531c9afc7 🔥 Prologue’s re-export of MonadError. 2018-10-25 10:21:14 -04:00
Rob Rix
131cae4d7b Merge branch 'master' into higher-order-effects 2018-10-24 14:04:13 -04:00
Patrick Thomson
ef696d3c41 Split up Semantic.IO.
This looks like a big patch, but it's very straightforward: no
behavior has changed.

After the umpteenth time spent hitting a compile error because I
passed a `FilePath` rather than a `File` to `readBlobFromPath`, I
decided to finally make the needed refactors to Semantic.IO, and to
split off the `File` type and `Files` effect. This patch:

* adds the `MonadIO` class to `Prologue`'s export list
* moves `File` into `Data.File`
* moves `Handle` into `Data.Handle`
* moves `Files` into `Semantic.Task.Files`
* moves functions for reading blobs into `Data.Blob`
* keeps general IO helpers in Semantic.IO
* renames `readFile` to `readBlobFromFile`
* renames `readBlobFromPath` to `readBlobFromFile'`

This should have a positive effect on compile times and ease of
navigation throughout the codebase.
2018-10-23 15:37:49 -04:00
Rob Rix
3ef2efa73a Merge branch 'master' into higher-order-effects 2018-10-22 09:45:57 -04:00
Patrick Thomson
ac543651ee Add NFData instances to enable more accurate benchmarking.
Because we're getting serious about benchmarking in the run-up to
Windrose, it's time to bring in the `deepseq` package to ensure that
benchmarks can fully evaluate the result of a test case.

The `deepseq` package provides an `NFData` typeclass:

```
class NFData a where
  rnf :: a -> ()
```

Instances use the `seq` combinator to ensure that the argument to
`rnf` is fully evaluated, returning (). If there is a `Generic`
instance for `a`, the implementation can be omitted. This patch adds
NFData for every syntax node, graph vertex, environment data
structures, and exceptions. It is long, but the work is very
straightforward, so don't panick.

The benchmark suite (`stack bench`) now produces more accurate
results. The benchmarks previously mimicked `rnf` by calling `show` on
the result of an evaluation or graph construction; now that we have
actual `NFData` instances we can use the `nfIO` combinator from
criterion. This has sped up the evaluation benchmarks and reduced
their memory consumption, while it has slowed down the call graph
benchmarks, as those benchmarks weren't evaluating the whole of the
graph.

Unfortunately, this patch increases compile times, as we have to
derive a few more Generic instances. I wish this weren't the case, but
there's little we can do about it now. In the future I have some plans
for how to reduce compile time, and I bet that those gains will at
least nullify the speed hit from this patch.

Now that we have NFData instances for every data type, we can start
benchmarking assignments, in preparation for fixing #2205.

This patch also pulls in updates to `effects` and `fastsum` that add
appropriate NFData instances for the data they vend.
2018-10-17 14:08:47 -04:00
Rob Rix
c9e6912068 Port most of the system over to higher-order-effects. 2018-10-16 18:48:08 -04:00
Rob Rix
a66788c682 Only re-export Generic/Generic1. 2018-10-12 17:54:57 -04:00
Patrick Thomson
0802e0a9f2 Use a deep embedding for Tokenize. 2018-09-11 18:54:37 -04:00
Rob Rix
e5051bb021 Don’t re-export Mergeable. 2018-07-20 09:50:43 -04:00
Rob Rix
ccbd880155 Re-export Lower in Prologue. 2018-06-15 11:41:15 -04:00
Rob Rix
54150552b3 Merge branch 'master' into 🔥-galign 2018-05-29 08:53:37 -04:00
Patrick Thomson
dafb3edaf5 Merge remote-tracking branch 'origin/master' into update-fastsum 2018-05-16 18:26:43 -04:00
Patrick Thomson
322f348103 inj -> inject 2018-05-16 18:25:02 -04:00
Patrick Thomson
6b0198cb00 Remove otiose -Sum prefixes from all Data.Sum operations.
There are no modules where we use both Union.inj and Sum.injectSum; as
such, it seems clumsy for such ubiquitous functions as inj and prj to
have such long names when there is no ambiguity. This restores the
codebase to much how it looked before we switched back to a richer
Data.Union.
2018-05-16 15:27:08 -04:00
Rob Rix
e3b8915711 Re-export Hashable1. 2018-05-16 14:43:58 -04:00
Patrick Thomson
2c4e3a0ca7 just don't export Trace at all 2018-05-08 12:06:34 -04:00
Patrick Thomson
e9feb98835 Convert Graph and Task to use effectful traces.
This also removes `trace` from Prologue, since the monadic version is better.
2018-05-08 11:48:00 -04:00
Rob Rix
ebc8e01cc4 Use our own local definition of Sum. 2018-05-02 12:00:15 -04:00
Rob Rix
ba52638f40 🔥 maybeFail. 2018-04-24 11:48:43 -04:00
joshvera
aa3b2a0532 Add fromMaybeLast and maybeLast 2018-04-16 15:48:45 -04:00
Rob Rix
dd884e7615 🔥 all the instances of GAlign. 2018-04-09 16:17:16 -04:00
joshvera
adc5a54d45 Beautify Prologue to test 2018-03-22 13:01:25 -04:00
Patrick Thomson
9d5ace795b Take a pass at fixing/silencing linter hints.
Since @charliesome was expressing trouble with keeping custom infix
operator precedence straight (a very fair complaint, and one that I
have trouble with too), I thought it best to make sure that master
builds with clean hlints. I propose we make CI check that `hlint src`
executes cleanly.
2018-03-20 10:41:53 -04:00
Patrick Thomson
0f0ae1077d Merge remote-tracking branch 'origin/master' into bitwise 2018-03-16 10:06:30 -04:00
Patrick Thomson
8359d4d3e4 oops 2018-03-15 16:32:48 -04:00
Patrick Thomson
9cbad7ef8f Merge remote-tracking branch 'origin/master' into maybem 2018-03-15 16:31:24 -04:00
Patrick Thomson
1ab4bd0c9d Add maybeM and maybeFail.
`maybeM act may` returns the `Just` in `may` or runs `act`.
`maybeFail str may` fails with `str` as an error or extracts the `Just`.

These combinators are so useful that I don't know why they're not in
the Prelude or some library. I use them constantly.
2018-03-15 16:25:53 -04:00
Rob Rix
c81fafb184 Move foldMapA into the Prologue. 2018-03-15 16:14:51 -04:00
Patrick Thomson
a6346525e6 Add Evaluatable instance for Bitwise operators.
Would have been nice to reuise liftNumeric and liftNumeric2, but it's
not clear what it means to take bitwise components of rational or
floating-point numbers.
2018-03-14 11:25:06 -04:00