1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 18:23:44 +03:00
Commit Graph

128 Commits

Author SHA1 Message Date
Rob Rix
80ce9ab357 Functions return values. 2018-12-07 14:30:47 -05:00
Rob Rix
36a7c31166 LoopControl operates on values, not ValueRefs. 2018-12-07 12:52:51 -05:00
Rob Rix
09d616788e Return holds a value, not a ValueRef. 2018-12-07 12:38:16 -05:00
Rob Rix
f9c124f303 Replace the address pair Reader with separate CurrentFrame/Scope Readers. 2018-12-06 12:03:07 -05:00
joshvera
781e52f843 Format and remove Environment 2018-12-05 10:14:16 -05:00
joshvera
9f6579edaf Fix call function test to test the value
Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-12-04 17:14:50 -05:00
Rob Rix
f75c2b14a1 Build function scopes in the Evaluatable instances. 2018-12-04 14:55:25 -05:00
joshvera
b35e1a0718 change Address to Slot in tests 2018-11-29 20:16:29 -05:00
joshvera
65a8949a06 Fix the shape of scope and heap outputs in testEvaluating
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-28 18:47:10 -05:00
joshvera
2b11d7aa2a Fix up python test and function args 2018-11-26 20:07:37 -05:00
joshvera
393da1897b Test position of slots
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-15 14:39:41 -05:00
joshvera
c7040f6131 fix test type errors
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-14 19:46:30 -05:00
joshvera
ce91cf71db Remove self argument from call effect
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-09 13:04:52 -05:00
joshvera
eebcc9c9ee Fix up runFunction carriers
function effect now takes parameters as terms

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-08 20:47:04 -05:00
joshvera
0c35a8a95c Start fixing up tests
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-07 18:27:56 -05:00
joshvera
1a6d7e77f3 Remove EnvironmentError from Evaluator/Spec
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-07 14:09:01 -05:00
Patrick Thomson
bdc5db555b rename and prune 2018-11-05 16:56:49 -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
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
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
15a8917c84 Simplify the FunctionC carrier instances. 2018-10-24 11:00:54 -04:00
Rob Rix
fd1cc7d8cd Fix some other handlers. 2018-10-24 10:01:55 -04:00
Rob Rix
647f960c26 Fix SpecEff. 2018-10-24 09:47:24 -04:00
Rob Rix
a7f59e55bc SomeError, not SomeExc. 2018-10-22 09:53:59 -04:00
Rob Rix
5c2dac35e8 Merge branch 'master' into first-order-closures 2018-09-27 13:37:25 -05:00
Rob Rix
0653832d9d Swap the order of the parameters to Value. 2018-09-25 16:38:05 -05:00
Rob Rix
2db44ac715 Fix the eval spec. 2018-09-25 14:41:57 -05:00
Timothy Clem
278e6890cd Fix up the tests 2018-09-25 11:18:51 -05:00
Rob Rix
038b56970e Parameterize Evaluator by the term type. 2018-09-20 12:43:59 -04:00
Patrick Thomson
2998c8f8cc last few changes 2018-09-19 11:03:59 -04:00
Patrick Thomson
efb0b0a0f7 Change Rule to RuleM and PureRule to Rule. 2018-09-18 17:33:01 -04:00
Patrick Thomson
3d1bccc3f4 cleaner tests 2018-09-18 15:45:17 -04:00
Patrick Thomson
9eb7fe5cd8 reenable all the tests 2018-09-18 13:18:31 -04:00
Patrick Thomson
f6f2476641 fix tests 2018-09-17 11:17:10 -04:00
Patrick Thomson
ec7ee9da62 improve JSON formatting so the diff doesn't whine 2018-09-17 10:52:28 -04:00
Patrick Thomson
d1cc400dc0 add spec file 2018-09-14 13:10:22 -04:00
joshvera
6b8c0c0f06 Merge remote-tracking branch 'origin/master' into entry-points 2018-08-27 12:49:47 -04:00
joshvera
bc6614aa12 Merge remote-tracking branch 'origin/master' into entry-points 2018-08-27 12:05:20 -04:00
Rob Rix
d21f0976f0 Run the boolean effect in the evaluator spec. 2018-08-23 13:08:38 -04:00
Charlie Somerville
ec852844cb reshuffle module layout so that Environment can depend on Heap 2018-08-21 13:42:45 +10:00
Rick Winfrey
54bc2a9521 🔥 unused exports 2018-08-13 15:43:23 -07:00
Rob Rix
68157b1fa0 Apply the correct value type. 2018-08-13 10:06:12 -04:00
Rob Rix
99e377aec7 Fix a missed reference to Deref in the specs. 2018-08-13 09:58:18 -04:00
Rob Rix
a438930c91 Use the specialized handlers for Allocator and Precise. 2018-08-13 09:43:37 -04:00
Rob Rix
f0d216da2c 🔥 the value parameter from Allocator. 2018-08-10 15:32:10 -04:00
Rob Rix
d05f3c6ae3 🔥 Data.Abstract.Address. 2018-08-10 13:46:24 -04:00
Rob Rix
6de89a8351 Merge branch 'master' into entry-points 2018-08-10 11:28:00 -04:00
Rob Rix
b19ea1ca01 Fix up the Evaluator spec. 2018-08-09 16:13:03 -04:00
Josh Vera
44ac28510c Merge branch 'master' into entry-points 2018-08-08 16:17:08 -04:00