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

5720 Commits

Author SHA1 Message Date
Rob Rix
113fb7ea1c Reformat Frame. 2018-12-06 10:33:06 -05:00
Rob Rix
fc19fa67db Use declareFunction to define both Function and Method evaluation. 2018-12-06 10:20:51 -05:00
Rob Rix
e65da03e85 No we should not. 2018-12-06 10:20:05 -05:00
Rob Rix
4913b252b8 Define a helper for declaring functions/methods. 2018-12-06 10:19:22 -05:00
Rob Rix
8ff61d8299 Simplify the ValueRoots instance for closures. 2018-12-06 10:09:50 -05:00
Rob Rix
46ab1d6b02 Use <$> again. 2018-12-05 15:56:00 -05:00
Rob Rix
7ca06eff7f Use <$>. 2018-12-05 15:55:41 -05:00
Rob Rix
cdb869e199 Functor law. 2018-12-05 15:55:13 -05:00
Rob Rix
0fe1f4db5f Use for_. 2018-12-05 15:54:22 -05:00
Rob Rix
a14cc79903 🔥 redundant parens. 2018-12-05 15:53:23 -05:00
Rob Rix
47c2dea759 Merge branch 'heap-frames' of https://github.com/github/semantic into heap-frames 2018-12-05 15:39:09 -05:00
Rob Rix
6bb5308697 Rename the ScopeGraph field to unScopeGraph. 2018-12-05 15:35:02 -05:00
Rob Rix
d98cb05d0b Pattern-match against the constructor. 2018-12-05 15:34:20 -05:00
Rob Rix
7badac6148 Spacing. 2018-12-05 15:32:18 -05:00
Rob Rix
0daef02edc Don’t use record wildcards to unpack ScopeGraph. 2018-12-05 15:32:06 -05:00
Rob Rix
dc2b94eef2 Align { to the next line. 2018-12-05 15:26:35 -05:00
Rob Rix
6bf9f08f63 🔥 a couple of redundant do-blocks. 2018-12-05 15:24:50 -05:00
Rob Rix
3d34922fe2 Tighten up reference with <$> and <|>. 2018-12-05 15:24:10 -05:00
Rob Rix
c90e1605fd Tighten up insertImportReference using <$> and <|>. 2018-12-05 15:20:08 -05:00
Rob Rix
12ccbf8f85 Move modifyReferences down. 2018-12-05 15:19:09 -05:00
Rob Rix
e8a9634339 Flip modifyReferences. 2018-12-05 15:18:53 -05:00
Rob Rix
1e12265292 Extract a function to modify a scope’s references. 2018-12-05 15:17:18 -05:00
Rob Rix
ebc1a83ed1 Factor out a common traverseEdges function. 2018-12-05 15:14:57 -05:00
joshvera
522c87e627 Merge branch 'heap-frames' of https://github.com/github/semantic into heap-frames 2018-12-05 15:09:46 -05:00
joshvera
eae6b7c8b3 Add tests for QualifedExportFrom 2018-12-05 15:07:37 -05:00
Rob Rix
05392f2296 simplify lookupScopePath using <$>. 2018-12-05 14:53:42 -05:00
Rob Rix
98107e05be Correct associatedScope using >>=. 2018-12-05 14:48:44 -05:00
Rob Rix
3a3fa0c541 Define associatedScope using foldr. 2018-12-05 14:42:53 -05:00
Rob Rix
38611d053c Simplify associatedScope using <$> and <|>. 2018-12-05 14:42:05 -05:00
Rob Rix
3c2a544a2d Define scopeOfDeclaration using a foldr. 2018-12-05 14:40:12 -05:00
Rob Rix
bc0c28477f Simplify scopeOfDeclaration using <$ and <|> . 2018-12-05 14:38:25 -05:00
Rob Rix
9a966a51f4 Use maybe. 2018-12-05 14:35:30 -05:00
Rob Rix
433e3dd04d Use maybeM. 2018-12-05 14:35:24 -05:00
Rob Rix
4a80c83275 Parens instead of dollar. 2018-12-05 14:34:09 -05:00
Rob Rix
c4477c05b7 🔥 a redundant dollar. 2018-12-05 14:33:33 -05:00
Rob Rix
5981de0f56 Redundant parens. 2018-12-05 14:33:01 -05:00
Rob Rix
b67708c9d3 🔥 redundant parens. 2018-12-05 14:32:02 -05:00
Rob Rix
34b5965554 Extract a defineSelf helper. 2018-12-05 14:29:00 -05:00
Rob Rix
0132a24e1b 🔥 ScopedTypeVariables. 2018-12-05 14:26:43 -05:00
Rob Rix
776ae3ebe1 🔥 a redundant language extension. 2018-12-05 14:25:09 -05:00
Rob Rix
af8ae29d7e Merge branch 'heap-frames' of https://github.com/github/semantic into heap-frames 2018-12-05 14:05:57 -05:00
Rob Rix
dda1706189 Implement object for Type. 2018-12-05 14:05:41 -05:00
joshvera
3a88a76d12 Remove super instance 2018-12-05 14:04:02 -05:00
joshvera
7c677f8625 Remove ScopedResolution instance 2018-12-05 13:55:52 -05:00
joshvera
4a350ece0b Remove old Call code 2018-12-05 13:53:30 -05:00
Rob Rix
ba070a6b46 Merge branch 'heap-frames' of https://github.com/github/semantic into heap-frames 2018-12-05 13:49:51 -05:00
joshvera
b319d0fb64 Implement TypeAlias instance 2018-12-05 13:46:32 -05:00
Rob Rix
95c1151cd2 Reintroduce heapLookupAll. 2018-12-05 13:44:47 -05:00
Rob Rix
664b3b2a9d Reintroduce heapLookup. 2018-12-05 13:44:42 -05:00
Rob Rix
b77dc95d4f Reintroduce heapRestrict. 2018-12-05 13:08:24 -05:00
joshvera
a2026e8ada Add valueRef tests back 2018-12-05 12:44:52 -05:00
joshvera
49e8a7004c Remove Exports 2018-12-05 10:23:42 -05:00
joshvera
0f8058d82a Remove NamespaceError 2018-12-05 10:20:41 -05:00
joshvera
073dca372d Remove Data.Abstract.Environment 2018-12-05 10:20:35 -05:00
joshvera
9fee3d5965 formatting 2018-12-05 10:20:17 -05:00
joshvera
5b198eb919 Implement Break and Continue 2018-12-04 19:22:29 -05:00
joshvera
5deda2a033 Implement and reopen ruby modules 2018-12-04 18:46:29 -05:00
joshvera
33b752a5aa Implement This eval instance
Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-12-04 17:01:30 -05:00
joshvera
ac1d2dbc95 Declare __self in Method instance
Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-12-04 17:01:19 -05:00
joshvera
793ec4b32d Define __self in preludes
Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-12-04 17:00:20 -05:00
joshvera
85f00a2904 Add defineBuiltIn
in order to construct an associated scope to pass to BuiltIn

Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-12-04 16:24:44 -05:00
joshvera
fa3adf19e6 Assign params within a frame in Abstract/Type semantics
Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-12-04 15:56:11 -05:00
Rob Rix
f75c2b14a1 Build function scopes in the Evaluatable instances. 2018-12-04 14:55:25 -05:00
Rob Rix
00c6bb2229 Note that we should be building the scope in define instead of in the Function carrier. 2018-12-04 14:34:40 -05:00
Rob Rix
bb2bcf6274 🔥 a redundant fresh. 2018-12-04 14:21:07 -05:00
Patrick Thomson
3502dadda6 fix build/lints 2018-12-04 13:24:15 -05:00
Rob Rix
dbf670d4ee Use deriving strategies for the Heap. 2018-12-04 13:12:25 -05:00
Rob Rix
9420d5cc96 🔥 a bunch of redundant bindings. 2018-12-04 13:12:18 -05:00
Rob Rix
c16385e20f 🔥 a bunch of redundant constraints. 2018-12-04 13:12:03 -05:00
Rob Rix
91fce6a246 🔥 a bunch of redundant imports. 2018-12-04 12:25:32 -05:00
joshvera
debefff57c Differentiate between Import and Superclass edge tests 2018-12-04 11:24:01 -05:00
Patrick Thomson
28b6cdb9b1 last few changes 2018-12-04 10:45:30 -05:00
Patrick Thomson
18e651cbc0 Merge remote-tracking branch 'origin/master' into tokenize-ruby 2018-12-04 10:40:01 -05:00
joshvera
4d134fd9aa putDeclarationScope should be robust
And look things up with respect to a current scope instead of traversing the key value pairs of the scope graph
2018-12-04 10:38:05 -05:00
joshvera
2544b100e1 Ignore Lexical, Import, and Export edges in declarationNames
Since we only use it for objectMembers in tests and those should only traverse superclass edges atm
2018-12-04 10:37:33 -05:00
joshvera
b88dde5d5e Traverse superclass edges 2018-12-04 10:37:03 -05:00
joshvera
6a27c20c9b Go back to declaring in Function syntax 2018-12-04 10:36:47 -05:00
joshvera
7f4d4d0c40 Declare in concrete function again
Fixes subclass associated scope issue in subclasses.py
2018-12-03 17:58:48 -05:00
joshvera
4af4dd616b Implement Eval instance for classes
Add Class to scopedEnvironment
2018-12-03 17:39:45 -05:00
joshvera
c505b53898 No need to declare multiple times
Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-12-03 15:59:49 -05:00
joshvera
2d190d8ec9 Don't insert already declared names into a scope
Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-12-03 15:59:38 -05:00
joshvera
0cd64662f2 Rename Address to Slot 2018-11-29 20:07:30 -05:00
joshvera
b2bbd0e78c Filter Export edges so we don't traverse them in the tests 2018-11-29 19:36:58 -05:00
joshvera
716bebd985 Remove lexical scope from Statements node 2018-11-29 13:00:53 -05:00
joshvera
49b4a1494f Remove currentFrame from Heap 2018-11-28 17:10:35 -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
Rick Winfrey
999ef65221 Add Reader effect
Co-Authored-By: Josh Vera <vera@github.com>
2018-11-27 17:18:46 -08:00
Rick Winfrey
124c7593f4 Handle scope and frame edges
Co-Authored-By: Josh Vera <vera@github.com>
2018-11-27 17:17:00 -08:00
joshvera
b6e789fff7 Use a Reader for the scope address and frame address
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-27 14:16:27 -05:00
joshvera
ccb044ac6b Export scopeLookup
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-26 19:54:49 -05:00
joshvera
ff1543f434 Implement Method
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-26 19:54:37 -05:00
joshvera
e9a999b69e Eval params to names in Evaluatable Function
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-26 19:54:28 -05:00
joshvera
af0184a195 Store names as params in Closure
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-26 19:53:58 -05:00
Timothy Clem
14600029fd Pick out delcarations for ScopeResolution and through Context better 2018-11-26 13:43:20 -08:00
Timothy Clem
e2ac46ae69 Better Show for Span 2018-11-26 13:41:55 -08:00
joshvera
ce40ee2d37 declarationNames traverses edges
Co-Authored-By: Rob Rix <rob.rix@github.com>
2018-11-26 13:05:37 -05:00
joshvera
86aa9c9950 Move defaultAlias to Data.ImportPath 2018-11-20 19:03:46 -05:00
Patrick Thomson
9e553ce939 fix-lint 2018-11-20 11:51:40 -05:00
Patrick Thomson
812abf249d fix stray import/old TODO 2018-11-19 16:45:55 -05:00
Patrick Thomson
af02dc3391 Port over Tokenize instances. 2018-11-19 16:41:00 -05:00
Patrick Thomson
c0d71fe80d Add enough Scope tokens to handle Ruby syntax. 2018-11-19 16:15:32 -05:00
Patrick Thomson
2974b34c17 Add 'Flow' to represent control-flow constructs. 2018-11-19 16:05:01 -05:00
joshvera
01f5a29039 Return unit in delete instance 2018-11-16 18:57:05 -05:00
joshvera
f2aa442c48 Rename AssignmentRvalError to DerefError 2018-11-16 18:54:25 -05:00
joshvera
06c9e97b2d implement Delete evaluatable 2018-11-16 18:53:27 -05:00
joshvera
d8933a062b Add deleteSlot 2018-11-16 18:53:16 -05:00
joshvera
007c710668 cover all cases of pathDeclarationScope 2018-11-16 18:02:39 -05:00
joshvera
fb0e7e3407 Add object to AbstractValue 2018-11-16 16:11:39 -05:00
joshvera
de126c7b94 qualify object 2018-11-16 16:11:28 -05:00
joshvera
ec8733889e Add AbstractHole instance to ValueRef 2018-11-16 16:10:02 -05:00
joshvera
e54cc8b096 Add QualifedImportError 2018-11-16 16:09:42 -05:00
joshvera
f39da9578a Move ImportPath to Data.ImportPath 2018-11-16 16:09:11 -05:00
joshvera
ea5587d16c Implement Evaluatable for MemberAccess 2018-11-15 20:24:34 -05:00
joshvera
39e723b980 Add Object to concrete Value 2018-11-15 20:24:21 -05:00
joshvera
3de1cbce5b Change scopedEnvironment to return the address of an Object 2018-11-15 20:24:06 -05:00
joshvera
994fd861c5 Add ReferenceError 2018-11-15 20:23:43 -05:00
joshvera
77fd2e823d Add insertDeclarationSpan to ScopeGraph 2018-11-15 19:29:09 -05:00
joshvera
6a34826abd Declare variable declarations with an empty span and update after evaluating 2018-11-15 19:28:48 -05:00
joshvera
2f32fd6f2b fix empty heap test 2018-11-15 18:44:47 -05:00
Rick Winfrey
46d39a25c8 A lot of warnings. ALOT 2018-11-15 15:04:28 -08:00
Rick Winfrey
97545f0ae7 Remove redundant constraints and imports 2018-11-15 14:18:36 -08:00
Rick Winfrey
e08b1100e4 Remove unnecessary (now) scopeAddress parameter
In Data.Abstract.ScopeGraph when we invoke `insertImportReference`, we make the assumption that the starting scope with respect to the currently available ScopeGraph is the `currentScope`. We then start from that scope to begin constructing a Path to the scope containing the target declaration.

Control.Abstract.ScopeGraph will need the scopeAddress parameter still, because it is going to insert a new scope into our scope graph using the scope returned from Data.Abstract.ScopeGraph (with the newly constructed path to the declaration).
2018-11-15 13:58:28 -08:00
Rick Winfrey
f7c38b0bb7 Clean up unused params 2018-11-15 13:52:14 -08:00
Rick Winfrey
a94760e99a Placeholder for handling Hole Paths 2018-11-15 13:51:57 -08:00
Rick Winfrey
66d3044951 Merge branch 'master' into heap-frames 2018-11-15 13:44:06 -08: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
22e1822185 Defer declaring names in the scope graph to param
Parameter syntax evaluatable instances are now responsible for adding declarations to the scope graph.

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-14 19:16:26 -05:00
joshvera
5c861f412f Add putDeclarationScopeAtPosition
So we can set the associated scope for the declaration of a slot

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-14 19:14:58 -05:00
joshvera
fe30b926f7 EvalError types
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-14 19:14:31 -05:00
joshvera
127552dbfc parameterize EvalError by address and value
so that we can throw AssignmentRvalError within Assignment or RequiredParameter Evaluatable instances

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-14 19:14:02 -05:00
joshvera
3223c97548 Add non-lexical StatementBlock
to differentiate between syntax that creates a new lexical scope and function bodies etc.

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-14 19:13:22 -05:00
joshvera
3f4c5d961d Create a lexical edge to its parent's declaration frame when calling a closure 2018-11-14 15:15:31 -05:00
joshvera
eebae6a1fc Add pathDeclarationScope 2018-11-14 15:14:58 -05:00
Timothy Clem
7c3469b86e Get the math right! 2018-11-13 15:50:07 -08:00
joshvera
519a6db035 Implement Return
impements Return in terms of eval and earlyReturn now that eval returns a ValueRef

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-13 17:59:25 -05:00
joshvera
12a038869a Export Heap and Frame accessors
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-13 17:58:49 -05:00
Timothy Clem
492117d796 Actually use the HTTP_TIMEOUT config var 2018-11-13 14:30:25 -08:00
joshvera
567fe790c9 Construct an import reference from correct start scope
Construct an import reference starting from the currentAddress of the target scope graph

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-13 14:08:42 -05:00
joshvera
4aac61ea70 Insert a list of scope if label doesn't exist in edge map of target scope
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-13 14:08:06 -05:00
joshvera
24720f9f06 Look within references when constructing paths
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-13 14:07:38 -05:00
Rick Winfrey
1e88378a51 Return an Rval representing the function body as a closure, instead of returning a Heap address
Co-Authored-By: Josh Vera <vera@github.com>
2018-11-09 12:47:44 -08:00
Rick Winfrey
12d27b436c Update an existing function declaration scope
Co-Authored-By: Josh Vera <vera@github.com>
2018-11-09 12:47:24 -08:00
Rick Winfrey
7103ba94b7 Declare a function using its name and the full span of the function
⚠️ this is a hack to get around the problem of evaluating a functionName (term) in order to retrieve its Span to properly declare the function.

Co-Authored-By: Josh Vera <vera@github.com>
2018-11-09 12:46:14 -08:00
Rick Winfrey
cbafcd8114 Add (Show address) for debugging
Co-Authored-By: Josh Vera <vera@github.com>
2018-11-09 12:42:43 -08:00
joshvera
a37c10b7fb Implement Call in terms of call effect
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-09 13:05:04 -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
c663c6a2ea Stub in pathPosition with Position 0
⚠️ : This is really bad because we never want to erroneously index into a sequence.

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-09 12:03:05 -05:00
joshvera
244109310a Add AbstractHole instances for Path, Scope, Address
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-09 11:37:45 -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
f6bfec2d96 the tests compile! 2018-11-08 18:22:35 -05:00
joshvera
22bdbdfafe Fix up import conflicts
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-08 12:55:42 -05:00
Rick Winfrey
ca0508c471 Export lookupDeclaration 2018-11-07 16:29:11 -08:00
Rick Winfrey
05c85c30e2 Add lookupDeclaration in Data.Abstract.Heap
This allows us to retrieve a frame address and position with which we can inspect slot values accordingly
2018-11-07 16:23:06 -08: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
a49b7f5440 Add lookupFrameAddress to Heap
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-07 15:56:20 -05:00
Rick Winfrey
f8380e2583 Add show for debugging
Co-Authored-By: Josh Vera <vera@github.com>
2018-11-06 16:37:55 -08:00
Rick Winfrey
7eddec8521 Merge branch 'master' into heap-frames 2018-11-06 11:26:39 -08:00
joshvera
2958d2578e Return currentFrame in Maybe
and throw CurrentFrameError and CurrentScopeError in terms that require a current scope and frame

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-06 13:43:14 -05:00
joshvera
fdad4295a0 Don't define a prelude of TypeScript atm
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
2018-11-06 13:04:49 -05:00
Timothy Clem
343289f1c5 Merge remote-tracking branch 'origin/master' into docstrings-round2 2018-11-06 09:17:49 -08:00
joshvera
e6cf810822 Merge remote-tracking branch 'origin/master' into heap-frames 2018-11-06 11:26:11 -05:00
joshvera
1818a74060 Return ValueRef everywhere 2018-11-05 19:43:14 -05:00
joshvera
11a64f043e return value refs 2018-11-05 17:25:51 -05:00
joshvera
1020f6dc61 use withLexicalScopeAndFrame in Statements 2018-11-05 16:11:16 -05:00
joshvera
f2754368cb If evaluatable instance returns a ValueRef 2018-11-05 16:11:04 -05:00
joshvera
63aa9da7f6 return undefined from Class instance 2018-11-05 16:10:42 -05:00
joshvera
fc426a9793 fix type constraints 2018-11-05 16:10:31 -05:00
joshvera
c9501897a1 Construct frame from Closure scope in Abstract.Call 2018-11-05 16:10:21 -05:00
joshvera
faffb3098e add heap semantics to BuiltIn 2018-11-05 16:10:04 -05:00
joshvera
14347215cb Set the declaration's scope in runFunction 2018-11-05 16:09:39 -05:00
joshvera
95204199fb rename address to frameAddress 2018-11-05 16:09:14 -05:00
joshvera
674d835ad9 import AllocatorC 2018-11-05 16:09:02 -05:00
joshvera
fc6c21c85e Rename address to frameAddress 2018-11-05 16:08:06 -05:00
joshvera
b3b7d2e5ff fix constraints 2018-11-05 16:07:23 -05:00
Timothy Clem
11c145589c Give class a custom Declarations1 instance 2018-11-05 09:27:41 -08:00
joshvera
37da68d706 Show builtIn name 2018-11-05 12:22:22 -05:00
joshvera
28ee7a136d currentScope returns in Maybe 2018-11-05 12:22:09 -05:00
joshvera
0d0ef95582 type parameters 2018-11-05 12:22:01 -05:00
Patrick Thomson
76f0ef7f38 Merge remote-tracking branch 'origin/master' into revisit-matching 2018-11-05 11:07:49 -05:00
Rob Rix
2ee79706e3 Whitelist attemptUnsafeArithmetic in the hlint config. 2018-11-05 09:51:56 -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
joshvera
bb39ebde84 use withLexicalScopeAndFrame 2018-11-02 16:18:16 -04:00
joshvera
6470a3a976 Remove ScopeEnv constraint 2018-11-02 16:17:58 -04:00
joshvera
39deb34db6 ignore define values 2018-11-02 16:17:50 -04:00
joshvera
5647df2a16 remove instance sigs 2018-11-02 16:17:43 -04:00
joshvera
02bcc64102 Fix Env constraints 2018-11-02 16:17:01 -04:00
Timothy Clem
223298b86a Merge remote-tracking branch 'origin/master' into docstrings-round2 2018-11-02 12:54:21 -07:00
joshvera
f50329ced4 fix up Abstract, Type, and Value 2018-11-02 15:33:45 -04:00
joshvera
f85a2d0f1a Evaluator sig 2018-11-01 23:08:28 -04:00
joshvera
daf17e426d derive any class 2018-11-01 22:45:51 -04:00
joshvera
c2643d3463 Don't make the heap a monoidal map 2018-11-01 22:32:14 -04:00
joshvera
86253d11c7 NFData instance 2018-11-01 22:31:55 -04:00
joshvera
069a50a634 add NFData to Position 2018-11-01 22:28:38 -04:00
Timothy Clem
63e13ee20c Merge remote-tracking branch 'origin/master' into docstrings-round2 2018-11-01 16:04:15 -07:00
Rick Winfrey
4750d51bf6 Merge branch 'master' into heap-frames
Co-Authored-By: Josh Vera <vera@github.com>
2018-11-01 15:29:45 -07:00
Rob Rix
98805db943 Merge branch 'master' into diff-via-fused-effects 2018-10-31 18:39:24 -04:00
Patrick Thomson
b9cf8f73c6 Environment and App. 2018-10-31 15:47:30 -04:00
joshvera
ef67897838 Make it compile 2018-10-31 15:37:13 -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
Timothy Clem
feef6e3ed6 Generic1 instance for TermF 2018-10-31 08:28:37 -07:00
joshvera
3fd78a2938 fix constraints in outer modules 2018-10-30 18:19:16 -04:00
Rick Winfrey
e3be56166a Add fix me comments to evaluatable instances 2018-10-30 13:50:43 -07:00
joshvera
44b7e7640e Remove more constraints 2018-10-30 13:53:03 -04:00
Rick Winfrey
9d375d72a1 Comment out remaining problematic code 2018-10-29 16:41:40 -07:00
Rick Winfrey
8c26fbfb61 Fix up parts of Evaluatable Class; not sure about the klass declaration 2018-10-29 16:33:09 -07:00
Rick Winfrey
d76fcb73a7 Sketch out Evalutable TypeAlias 2018-10-29 16:01:59 -07:00
joshvera
25dae2319a Fix up a couple more eval instances
and comment out even more
2018-10-29 18:08:56 -04:00
Rob Rix
148eb81d51 Diffing.Algorithm no longer exports Empty. 2018-10-29 11:01:52 -04:00
Rob Rix
5bf4479597 🔥 a stray LambdaCase. 2018-10-29 10:26:56 -04:00
Rob Rix
636eec364e Update to fused-effects, replace \/ with handleSum and bundle Interpose. 2018-10-29 09:52:48 -04:00
Rob Rix
3979ea4e86 🔥 disjunction. 2018-10-25 22:56:08 -04:00
Rob Rix
d4c6edb156 🔥 Disjunction. 2018-10-25 22:54:00 -04:00
Rob Rix
ce407d1c9e Move a bunch of the evaluation machinery to Semantic.Analysis. 2018-10-25 21:40:37 -04:00
Rob Rix
830fde2104 Simplify evaluate to take the term evaluator. 2018-10-25 21:22:22 -04:00
Rob Rix
428d92788b Sort a couple of constraints down. 2018-10-25 21:13:28 -04:00
Rob Rix
64df59c4bf Extract evalTerm. 2018-10-25 20:55:07 -04:00
Rob Rix
097af57735 Factor the interposes into a runInTerm helper. 2018-10-25 17:34:04 -04:00
Rob Rix
4cad9bc45e Re-export Control.Abstract.ScopeGraph from Control.Abstract. 2018-10-25 16:42:53 -04:00
Rob Rix
8a3d7ba927 Don’t be clever. 2018-10-25 13:48:47 -04:00
Rob Rix
c625efd9c5 Extract the fold over modules to the top level. 2018-10-25 13:47:07 -04:00
Rob Rix
df10f93bcd Extract runInModule to the top level. 2018-10-25 13:44:28 -04:00
Rob Rix
996a2ab79c 🔥 HasPostlude. 2018-10-25 11:49:50 -04:00
Rob Rix
1e83574cf0 🔥 the use of postludes. 2018-10-25 11:47:21 -04:00
Rob Rix
4531c9afc7 🔥 Prologue’s re-export of MonadError. 2018-10-25 10:21:14 -04:00
Rob Rix
775bc6ef80 Bump higher-order-effects for interposition. 2018-10-25 09:27:40 -04:00
Rob Rix
05c4f76663 🔥 redundant parens. 2018-10-24 15:41:14 -04:00
Rob Rix
66466448ec Simplify the reinterpretation in ScopeEnvC. 2018-10-24 15:26:20 -04:00
Rob Rix
2d71e0b6fc Parameterize ScopeEnvC by the address type. 2018-10-24 15:23:59 -04:00
Rob Rix
131cae4d7b Merge branch 'master' into higher-order-effects 2018-10-24 14:04:13 -04:00
Rob Rix
2216fcc44a Effect, not carrier.
Co-Authored-By: Patrick Thomson <patrick.william.thomson@gmail.com>
2018-10-24 12:40:17 -04:00
Rob Rix
41d206b9fa Eavesdrop in evaluate.
Co-Authored-By: Patrick Thomson <patrick.william.thomson@gmail.com>
2018-10-24 12:39:53 -04:00
Rob Rix
15a8917c84 Simplify the FunctionC carrier instances. 2018-10-24 11:00:54 -04:00
Rob Rix
25b2c3c4e9 Encapsulate the state effects inside EnvC. 2018-10-24 10:21:29 -04:00
Rob Rix
bff13c7272 Parameterize EnvC by the address type. 2018-10-24 10:14:04 -04:00
Rob Rix
88a116cedc 🔥 the demotes. 2018-10-23 15:50:42 -04:00
Rob Rix
a18410cb0b Promote ret from the underlying carrier. 2018-10-23 15:49:59 -04:00
Patrick Thomson
9e2ea1101d stray LANGUAGE pragma 2018-10-23 15:46:02 -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
82956152c6 Re-add the WhileC Carrier instance for the concrete domain. 2018-10-23 11:41:16 -04:00
Rob Rix
c53a6aa511 Interpose with an upcast. 2018-10-23 11:30:58 -04:00
Rob Rix
92ac53252e Define upcasting to InterposeC. 2018-10-23 09:45:33 -04:00
Rob Rix
21f17ff56f Clean up a bunch of algebras. 2018-10-22 20:30:07 -04:00
Rob Rix
11ccb849a6 Fix a dodgy import. 2018-10-22 20:18:16 -04:00
Rob Rix
56eae42043 Simplify the While carriers. 2018-10-22 12:49:01 -04:00
Rob Rix
9b3fb906ae Simplify the BooleanC carriers. 2018-10-22 12:38:43 -04:00
Rob Rix
9fbbd9a667 Generalize unify. 2018-10-22 12:27:13 -04:00
Rob Rix
3c267f2757 Generalize substitute. 2018-10-22 12:27:06 -04:00
Rob Rix
0960f0cd9e Generalize throwTypeError. 2018-10-22 12:26:54 -04:00