Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover info for local bindings #4969

Draft
wants to merge 1,429 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
1429 commits
Select commit Hold shift + click to select a range
71f5518
tweak temp file names
mitchellwrosen Oct 30, 2024
79df683
Fix bad uargOnto
ChrisPenner Oct 30, 2024
f5dabea
Replace Closures with Val in most builtins
ChrisPenner Oct 30, 2024
3918cdf
Add a few runtime transcript tests
ChrisPenner Oct 30, 2024
9349c7a
Simplify BLits by removing superfluous refs and tags
ChrisPenner Oct 30, 2024
5f97c6e
Collapse DataU1 DataU2 DataB1 DataB2... into just Data1 Data2
ChrisPenner Oct 30, 2024
35119f1
Unify MCode Lits to simplify boxing/unboxing of lits
ChrisPenner Oct 30, 2024
963d823
Fix up UnboxedVal patterns
ChrisPenner Oct 31, 2024
e254c11
Simplify ForeignOp helpers
ChrisPenner Oct 31, 2024
2ed0ec6
Remove unnecessary type references on primops
ChrisPenner Oct 31, 2024
25a67b7
Rerun transcripts
ChrisPenner Oct 31, 2024
3394a5e
Add CAST instruction for runtime type coercion
ChrisPenner Oct 31, 2024
c57e7a9
Fix cast
ChrisPenner Oct 31, 2024
6bbb5bc
Merge pull request #5414 from unisonweb/cp/serialization-roundtrip-tests
ChrisPenner Oct 31, 2024
848c406
Fix Nat -> Word conversions
ChrisPenner Oct 31, 2024
82d466d
Debugging stack-arg issues
ChrisPenner Oct 30, 2024
1657260
Stack debugging: Add stack_check macros
ChrisPenner Oct 29, 2024
f85c958
Add stack arg debugging
ChrisPenner Oct 30, 2024
96fe58e
Debug.Interpreter
ChrisPenner Oct 31, 2024
494b741
Put stack debugging behind preprocessor flag
ChrisPenner Oct 31, 2024
033df41
Fix bad toEnum in NatVal
ChrisPenner Oct 31, 2024
ba7a4d6
Clean up debugging
ChrisPenner Oct 31, 2024
f2979c4
Merge pull request #5416 from unisonweb/topic/jit-builtins
dolio Oct 31, 2024
270c0a6
Merge pull request #5432 from unisonweb/topic/interp-code-opt
dolio Oct 31, 2024
1d3f439
Fix broken stack debugging
ChrisPenner Oct 31, 2024
5c48d51
Remove redundant EQLU implementation
ChrisPenner Nov 1, 2024
fa98895
Fix bad eqlu/cmpu
ChrisPenner Nov 1, 2024
86bd7fb
Fix byte poking
ChrisPenner Nov 1, 2024
2e0678d
Remove some debugging
ChrisPenner Nov 1, 2024
00f0ee0
Add separate instructions for Int versions of bit-twiddling
ChrisPenner Nov 1, 2024
679239d
Fix truncate0
ChrisPenner Nov 1, 2024
741231b
Fix dropn output type
ChrisPenner Nov 1, 2024
b698ae8
automatically run ormolu
ChrisPenner Nov 1, 2024
e0dbbf1
Sort branches local to the current project to the bottom of the fzf l…
ChrisPenner Nov 1, 2024
b795c72
Enable top-level value caching in jit
dolio Nov 1, 2024
e0f0471
Just use nats for buffer tags on the stack
ChrisPenner Nov 1, 2024
809c23a
Split up in-place mutation so the stack debugger works
ChrisPenner Nov 1, 2024
0f691a9
Update transcripts
ChrisPenner Nov 1, 2024
e9f2b0b
Re-merge trunk
ChrisPenner Nov 2, 2024
c8f4126
Merge pull request #5437 from unisonweb/cp/fzf-prefer-local-branches
aryairani Nov 3, 2024
80a7473
Fix runtime Serialization tests
ChrisPenner Nov 4, 2024
ca2d1f6
Fix bad unsafeCoerce to Closure
ChrisPenner Nov 4, 2024
d604eb9
Use the proper unit calling conventions for builtins
ChrisPenner Nov 4, 2024
4b06b4c
Relax int/nat equality/comparisons to account for loss of information…
ChrisPenner Nov 4, 2024
0e98a5f
Re-run transcripts
ChrisPenner Nov 4, 2024
f963030
Don't need to peek boxed stack
ChrisPenner Nov 4, 2024
780b2d6
Merge pull request #5411 from unisonweb/24-10-10-mergetool
aryairani Nov 4, 2024
384bd6b
Bump macos github actions runners from deprecated macos-12 to macos-13
ChrisPenner Nov 4, 2024
2c05951
Fix up universalCompare some more
ChrisPenner Nov 5, 2024
8a455ab
Add some more runtime tests
ChrisPenner Nov 5, 2024
687bcda
switch more instances of macos-12 to -13
aryairani Nov 5, 2024
edbbcdc
Merge pull request #5439 from unisonweb/cp/bump-macos-runners
aryairani Nov 5, 2024
e663e56
Merge pull request #5438 from unisonweb/topic/jit-value-cache
aryairani Nov 5, 2024
99097ac
⅄ trunk → 24-10-16-edit-dependents
mitchellwrosen Nov 5, 2024
ea2586b
fix #5441 - malformed Unison examples in source code
kylegoetz Nov 5, 2024
5e64b29
Replace PackedTag runtime types with a custom type
ChrisPenner Nov 5, 2024
bf1f160
Merge trunk
ChrisPenner Nov 5, 2024
d7dce78
Remove borked copied file
ChrisPenner Nov 5, 2024
b9dbf49
add some merge progress output messages
mitchellwrosen Nov 5, 2024
18287d5
PR cleanup
ChrisPenner Nov 5, 2024
afb65c9
Make universalCompare more consistent
ChrisPenner Nov 5, 2024
570b186
Fix universalCompare's handling of value lists and nats/ints
ChrisPenner Nov 5, 2024
237947e
Rerun runtime tests transcript
ChrisPenner Nov 5, 2024
6c8000d
Merge pull request #5442 from kylegoetz/5441
aryairani Nov 6, 2024
e4d7193
⅄ trunk → 24-10-31-merge-feedback
mitchellwrosen Nov 6, 2024
f1ba835
switch to console regions for merge progress output
mitchellwrosen Nov 6, 2024
2c11caa
move delete.namespace implementation into its own module
mitchellwrosen Nov 6, 2024
1355300
Remove unnecessary allocations of unboxed type tags
ChrisPenner Nov 6, 2024
78cbe72
add failing transcript
mitchellwrosen Nov 7, 2024
ade889f
Add verification for non-test transcripts
sellout Nov 11, 2024
bff98d3
Fix typo in bug_report template
sellout Nov 11, 2024
bc93be5
Merge remote-tracking branch 'upstream/trunk' into transcript-edit
sellout Nov 11, 2024
2673620
Update interpreter test output
sellout Nov 11, 2024
2775b58
Unify `@keyword{…}` constructs in Doc parser
sellout Nov 12, 2024
911c799
Validate pull_request_template as transcript
sellout Nov 12, 2024
5ee4794
in `delete.namespace`, don't worry about endangered definitions in `l…
mitchellwrosen Nov 12, 2024
a91e73a
Merge pull request #5443 from unisonweb/24-10-31-merge-feedback
mitchellwrosen Nov 12, 2024
d683e9d
Merge pull request #5424 from unisonweb/cp/optimization-flags
aryairani Nov 12, 2024
e05237e
Fix stackchecks
ChrisPenner Nov 12, 2024
0dc566a
Merge pull request #5450 from sellout/unify-inline-doc-constructs
aryairani Nov 13, 2024
de1273c
Merge pull request #5452 from unisonweb/24-11-06-delete-namespace
aryairani Nov 13, 2024
77757dd
Actually calculate inlining info for builtins
dolio Nov 13, 2024
d4ea9a2
Fix stack debugging
ChrisPenner Nov 13, 2024
336a9a5
Merge pull request #5454 from unisonweb/fix/inline-info
dolio Nov 15, 2024
a8e18d8
Remove ANF.inline
ChrisPenner Nov 15, 2024
c289e8b
Merge pull request #5457 from unisonweb/cp/remove-inlining
dolio Nov 16, 2024
32c748a
Add instructions for DropN and truncate0
ChrisPenner Nov 6, 2024
b670409
Make Ref.read Ref.write instructions
ChrisPenner Oct 16, 2024
3abb9b4
Make instructions for more Ref primitives
ChrisPenner Nov 6, 2024
b66619f
PR cleanup
ChrisPenner Nov 7, 2024
4b9e75f
Merge latest trunk
ChrisPenner Nov 18, 2024
6336c05
Get CAS working as expected and add some comments
ChrisPenner Nov 8, 2024
3052612
Add indicator to prompt when on staging
ChrisPenner Nov 18, 2024
cfc85bb
Don't treat blocks with null annotations as equal by default
ChrisPenner Nov 19, 2024
c60cbbc
Make `unsafe.force-push` visible
ChrisPenner Nov 19, 2024
cad3c76
Simplify special cases to just hash-references
ChrisPenner Nov 19, 2024
5d11b23
Get compiling
ChrisPenner Nov 19, 2024
d39e1a0
Re-run transcripts
ChrisPenner Nov 19, 2024
17cfc91
Merge pull request #5460 from unisonweb/cp/fix-diffs
ChrisPenner Nov 19, 2024
7f96a4d
Add Ord to *DefinitionDiffs
ChrisPenner Nov 19, 2024
68f55ac
add edit.dependents command
mitchellwrosen Nov 20, 2024
7545ed6
⅄ trunk → 24-10-16-edit-dependents
mitchellwrosen Nov 20, 2024
111356e
add progress messages to edit.dependents
mitchellwrosen Nov 20, 2024
5de2703
Merge pull request #5431 from unisonweb/cp/unboxed-arithmetic
ChrisPenner Nov 20, 2024
40eac6a
Add instances
ChrisPenner Nov 20, 2024
f80caa6
Provide proper fallback for case where things are actually equal.
ChrisPenner Nov 20, 2024
5c3f615
Update transcripts
ChrisPenner Nov 20, 2024
b6f8895
Better handling of weird tuple case
ChrisPenner Nov 20, 2024
4495ac2
Rerun transcripts
ChrisPenner Nov 20, 2024
4332f42
Remove stray HasCallStack in Machine
ChrisPenner Nov 21, 2024
9b92ea2
Gitignore more profiling files
ChrisPenner Nov 21, 2024
3872897
Merge pull request #5463 from unisonweb/cp/fix-stray-callstack
ChrisPenner Nov 22, 2024
d7a1edb
Merge pull request #5462 from unisonweb/cp/fix-tuple-diffs
ChrisPenner Nov 22, 2024
547fdbf
rerun transcripts (reminder to rerun CI!)
aryairani Nov 25, 2024
287db83
Merge pull request #5459 from unisonweb/cp/visible-push-force
aryairani Nov 25, 2024
c08c309
add failing transcript
mitchellwrosen Nov 25, 2024
f37d844
bugfix: don't consider shortening variables with use statements
mitchellwrosen Nov 25, 2024
67d1c0d
Add export lists and specializations
ChrisPenner Nov 26, 2024
2ac41d1
Merge pull request #5458 from unisonweb/cp/staging-prompt
aryairani Nov 26, 2024
612756d
Merge pull request #5465 from unisonweb/fix-count-uses-bug
aryairani Nov 26, 2024
b7edcd6
More precise blank lines in transcript UCM blocks
sellout Nov 26, 2024
7e26050
Merge remote-tracking branch 'upstream/trunk' into transcript-edit
sellout Nov 26, 2024
0d7fefa
make edit.dependents pull in the edited thing as well, not just depen…
mitchellwrosen Nov 26, 2024
1b268ea
Manually unbox functions in FF
ChrisPenner Nov 26, 2024
6d8b26d
Add dumpcore flag
ChrisPenner Nov 21, 2024
d17b1f6
Merge pull request #5406 from sellout/transcript-edit
aryairani Nov 26, 2024
e2cf40a
Fix max worker args, and add unboxing to callbacks too
ChrisPenner Nov 26, 2024
eec7498
Experiment with optimization flags
ChrisPenner Nov 26, 2024
73fbed4
Just replace the broken case with error
ChrisPenner Nov 26, 2024
930e5b4
Inspection testing
ChrisPenner Nov 27, 2024
7c0bbfe
Get eval0 working without allocating any 'Stack'
ChrisPenner Nov 27, 2024
73c1b9d
Hide inspection testing behind build flag
ChrisPenner Nov 27, 2024
e2b8302
Wire up inspection testing into CI
ChrisPenner Nov 27, 2024
deb544c
Only include inspection testing when used
ChrisPenner Nov 27, 2024
9ca3fc9
Stabilize a comment that breaks Ormolu idempotency
sellout Nov 27, 2024
6d14ff1
Run Ormolu 0.7.2.0 on the entire code base
sellout Nov 27, 2024
cc68b25
PR Cleanup
ChrisPenner Nov 27, 2024
606419a
Some manual formatting, based on Ormolu changes
sellout Nov 27, 2024
37244aa
Generate more efficient branches
ChrisPenner Nov 27, 2024
700c33c
Singleton BlackHole value
ChrisPenner Nov 22, 2024
99baffd
Merge pull request #5469 from sellout/ormoluize
aryairani Dec 2, 2024
fbc64a0
⅄ trunk → 24-10-16-edit-dependents
mitchellwrosen Dec 2, 2024
395571b
PR feedback
ChrisPenner Dec 2, 2024
6c2a6e9
run transcripts
mitchellwrosen Dec 2, 2024
89c2fe2
Define BoolVal patterns and true/false singleton vals
ChrisPenner Nov 8, 2024
9d5911f
Define new instrs for lt, neq
ChrisPenner Nov 8, 2024
2424312
Remove boolift/notlift
ChrisPenner Nov 8, 2024
845833c
Remove superfluous bool combinators
ChrisPenner Nov 8, 2024
17531ab
Fix up bool pattern matching
ChrisPenner Nov 18, 2024
91b6405
Fix Stack.hs in stackcheck mode
ChrisPenner Nov 21, 2024
4ac40d4
Re-merge trunk
ChrisPenner Dec 2, 2024
b04aa8b
Add dumpcore flag
ChrisPenner Nov 21, 2024
ce0e9af
Merge pull request #5466 from unisonweb/24-10-16-edit-dependents
aryairani Dec 2, 2024
5542282
Merge pull request #5447 from unisonweb/cp/more-instructions
aryairani Dec 3, 2024
d0b3720
Merge pull request #5449 from unisonweb/cp/better-bools
aryairani Dec 3, 2024
cb69a72
Revert Ref.read Ref.write to untracked because they're shared betwee…
ChrisPenner Dec 3, 2024
67575ee
Merge pull request #5474 from unisonweb/cp/untracked-ref
ChrisPenner Dec 3, 2024
fcfee18
make update output use console regions
mitchellwrosen Dec 4, 2024
fc413e1
add failing transcript
mitchellwrosen Dec 4, 2024
cece289
Merge pull request #5479 from unisonweb/24-12-04-update-output
aryairani Dec 4, 2024
91cb40a
Define enum for all foreign calls
ChrisPenner Dec 4, 2024
1444456
Implement a bunch of builtin impls
ChrisPenner Dec 4, 2024
cae64d7
Finish porting over foreign calls
ChrisPenner Dec 5, 2024
12dbac8
WIP on switching from numbered foreign funcs
ChrisPenner Dec 5, 2024
7c0385f
`run` should use the `TypeLookup` from the file too
Dec 6, 2024
98f04cd
Merge remote-tracking branch 'upstream/trunk' into transcript-known-f…
sellout Dec 6, 2024
b016af0
Fix some outdated transcripts
sellout Dec 6, 2024
d53b00b
Remove all the old sandboxing
ChrisPenner Dec 5, 2024
d3c9c69
Sandbox foreigns with a preprocessing step.
ChrisPenner Dec 7, 2024
8f8f99c
allow add/update of a unison file with failing watches
mitchellwrosen Dec 9, 2024
7baa468
add failing transcript
mitchellwrosen Dec 9, 2024
891cd8c
Re-merge trunk
ChrisPenner Dec 9, 2024
995e8e4
generate unique type guids only when necessary
mitchellwrosen Dec 9, 2024
1cc47c1
Optimize branch creation and better blackhole allocations
ChrisPenner Dec 9, 2024
fe3a9e8
Merge pull request #5468 from unisonweb/cp/worker-wrapper
ChrisPenner Dec 9, 2024
a1b49ed
re-run rewrites.md
mitchellwrosen Dec 9, 2024
d94cf3c
⅄ trunk → 24-12-05-add-todo-watch
mitchellwrosen Dec 9, 2024
1d92dbe
Ensure we're pattern-matching branches consistently
ChrisPenner Dec 9, 2024
7f76fd8
run transcript
mitchellwrosen Dec 9, 2024
2d7b137
⅄ unique-type-tech-debt → 24-12-09-fix-5489
mitchellwrosen Dec 9, 2024
6b63eb1
Merge trunk back into inline-foreign-calls
ChrisPenner Dec 9, 2024
1ec1b86
Fix codeValidate
ChrisPenner Dec 9, 2024
be210b5
Dan's suggested tweaks
ChrisPenner Dec 9, 2024
dfac404
Get Stack unboxing more reliably
ChrisPenner Dec 9, 2024
2f2fb81
Merge pull request #5492 from unisonweb/cp/better-branches
ChrisPenner Dec 10, 2024
5e2b968
Inline argsToLists
ChrisPenner Dec 10, 2024
49a0cae
Replace `:hide:all` with `:hide-all`
sellout Dec 10, 2024
9bcfda9
⅄ trunk → 24-12-04-fix-5427
mitchellwrosen Dec 10, 2024
30609ee
small term printer refactor
mitchellwrosen Dec 10, 2024
ef2df94
add another failing transcript
mitchellwrosen Dec 10, 2024
d272484
reset vars in a couple more places
mitchellwrosen Dec 10, 2024
adc5f20
Fix MCode Serialization tests
ChrisPenner Dec 10, 2024
de75614
Rephrase the “remove `:bug`” transcript messages
sellout Dec 10, 2024
70127ad
Codebase Server: remove the generated port and token
hojberg Nov 20, 2024
2dddbdf
Replace unused Foreign Function module with Impl
ChrisPenner Dec 10, 2024
316e452
Cleanup and docs
ChrisPenner Dec 10, 2024
af717a7
Rename sanitization
ChrisPenner Dec 10, 2024
59375ff
Update unison-share-api/src/Unison/Server/CodebaseServer.hs
hojberg Dec 10, 2024
0fa62a4
Merge pull request #5461 from unisonweb/remove-generated-port-token-a…
hojberg Dec 10, 2024
c88d9fd
Add tests for `:bug`
sellout Dec 10, 2024
c5f5cce
Add missing INLINE's on EnumContainers
ChrisPenner Dec 10, 2024
bb5a56c
Remove my unnecessary pattern functor for `Cofree`
sellout Dec 11, 2024
271c105
Merge pull request #5500 from sellout/redundant-cofreef
aryairani Dec 11, 2024
b311a29
Merge pull request #5394 from sellout/transcript-known-failures
aryairani Dec 11, 2024
ad45e5d
Merge pull request #5483 from unisonweb/fix/5448
aryairani Dec 11, 2024
bb49150
Merge pull request #5491 from unisonweb/unique-type-tech-debt
aryairani Dec 11, 2024
deefb3d
Merge pull request #5493 from unisonweb/24-12-05-add-todo-watch
aryairani Dec 11, 2024
4556497
distinguish between recursive and nonrecursive lets in term printer
mitchellwrosen Dec 12, 2024
5adb267
Remove strictness annotations on CCache
ChrisPenner Dec 12, 2024
f9cc70e
Merge pull request #5499 from unisonweb/cp/inline-ec
ChrisPenner Dec 12, 2024
6779235
Remove obviously redundant bang patterns
ChrisPenner Dec 13, 2024
33db037
Remove all INLINEs on ForeignConvention
ChrisPenner Dec 13, 2024
ad1fb70
Do reference-based pruning for ucm compile, turn back on inlining
dolio Dec 13, 2024
1fc3308
delay assigning a unique type guid until after namespace directive is…
mitchellwrosen Dec 16, 2024
28973da
Merge pull request #5507 from unisonweb/fix/interp-inlining
aryairani Dec 16, 2024
968be8b
Re-merge trunk
ChrisPenner Dec 16, 2024
94f7c1b
Merge pull request #5495 from unisonweb/cp/inlined-foreign-calls
ChrisPenner Dec 16, 2024
3de24bf
Add Repobeats. Git repository stats
hojberg Dec 17, 2024
157d36f
Merge pull request #5510 from unisonweb/add-repobeats
hojberg Dec 17, 2024
55e11ee
involve the current namespace directive when generating a unique type…
mitchellwrosen Dec 17, 2024
8ecaf09
fix record accessors issue
mitchellwrosen Dec 17, 2024
d7225d0
⅄ trunk → 24-12-04-fix-5427
mitchellwrosen Dec 17, 2024
1d177b7
Merge pull request #5509 from unisonweb/24-12-09-fix-5489
aryairani Dec 18, 2024
eca815c
add bound terms to term printer environment
mitchellwrosen Dec 18, 2024
28884e3
fix let-capture issue in term renderer
mitchellwrosen Dec 18, 2024
436abd8
Merge pull request #5505 from unisonweb/cp/batched-diffs
aryairani Dec 18, 2024
0e41fc7
add regression test for #5507
Dec 18, 2024
159c2b3
add 5507 regression test in linux
Dec 19, 2024
8e32841
Merge pull request #5498 from unisonweb/24-12-04-fix-5427
aryairani Dec 19, 2024
a2d3c2c
Merge pull request #5512 from unisonweb/inlining-regression-test
aryairani Dec 19, 2024
866058e
add runOnly support for unison-syntax tests
bbarker Dec 21, 2024
c5d9f88
remove comment
bbarker Dec 21, 2024
0bc8cac
signing CONTRIBUTORS.markdown
bbarker Dec 22, 2024
aad1fdd
Merge pull request #5514 from bbarker/runOnly_unison_syntax
aryairani Dec 23, 2024
ab4e093
fix(error messages): cli http request errors should show a summary wi…
xmbhasin Dec 31, 2024
daefc1d
docs(CONTRIBUTORS.markdown): add Manish Bhasin (@xmbhasin)
xmbhasin Dec 31, 2024
b7b3439
Merge pull request #5519 from xmbhasin/err-msg-cli-http
aryairani Dec 31, 2024
15cd84c
Fix old bool wrapper on setEcho builtin
ChrisPenner Jan 7, 2025
e5242d2
Add transcript for setEcho
ChrisPenner Jan 7, 2025
cda1ecd
Merge pull request #5526 from unisonweb/cp/fix-set-echo
aryairani Jan 8, 2025
a644032
fix 5525
mitchellwrosen Jan 8, 2025
a09dfda
track bindings in match case
mitchellwrosen Jan 8, 2025
4324c53
Merge pull request #5528 from unisonweb/fix-5525
aryairani Jan 8, 2025
0153069
Re-merge trunk
ChrisPenner Jan 11, 2025
db0c0bb
Do var reporting inside retract
ChrisPenner Jan 11, 2025
8b702f0
Really naive version working
ChrisPenner Jan 11, 2025
6eac1bb
Debugging
ChrisPenner Jan 11, 2025
27494d7
Working relatively well IFF you have a top-level signature
ChrisPenner Jan 11, 2025
5fe41c2
Note var mentions so we can align symbol ids with their location then…
ChrisPenner Jan 13, 2025
4790a2c
Pass along binding symbol annotations and emit notes for them to LSP …
ChrisPenner Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion unison-cli/src/Unison/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ main version = do
Right (Right (v, rf, combIx, sto))
| not vmatch -> mismatchMsg
| otherwise ->
withArgs args (RTI.runStandalone sto combIx) >>= \case
withArgs args (RTI.runStandalone False sto combIx) >>= \case
Left err -> exitError err
Right () -> pure ()
where
Expand Down
11 changes: 4 additions & 7 deletions unison-runtime/src/Unison/Runtime/ANF.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module Unison.Runtime.ANF
SuperGroup (..),
arities,
POp (..),
FOp,
close,
saturate,
float,
Expand Down Expand Up @@ -117,6 +116,7 @@ import Unison.Prelude
import Unison.Reference (Id, Reference, Reference' (Builtin, DerivedId))
import Unison.Referent (Referent, pattern Con, pattern Ref)
import Unison.Runtime.Array qualified as PA
import Unison.Runtime.Foreign.Function.Type (ForeignFunc (..))
import Unison.Runtime.TypeTags (CTag (..), PackedTag (..), RTag (..), Tag (..), maskTags, packTags, unpackTags)
import Unison.Symbol (Symbol)
import Unison.Term hiding (List, Ref, Text, arity, float, fresh, resolve)
Expand Down Expand Up @@ -1030,12 +1030,12 @@ pattern TPrm ::
ABTN.Term ANormalF v
pattern TPrm p args = TApp (FPrim (Left p)) args

pattern AFOp :: FOp -> [v] -> ANormalF v e
pattern AFOp :: ForeignFunc -> [v] -> ANormalF v e
pattern AFOp p args = AApp (FPrim (Right p)) args

pattern TFOp ::
(ABT.Var v) =>
FOp ->
ForeignFunc ->
[v] ->
ABTN.Term ANormalF v
pattern TFOp p args = TApp (FPrim (Right p)) args
Expand Down Expand Up @@ -1232,9 +1232,6 @@ instance Semigroup (BranchAccum v) where
instance Monoid (BranchAccum e) where
mempty = AccumEmpty

-- Foreign operation, indexed by words
type FOp = Word64

data Func v
= -- variable
FVar v
Expand All @@ -1247,7 +1244,7 @@ data Func v
| -- ability request
FReq !Reference !CTag
| -- prim op
FPrim (Either POp FOp)
FPrim (Either POp ForeignFunc)
deriving (Show, Eq, Functor, Foldable, Traversable)

data Lit
Expand Down
22 changes: 11 additions & 11 deletions unison-runtime/src/Unison/Runtime/ANF/Serialize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import Unison.ABT.Normalized (Term (..))
import Unison.Reference (Reference, Reference' (Builtin), pattern Derived)
import Unison.Runtime.ANF as ANF hiding (Tag)
import Unison.Runtime.Exception
import Unison.Runtime.Foreign.Function.Type (ForeignFunc)
import Unison.Runtime.Serialize
import Unison.Util.EnumContainers qualified as EC
import Unison.Util.Text qualified as Util.Text
import Unison.Var (Type (ANFBlank), Var (..))
import Prelude hiding (getChar, putChar)
Expand Down Expand Up @@ -317,7 +317,7 @@ putGroup ::
(MonadPut m) =>
(Var v) =>
Map Reference Word64 ->
EC.EnumMap FOp Text ->
Map ForeignFunc Text ->
SuperGroup v ->
m ()
putGroup refrep fops (Rec bs e) =
Expand All @@ -338,7 +338,7 @@ getGroup = do
cs <- replicateM l (getComb ctx n)
Rec (zip vs cs) <$> getComb ctx n

putCode :: (MonadPut m) => EC.EnumMap FOp Text -> Code -> m ()
putCode :: (MonadPut m) => Map ForeignFunc Text -> Code -> m ()
putCode fops (CodeRep g c) = putGroup mempty fops g *> putCacheability c

getCode :: (MonadGet m) => Word32 -> m Code
Expand All @@ -363,7 +363,7 @@ putComb ::
(MonadPut m) =>
(Var v) =>
Map Reference Word64 ->
EC.EnumMap FOp Text ->
Map ForeignFunc Text ->
[v] ->
SuperNormal v ->
m ()
Expand All @@ -384,7 +384,7 @@ putNormal ::
(MonadPut m) =>
(Var v) =>
Map Reference Word64 ->
EC.EnumMap FOp Text ->
Map ForeignFunc Text ->
[v] ->
ANormal v ->
m ()
Expand Down Expand Up @@ -482,7 +482,7 @@ putFunc ::
(MonadPut m) =>
(Var v) =>
Map Reference Word64 ->
EC.EnumMap FOp Text ->
Map ForeignFunc Text ->
[v] ->
Func v ->
m ()
Expand All @@ -496,7 +496,7 @@ putFunc refrep fops ctx f = case f of
FReq r c -> putTag FReqT *> putReference r *> putCTag c
FPrim (Left p) -> putTag FPrimT *> putPOp p
FPrim (Right f)
| Just nm <- EC.lookup f fops ->
| Just nm <- Map.lookup f fops ->
putTag FForeignT *> putText nm
| otherwise ->
exn $ "putFunc: could not serialize foreign operation: " ++ show f
Expand Down Expand Up @@ -757,7 +757,7 @@ putBranches ::
(MonadPut m) =>
(Var v) =>
Map Reference Word64 ->
EC.EnumMap FOp Text ->
Map ForeignFunc Text ->
[v] ->
Branched (ANormal v) ->
m ()
Expand Down Expand Up @@ -825,7 +825,7 @@ putCase ::
(MonadPut m) =>
(Var v) =>
Map Reference Word64 ->
EC.EnumMap FOp Text ->
Map ForeignFunc Text ->
[v] ->
([Mem], ANormal v) ->
m ()
Expand Down Expand Up @@ -997,7 +997,7 @@ deserializeCode bs = runGetS (getVersion >>= getCode) bs
n | 1 <= n && n <= 3 -> pure n
n -> fail $ "deserializeGroup: unknown version: " ++ show n

serializeCode :: EC.EnumMap FOp Text -> Code -> ByteString
serializeCode :: Map ForeignFunc Text -> Code -> ByteString
serializeCode fops co = runPutS (putVersion *> putCode fops co)
where
putVersion = putWord32be codeVersion
Expand All @@ -1023,7 +1023,7 @@ serializeCode fops co = runPutS (putVersion *> putCode fops co)
-- shouldn't be subject to rehashing.
serializeGroupForRehash ::
(Var v) =>
EC.EnumMap FOp Text ->
Map ForeignFunc Text ->
Reference ->
SuperGroup v ->
L.ByteString
Expand Down
Loading