1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 11:02:26 +03:00
Commit Graph

3789 Commits

Author SHA1 Message Date
Timothy Clem
2e1626d949 Make symbols output also return partial results 2018-11-13 11:02:23 -08:00
Timothy Clem
57f284f847 Streamline the declarations for toc summaries 2018-11-08 08:33:26 -08:00
Timothy Clem
8c0dd6d3b5 Just return the first line if function defs span multiple lines 2018-11-07 11:48:50 -08:00
Timothy Clem
343289f1c5 Merge remote-tracking branch 'origin/master' into docstrings-round2 2018-11-06 09:17:49 -08:00
Patrick Thomson
bdc5db555b rename and prune 2018-11-05 16:56:49 -05:00
Timothy Clem
e14f59b165 Re-generate test with addition of statements in python assignment 2018-11-05 13:12:50 -08:00
Timothy Clem
bdb7ee0430 More tests 2018-11-05 13:09:37 -08:00
Timothy Clem
d0fc88efee Some python specs for tags 2018-11-05 12:33:23 -08:00
Timothy Clem
0a9034e28f Space and docs 2018-11-05 07:57:21 -08:00
Patrick Thomson
292a268b00 better name for infix operator 2018-11-04 14:46:19 -05:00
Patrick Thomson
7ea52dbfe3 Give Control.Matching API better ergonomics.
Given that @tclem and I have found the matcher API frustrating, I've
taken a stab at improving its ergonomics, and I've found some success
in separating composition of matchers from predicate-based narrowing
thereof.

The biggest change here is the elimination of the old `match`
combinator, which proved to be clumsy in that it complected narrowing
and composition. Top-down matching combinators are now written with
the `need` combinator and the `>>>` combinator, which is more readable
and more versatile. Here's a matcher that accepts functions with
Python docstrings:

```haskell
docstringMatcher :: ( Decl.Function :< fs
                    , [] :< fs
                    , Lit.TextElement :< fs
                    , term ~ Term (Sum fs) ann
                    ) => Matcher term term
docstringMatcher = target <*
               (need Decl.functionBody
                >>> narrow @[]
                >>> mhead
                >>> narrow @Lit.TextElement
                >>> ensure Lit.isTripleQuoted))
```

Pretty readable, right? Each step of the tree regular expression -
choosing function bodies, ensuring said bodies are lists, examining
the first element, and choosing only TextElements containing
triple-quoted strings - is made implicit. The old way would have
looked something like this:

```haskell
docstringMatcher = target <* match Decl.functionBody
                           $ narrow
                           $ matchM listToMaybe
                           $ target <* ensure Lit.isTripleQuoted
```
which is a good deal more disorganized and less flexible
in the quite-common case of applying functions during a
matching pass. Separating the act of composition from
function application is a big win here.

Further comments are inline.
2018-11-02 19:25:29 -04:00
Timothy Clem
0f56f33f24 Introduce some symbol/tags tests 2018-11-02 13:55:30 -07:00
Timothy Clem
223298b86a Merge remote-tracking branch 'origin/master' into docstrings-round2 2018-11-02 12:54:21 -07:00
Timothy Clem
018dc73af9 Python assignment: conditionally include annotation on functions 2018-11-02 12:39:38 -07:00
Josh Vera
9f22607fc0 Merge branch 'master' into diff-via-fused-effects 2018-11-01 22:21:46 -04:00
Timothy Clem
4ef4c63851 I changed functions in python that don't have annotations 2018-11-01 17:48:27 -07:00
Patrick Thomson
514dacf756 Merge branch 'master' into add-data-coerce-to-prologue 2018-11-01 12:51:21 -04:00
Rob Rix
98805db943 Merge branch 'master' into diff-via-fused-effects 2018-10-31 18:39:24 -04:00
Patrick Thomson
aaf7bba187 And kill Doctests.hs. 2018-10-31 15:56:57 -04:00
Patrick Thomson
b9cf8f73c6 Environment and App. 2018-10-31 15:47:30 -04:00
Patrick Thomson
d473b9e1af add Data/Abstract/Name/Spec 2018-10-31 13:19:43 -04:00
Patrick Thomson
b0e6190dbf add Data/Range/Spec 2018-10-31 12:46:52 -04:00
Patrick Thomson
cd05aaa7a5 add Data/Graph/Spec 2018-10-31 12:30:56 -04:00
Patrick Thomson
27a9ae546a Merge branch 'master' into add-data-coerce-to-prologue 2018-10-31 09:09:37 -04:00
Rob Rix
c95822894e Merge branch 'master' into diff-via-fused-effects 2018-10-30 23:03:50 -04:00
Rob Rix
74f183921a Merge branch 'master' into break-dependency-of-config-on-SHA 2018-10-30 15:40:48 -04:00
Rob Rix
994464105c Merge branch 'master' into diff-via-fused-effects 2018-10-30 15:40:42 -04:00
Patrick Thomson
c4698ff96c Merge branch 'master' into add-data-coerce-to-prologue 2018-10-30 15:40:14 -04: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
4ec497b793 Use runTask when we aren’t setting the Options. 2018-10-30 14:49:07 -04:00
Patrick Thomson
6b476d0eb7 Add 'purely' combinator to Matching and rename it.
@tclem and I found ourselves wanting an arrow-like combinator that
promotes a given function to a Matcher. While I think an Arrow
instance is going a little overboard, there's no harm in adding a
'purely' function, the naming of which is commensurate with the
rewriting DSL.

This also renames the module, since there's not anything really
abstract about matching (indeed, it is quite concrete).
2018-10-30 11:04:11 -04:00
Rob Rix
898fa73969 Hide the import of Diff. 2018-10-29 11:19:40 -04:00
Rob Rix
131cae4d7b Merge branch 'master' into higher-order-effects 2018-10-24 14:04:13 -04:00
Rob Rix
15a8917c84 Simplify the FunctionC carrier instances. 2018-10-24 11:00:54 -04:00
Rob Rix
83ac081cec SomeError. 2018-10-24 10:32:05 -04:00
Rob Rix
512415db6a Fix the import of SomeError. 2018-10-24 10:11:27 -04:00
Rob Rix
b6252f82f5 SomeError, not SomeExc. 2018-10-24 10:11:18 -04:00
Rob Rix
90338e92fc Update the TOC spec for the new effect system. 2018-10-24 10:09:57 -04:00
Rob Rix
ee1491ab51 Fix namespaceScope. 2018-10-24 10:06:22 -04:00
Rob Rix
090a395bb6 Fix up the carrier type. 2018-10-24 10:05:22 -04:00
Rob Rix
fd1cc7d8cd Fix some other handlers. 2018-10-24 10:01:55 -04:00
Rob Rix
780d0a478b Rename the carrier. 2018-10-24 10:01:49 -04:00
Rob Rix
46ca8ac121 Fix a bunch of handlers. 2018-10-24 09:59:57 -04:00
Rob Rix
de9e610a2f Correct the name of the Trace carrier. 2018-10-24 09:58:35 -04:00
Rob Rix
ce37fd58f1 Fix some imports. 2018-10-24 09:58:06 -04:00
Rob Rix
647f960c26 Fix SpecEff. 2018-10-24 09:47:24 -04:00
Rob Rix
739426de50 Fix a couple of handlers. 2018-10-24 09:47:14 -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
a7f59e55bc SomeError, not SomeExc. 2018-10-22 09:53:59 -04:00
Rob Rix
3ef2efa73a Merge branch 'master' into higher-order-effects 2018-10-22 09:45:57 -04:00