Commit Graph

6689 Commits

Author SHA1 Message Date
Arya Irani
d936b0424b fix formatting 2023-05-24 00:44:08 -04:00
Arya Irani
c28f168e39 remove some ghc 9.4 options that leaked in here 2023-05-24 00:25:04 -04:00
Paul Chiusano
5ccfc5784e WiP on sfind and rewrite commands 2023-05-23 17:20:55 -05:00
Dan Doel
c25232bcb8 Merge remote-tracking branch 'origin/trunk' into work/scheme-code-loading 2023-05-23 15:07:10 -04:00
Arya Irani
f619a8fcd2 building on lts-20.22 2023-05-23 07:42:58 -04:00
Cody Allen
c2b0b8bb57
Improve Debug.toText when using run.compiled
Previously when using `run.compiled`, `Debug.toText` was not attempting
to decompile closures, which generally led to pretty terrible output.
This changes the prety-printing for `run.compiled` to work similarly to
the pretty-printer for `run`  but with empty name mappings for types and
terms.

Testing and example output
==========================

I couldn't figure out how to test this change. I don't see any examples
of calling `run.compiled` and capturing output, and `Debug.toText`
inside a transcript acts as the pretty-printer in `run` as opposed to
`run.compiled`. But I did some manual testing with the following `main`
method:

```unison
main = do
  Debug.trace "output" (1, "foo", -1, -3.2, 0xsabba, ["one", "two"], [-2.1, +3.4], [0xsabba, 0xsdeadbeef])
```

Previous output
---------------

```
trace: output
DataB2 #2lg4a 3276800 (DataU1 ##Nat 1310720 1) (DataB2 #2lg4a 3276800 (Foreign (Wrap ##Text "foo")) (DataB2 #2lg4a 3276800 (DataU1 ##Int 983040 (-1)) (DataB2 #2lg4a 3276800 (DataU1 ##Float 589824 (-4608983858650965606)) (DataB2 #2lg4a 3276800 (Foreign (Wrap ##Bytes _)) (DataB2 #2lg4a 3276800 (Foreign (Wrap ##Sequence _)) (DataB2 #2lg4a 3276800 (Foreign (Wrap ##Sequence _)) (DataB2 #2lg4a 3276800 (Foreign (Wrap ##Sequence _)) (Enum #00nv2 3342336))))))))
```

New output
----------

```
(1,
"foo",
-1,
-3.2,
0xsabba,
["one", "two"],
[-2.1, 3.4],
[0xsabba, 0xsdeadbeef])
```
2023-05-22 14:48:52 -04:00
Arya Irani
b5beb0e94d merge old lts bump into new trunk 2023-05-20 16:37:08 -04:00
Dan Doel
170b719714 Fix calling convetion for outIoFailUnit
- Was written under the presumption that unit-returning primops actually
  produce a boxed value, but they actually don't produce any value.
2023-05-19 13:55:54 -04:00
Arya Irani
2aa0a981f4
Merge pull request #4002 from unisonweb/travis/recall-most-recent-branch 2023-05-19 11:27:05 -04:00
Paul Chiusano
a9492a744d Merge remote-tracking branch 'origin/trunk' into topic/localdeps 2023-05-18 15:09:54 -05:00
Chris Penner
4b19b3c63b Add Bifunctor and methods to Unison.Prelude 2023-05-18 11:27:52 -06:00
Travis Staton
a9ee7f7be0
add most_recent_branch table 2023-05-17 14:40:28 -04:00
Jared Forsyth
ad549eaabd [tls-rest] trying these out 2023-05-15 21:21:35 -05:00
Paul Chiusano
18634e4cca wip 2023-05-15 12:47:48 -05:00
Mitchell Rosen
a03419f793 add new ProjectAndBranchNames type that captures possible ambiguity
between a project name and branch name at parse-time
2023-05-01 13:00:12 -04:00
Cody Allen
3f349c0448
Link.Term.toText: handle ability constructors
Fixes #3938

I wasn't really sure of the right way to test this. I added a test to
`builtin-tests` that was previously failing and now succeeds. I wasn't
sure whether I should include specific ability constructor
hashes/indexes in the test, so I just tested that it doesn't throw an
exception. This test also doesn't seem to run with `stack test` and
needs me to explicitly call
`./unison-src/builtin-tests/interpreter-tests.sh` but it seems like that
is a thing?

Anyway it seems to work:

```
.> cd .tmp        service_calls
.tmp>

  

  ~/code/unison/scratch.u changed.

  Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels.

    1 | > Link.Term.toText (termLink abort)
          ⧩
          "#b589mbg492brf3k3t0lg706d7ob88jqslgmja9gkrimv4137utuittc2r9l1tgvhrl40f71c99m39ch48gubbjhn5vf2pf5evjsinn8#0"

.tmp>

  

  ~/code/unison/scratch.u changed.

  Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels.

    1 | > Link.Term.toText (termLink Store.get)
          ⧩
          "#fmj3l8nggpfuh0ueuhr2rcka4s91ihufqiq6rocn25vsnni3v8rtjjteq79d398shvrfvbmhhoc7amhoh9lmdlghhiirl81sodj3ti0#1"

.tmp>

  

  ~/code/unison/scratch.u changed.

  Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels.

    1 | > Link.Term.toText (termLink Store.put)
          ⧩
          "#fmj3l8nggpfuh0ueuhr2rcka4s91ihufqiq6rocn25vsnni3v8rtjjteq79d398shvrfvbmhhoc7amhoh9lmdlghhiirl81sodj3ti0#0"
```
2023-04-28 16:20:43 -04:00
mergify[bot]
b97cc156f4
Merge pull request #3915 from unisonweb/travis/ability-handler-pmcc
Add pattern match coverage checking for ability handlers
2023-04-18 18:45:47 +00:00
Travis Staton
4eb08d371e
Relax inhabitation check for ability handler 2023-04-14 16:22:00 -04:00
Travis Staton
87ba8d8f89
Add pattern match coverage checking for ability handlers 2023-04-13 20:57:45 -04:00
Paul Chiusano
72263cb7c6
Merge pull request #3910 from unisonweb/cp/index-updates
Allow regenerating name lookups
2023-04-13 12:46:31 -05:00
Chris Penner
66a8b3f663 Allow initializing codebase with setup action 2023-04-11 14:31:43 -06:00
Chris Penner
8d7b930c32 Allow regenerating name lookups 2023-04-06 12:38:34 -06:00
Chris Penner
576974ff39
Allow streaming diffs in constant memory (#3852)
Add stream combinator for namespace diffs
2023-04-05 17:10:20 -06:00
Chris Penner
02095670c3 Merge remote-tracking branch 'origin/trunk' into topic/projects 2023-03-29 14:19:06 -06:00
Travis Staton
2c2385061e
update ppe var name 2023-03-28 13:33:20 -04:00
Travis Staton
6b3c2f2985
fix test 2023-03-28 13:25:54 -04:00
Travis Staton
bce88c3d98
ormolu 2023-03-28 13:25:54 -04:00
Travis Staton
c9bfb5d7aa
Pretty print pmcc info with names 2023-03-28 13:25:49 -04:00
Travis Staton
1a53f89580
Merge pull request #3884 from unisonweb/travis/3879/pattern-match-coverage-perf
Cache constructor enumeration during pattern match coverage checking
2023-03-28 13:14:22 -04:00
Travis Staton
9807c87ee1
Cache constructor enumeration during pattern match coverage checking
fixes #3879
2023-03-27 16:22:50 -04:00
Chris Penner
b35f5cd02f
Build PPE using name lookup indices queries (#3682)
Use pre-loaded PPE mechanism
2023-03-27 13:35:33 -06:00
Chris Penner
9499497a4c Ormolu 2023-03-23 16:36:45 -06:00
Chris Penner
927ea84ed3 Propagate annotations to typecheck file 2023-03-23 16:08:38 -06:00
Chris Penner
3a54bc5652 Merge remote-tracking branch 'origin/trunk' into lsp/binding-annotations 2023-03-23 15:33:52 -06:00
Chris Penner
2ff7dde656 Fixup 2023-03-23 15:19:48 -06:00
Chris Penner
4aef564e37 Merge remote-tracking branch 'origin/lsp/binding-annotations' into lsp/binding-annotations 2023-03-23 15:17:09 -06:00
Mitchell Rosen
ff46eafa26 fix pull reflog entry 2023-03-21 13:11:16 -04:00
Mitchell Rosen
2ab431ce38 more refining names of remote repo types 2023-03-16 16:20:25 -04:00
Mitchell Rosen
6961173be3 ReadRemoteProjectBranch -> ReadShareProjectBranch 2023-03-16 12:49:15 -04:00
Chris Penner
527a91a405 Merge remote-tracking branch 'origin/topic/projects' into cp/project-codebase-browse 2023-03-15 10:36:55 -06:00
Chris Penner
12289c2d7f Ormolu 2023-03-15 10:36:32 -06:00
Chris Penner
4f11b223bf Merge remote-tracking branch 'origin/topic/projects' into cp/project-codebase-browse 2023-03-15 10:07:43 -06:00
Chris Penner
02722b61e6 Merge remote-tracking branch 'origin/trunk' into topic/projects 2023-03-15 09:43:55 -06:00
Chris Penner
c430aaa34a
Port Codebase.getDeclType to be in Sqlite.Transaction (#3866) 2023-03-15 09:32:22 -06:00
Mitchell Rosen
d4bb6475ea merge push target into WriteRemotePath type (now called WriteRemoteNamespace) 2023-03-14 17:45:36 -04:00
Chris Penner
1aa70be181 Merge remote-tracking branch 'origin/topic/projects' into cp/project-codebase-browse 2023-03-14 15:25:13 -06:00
mergify[bot]
1fa5ef3d8e
Merge pull request #3865 from chriskrycho/add-md5
Add `Md5` builtin to `crypto.HashAlgorithm`
2023-03-13 22:10:00 +00:00
Chris Krycho
81290d8eb4
Add Md5 builtin to crypto.HashAlgorithm
Expose Haskell's implementation like the existing crypto built-ins, and
add it to the test transcripts.
2023-03-13 15:36:55 -06:00
Travis Staton
8b4eeead4d
Merge pull request #3863 from unisonweb/travis/3861
Fix #3861
2023-03-13 17:06:28 -04:00
Travis Staton
05fd0d704a
pull name resolution 2023-03-13 17:00:02 -04:00
Rúnar
3572bd3695 Allow destructuring bind at beginning of do/lambda 2023-03-13 14:35:29 -04:00
Travis Staton
b9b4dd88d0
Fix #3861 2023-03-13 14:17:04 -04:00
Travis Staton
42f8c18734
remote name resolution for pull 2023-03-10 15:46:50 -05:00
Chris Penner
a7aecd32c3
Fix missing column in primary key for name lookup indexes (#3850)
* Add migration to fix bad primary key in scoped_type_lookup

* Drop indexes before creating new ones.

* Remove "on conflict do nothing" when building name lookups

* Change Migration 8 to 9 to be a pure sql migration
2023-03-09 13:30:13 -06:00
Mitchell Rosen
275aedd851 ⅄ trunk → topic/projects 2023-03-09 12:51:19 -05:00
Mitchell Rosen
a500e14061 add new ReadRemoteProjectBranch constructor to ReadRemoteNamespace type 2023-03-09 10:37:55 -05:00
Travis Staton
0c9949b525
Gather all type dependencies for pattern coverage checking 2023-03-08 12:53:05 -05:00
Travis Staton
491366ece0
bugfix: ensure unconstrained sets are inhabited 2023-03-08 12:44:35 -05:00
Rúnar
389399c8e3 Merge branch 'trunk' of https://github.com/unisonweb/unison into topic/multilinelambda 2023-03-07 22:22:31 -05:00
Chris Penner
6ee30aedd0 Accept branch hash in name lookup index operations 2023-03-07 11:21:31 -06:00
Travis Staton
61b65bfe5b
Merge pull request #3737 from unisonweb/travis/pattern-match-coverage-checker
Add pattern match coverage checking
2023-03-06 15:22:49 -05:00
Rúnar
d9cdf6b40b Fix roundtrip error with block lambdas 2023-03-03 21:03:40 -05:00
Paul Chiusano
a6fae7cd65 ormolu 2023-03-03 15:26:09 -06:00
Paul Chiusano
02006ffefe lexer strips leading whitespace from raw literals, and pretty-printer also uses syntax opportunistically 2023-03-03 15:10:30 -06:00
Paul Chiusano
b384671ff7 pretty-printer uses raw text syntax opportunistically (not yet working) 2023-03-03 13:32:31 -06:00
Travis Staton
96bcbcf2b7
add complete pragma 2023-03-03 10:50:35 -05:00
Travis Staton
1eefcdc5d3
stray comment 2023-03-03 10:42:07 -05:00
Travis Staton
8faa72a349
Use Unison.Debug flags 2023-03-03 10:25:41 -05:00
Travis Staton
2cadd28947
document toClasses 2023-03-02 17:15:33 -05:00
Travis Staton
a7f201ef6e
stray trash comments 2023-03-02 17:15:33 -05:00
Travis Staton
465737054b
Use Unison.DataDeclaration.dependencies 2023-03-02 17:15:33 -05:00
Travis Staton
fe619f612f
Update parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs
Co-authored-by: Chris Penner <christopher.penner@gmail.com>
2023-03-02 17:08:04 -05:00
Mitchell Rosen
dae2fefd4c more project.clone work 2023-03-02 15:30:38 -05:00
Travis Staton
de90ae783b
always instantiate Unit 2023-03-02 11:23:50 -05:00
Travis Staton
7d1a03b385
instantiate when we have positive information as well 2023-03-02 11:23:50 -05:00
Travis Staton
7314d09623
error message tweaks 2023-03-01 15:28:16 -05:00
Travis Staton
d9eeea9012
documentation and cleanup 2023-03-01 14:53:57 -05:00
Travis Staton
1ab327e01b
document GrdTree 2023-03-01 10:31:41 -05:00
Travis Staton
e80e87f755
documentation 2023-02-28 16:15:52 -05:00
Travis Staton
d69071fb2c
ormolu 2023-02-27 17:51:17 -05:00
Travis Staton
41d05fc145
ormolu 2023-02-27 17:48:25 -05:00
Travis Staton
74cd76b49f
typos and transcript edit 2023-02-27 16:39:00 -05:00
Travis Staton
16585a4150
Ensure data declaration map is populated as expected by pattern match coverage checker 2023-02-27 16:38:50 -05:00
Travis Staton
bfe8364bb0
make patterns complete in base.u 2023-02-27 11:11:46 -05:00
Travis Staton
1cf470a707
Fix bug in desugarPattern 2023-02-27 11:03:01 -05:00
Travis Staton
c69dc75fd1
fix builtins.mergeio bug 2023-02-27 11:03:01 -05:00
Travis Staton
e2c0cb376e
print type failures in IOSource 2023-02-27 11:03:01 -05:00
Travis Staton
768270a664
don't check coverage for ability handlers (yet) 2023-02-27 11:03:01 -05:00
Travis Staton
9e3dbb62b8
Add pattern match coverage checking 2023-02-27 11:02:59 -05:00
Chris Penner
d6f1c159b8 Merge remote-tracking branch 'origin/trunk' into topic/projects 2023-02-24 12:36:23 -06:00
Chris Penner
eda768c94f Fixups 2023-02-23 16:48:49 -06:00
Chris Penner
04fab24848 Fix bad ucm migration backups 2023-02-23 16:40:39 -06:00
Chris Penner
dac81026dc Merge branch 'cp/causal-name-lookup-index' into cp/remove-old-name-lookups 2023-02-23 10:54:33 -06:00
Chris Penner
3b6d7d6645 Merge branch 'trunk' into cp/causal-name-lookup-index 2023-02-23 10:51:50 -06:00
Chris Penner
e2a3b9ae28
Updates for safer migrations on Share (#3825)
* Include schema version in backup and use vacuum into

* Allow specifying not to backup on migration

* Add ability to copy codebase safely (for share migrations)

* Set migration strategies

* Create dir to copy into if missing

* Ormolu

* ormolu
2023-02-22 12:36:57 -06:00
Travis Staton
d38f31a93c
Merge remote-tracking branch 'origin/trunk' into topic/projects 2023-02-22 12:51:03 -05:00
Fabio Labella
26d251e977 Add id for ThreadKilledFailure 2023-02-22 11:19:36 +00:00
Fabio Labella
8bb93a4ede Add reference for threadKilledFailure 2023-02-22 11:19:36 +00:00
Fabio Labella
78153f6f45 Intercept async exceptions 2023-02-22 11:19:36 +00:00
Dan Doel
82bd02faea Some type references were being ignored when compiling code
- The existing code was assuming that only references involved in `Pack`
  instructions were relevant, but this only preserves data type and
  request information. We need to remember types used in handlers, or
  else we will think that remote requests are coming from distinct
  abilities than the ones we are handling.
2023-02-15 17:29:23 -05:00
Cody Allen
3f28697e25
Improve error message for unhandled ability
In certain cases this will change the failure message from something
like `resolve: unhandled ability request: 1561` to `resolve: unhandled
ability request: #ifg08` where `#ifg08` is the has of the ability that
was unhandled. At this stage we don't have convenient access to the
actual constructor within the ability that was not handled.

I haven't added tests because I don't really know how to set them up.
But it's not really a big deal if there's a regression in this error
message, so I'm not sure whether they'd be worth the trouble.
2023-02-15 10:01:36 -05:00
Paul Chiusano
96d42d213c reformat 2023-02-14 09:59:26 -06:00
Paul Chiusano
7e37991a96 Merge remote-tracking branch 'origin/trunk' into pchiusano/ormolu_prs
# Conflicts:
#	parser-typechecker/src/Unison/Runtime/Foreign.hs
2023-02-14 09:57:48 -06:00
Rúnar
47e5ce7c7d
Merge pull request #3820 from unisonweb/topic/characterclass
Char.Class builtin type and supporting functions
2023-02-13 21:26:47 -05:00
Paul Chiusano
88ef0a8d37 Ormolu-ify the codebase and update development.markdown docs 2023-02-13 13:03:08 -06:00
Fabio Labella
9308c8cd63 Fix calling convention wrapper for killThread 2023-02-13 16:29:19 +00:00
Mitchell Rosen
74e589205c push refactoring and delete project.create-branch command 2023-02-10 22:43:17 -05:00
Rúnar
5a7b323df7 Fix test 2023-02-10 21:51:49 -05:00
Mitchell Rosen
1e19f5e996 ⅄ trunk → topic/projects 2023-02-10 19:25:33 -05:00
Rúnar
2418c292bd Add character class builtin and functions 2023-02-10 15:29:10 -05:00
Travis Staton
bf88e668a6
upgrade hpack to 0.35 2023-02-09 14:04:47 -05:00
Chris Penner
d5f06ee169 Regen cabal 2023-02-08 13:01:01 -06:00
Chris Penner
5a002b12d3 Merge branch 'cp/causal-name-lookup-index' into cp/remove-old-name-lookups 2023-02-08 12:55:14 -06:00
Chris Penner
a43c6d9171 Merge branch 'trunk' into cp/causal-name-lookup-index 2023-02-08 12:54:57 -06:00
Chris Penner
34c3d9844f Merge branch 'cp/causal-name-lookup-index' into cp/remove-old-name-lookups 2023-02-08 12:24:27 -06:00
Chris Penner
050ba1fd51 Cabal files 2023-02-08 12:24:12 -06:00
Chris Penner
106af7fdd2 Merge branch 'cp/causal-name-lookup-index' into cp/remove-old-name-lookups 2023-02-08 12:21:53 -06:00
Chris Penner
fedf1f6d6d Merge branch 'trunk' into cp/causal-name-lookup-index 2023-02-08 12:21:11 -06:00
Chris Penner
4dc750469b Merge branch 'cp/causal-name-lookup-index' into cp/remove-old-name-lookups 2023-02-08 11:52:31 -06:00
Mitchell Rosen
8a7e6f9ac2 pipe through project.switch input 2023-02-08 12:39:17 -05:00
Chris Penner
6873962863 Don't run integrity checks after a simple table create. 2023-02-08 10:40:29 -06:00
Chris Penner
860f6ec5f2 Move scoped name lookups into UCM migration 2023-02-08 10:26:26 -06:00
Stew O'Connor
df545944dd Merge remote-tracking branch 'origin/trunk' into fix-tls-calling-convention 2023-02-07 13:36:36 -08:00
Stew O'Connor
dbe95fb6ac Fix calling convention in Tls.send and Tls.handshake 2023-02-07 13:36:17 -08:00
Cody Allen
7df6664687
Fix universal equality for Socket
Resolves #3791

Delegate to the runtime's Socket equality, which I believe uses pointer
equality.

I tested this by running the following code, which no longer gives an
error after this change:

```
main = do
  socket = Socket.client (HostName "www.google.com") (Port "http")
  socket === socket
```
2023-02-02 11:32:14 -05:00
Chris Penner
d9e0cfa9cf
Upgrade to stack 2.9.1 (#3787) 2023-02-02 09:49:21 -06:00
Cody Allen
cd559fbaf0
Improve type error message for == on Foreign
This improves the error message when there is a type mismatch in
equality checks of `Foreign`. The `Eq.==` error message now matches the
style of error message provided for `compare` on the `Ord` instance.
2023-02-02 09:52:16 -05:00
Mitchell Rosen
6f7718b8f0 ⅄ trunk → 22-12-19-change-pull-empty-namespace-message 2023-01-31 11:52:54 -05:00
Paul Chiusano
cb8910879d
Merge pull request #3784 from unisonweb/cp/destructuring-bind-guards 2023-01-30 13:02:19 -06:00
Chris Penner
a8f217c28d Remove unused branch operations 2023-01-30 12:02:06 -06:00
Chris Penner
0280592b34 No guards on destructuring binds 2023-01-30 11:54:25 -06:00
Chris Penner
7efaeea5dd Merge branch 'trunk' into cp/causal-name-lookup-index 2023-01-27 09:30:46 -06:00
Mitchell Rosen
6f7f5c89cc ⅄ topic/projects-api → topic/projects 2023-01-26 12:14:07 -05:00
Dan Doel
9e0e93135f Merge remote-tracking branch 'origin/trunk' into topic/builtins-misc 2023-01-26 10:30:05 -05:00
Dan Doel
6554ea385a Flesh out process builtins
- Renames callProcess to process.call since there will be several
  related functions now.
- Adds a ProcessHandle type for references to asynchronous processes
- Add start, kill, wait and exitCode for interactive processes.
  * start spawns a new process with the given command and arguments,
    returning Handles for the in, out and error streams of the process,
    and a ProcessHandle referencing it
  * kill kills a process given a ProcessHandle
  * wait blocks on a process to finish and returns the exit code
  * exitCode does a non-blocking query for the exit code of the process.
    It returns `None` if the process is still running.
2023-01-25 17:51:58 -05:00
Dan Doel
08172a9eff Add a 'callProcess' builtin
- This allows calling out to an external executable with specified
  arguments. The executable is searched for in the path according to
  some platform specific rules. The call is blocking, and the exit
  code is returned.
- Note: this is _not_ the sort of external call that involves a shell
  as an intermediary.
- This sort of call is supported by both Haskell and racket. Chez seems
  to only have the shell-based external call, so it might be necessary
  to wrap a foreign library for it (otherwise the arguments would have
  to be escaped, which seems like a bad idea). Nevertheless, it seems
  like the right API to expose.
- Opening a fully interactive, asynchronous process is left for future
  work.
2023-01-25 15:09:17 -05:00
Chris Penner
119a254c9e Nuke updateNameLookup 2023-01-25 13:55:35 -06:00
Paul Chiusano
5ce9e4fdbe
Merge pull request #3734 from unisonweb/cp/fix-bad-case-parser
Require that each pattern have at least one RHS.
2023-01-25 09:36:03 -06:00
Fabio Labella
39ae32e68a Handle calling convention properly 2023-01-25 02:18:25 +00:00
Fabio Labella
acc7c18ed6 Add binding to universal hashing 2023-01-25 02:18:25 +00:00
Fabio Labella
94fde101ab Add signature for murmurHash 2023-01-25 02:18:25 +00:00
Fabio Labella
8b84ce9547 Add murmur-hash 2023-01-25 02:18:25 +00:00
Dan Doel
7261823de1 Make Nat/Int.fromText return None for over/underflows 2023-01-24 14:37:34 -05:00
Chris Penner
a63d576fcb Cleanup 2023-01-24 11:03:20 -06:00
Chris Penner
2ba7dff460 Wire up scoped name lookups further 2023-01-24 10:24:23 -06:00
Chris Penner
ac3838fce7 Fill out more scoped operations 2023-01-24 10:14:23 -06:00
Dan Doel
831b81afc3 Merge branch 'trunk' into topic/debug-show 2023-01-23 16:03:46 -05:00
Dan Doel
03474ac2b0 Add a Debug.toText builtin
- This reworks the Debug.trace machinery to allow getting just the
  text that would be shown for a value. Instead of carrying a tracing
  function in the runtime, a function that generates the (annotated)
  text is used, and the logic for printing it is moved to the runtime
  itself.

- Also, a primitive instruction is available for getting at the text. It
  has three possible results:

    * None - the tracer is completely off
    * Some (Left txt) - an 'ugly' textual representation
    * Some (Right txt) - a 'pretty' textual representation
2023-01-23 15:04:52 -05:00
Mitchell Rosen
ea2263dac3 add 7->8 migration to Haskell code 2023-01-23 11:36:18 -05:00
Simon Højberg
f36491b03d
Merge branch 'trunk' into inline-latex-and-svg 2023-01-23 09:25:06 -05:00
Fabio Labella
17c0d8d5d8 Promise.write should take the Promise as its first argument 2023-01-19 16:22:53 +00:00
Fabio Labella
375e435180 Remove repro of CAS bug 2023-01-19 16:20:17 +00:00
Fabio Labella
2b695ab451 Make sure all writes to an IORef are fully evaluated
If writes aren't fully evaluated, the Closure inside the IORef might
contain a thunk, which then ruins pointer equality, resulting in
failed CAS
2023-01-19 16:00:59 +00:00
Fabio Labella
c643ace1b5 Ref should be the first argument 2023-01-19 15:51:54 +00:00
Fabio Labella
38e79afbe2 casIORef works in haskell, bus error is in the unison bindings 2023-01-19 13:14:52 +00:00
Fabio Labella
77ecc43e39 Centralise concurrency primitives in a single module 2023-01-19 02:54:48 +00:00
Fabio Labella
b408907bf9 Add bindings for Promise 2023-01-17 03:00:41 +00:00
Fabio Labella
34f113647f Add type signatures for Promise 2023-01-17 03:00:23 +00:00
Fabio Labella
460c124778 Add single-shot promise type 2023-01-17 03:00:23 +00:00
Fabio Labella
2f5bc1f80c Add comments on memory model for IORefs 2023-01-17 03:00:23 +00:00
Fabio Labella
aab311ac4f Abbreviate compareAndSwap 2023-01-17 03:00:23 +00:00
Fabio Labella
0e8d714ebd Add helper type for IO ability list 2023-01-17 03:00:23 +00:00
Fabio Labella
0cb26fb80f Make sure the ref+promise builtins are under the right namespace 2023-01-17 03:00:23 +00:00
Fabio Labella
a870a5a22b Only return a Boolean from CAS on IORef
In GHC, CAS returns both a Boolean and the current value of the IORef,
which can be used to retry a failed CAS.
This strategy is more efficient than returning a Boolean only because
it uses a single call to cmpxchg in assembly (see [1]) to avoid an
extra read per CAS iteration, however it's not supported in Scheme.
Therefore, we adopt the more common signature that only returns a
Boolean, which doesn't even suffer from spurious failures because GHC
issues loads of mutable variables with memory_order_acquire (see [2])

Incidentally, this also works around the lack of support for compound
direct lets in our interpreter.

[1]: https://github.com/ghc/ghc/blob/master/rts/PrimOps.cmm#L697
[2]: https://github.com/ghc/ghc/blob/master/compiler/GHC/StgToCmm/Prim.hs#L285
2023-01-17 03:00:23 +00:00
Fabio Labella
4806735355 Identify bug 2023-01-17 03:00:23 +00:00
Fabio Labella
22617a4330 Add TODOs 2023-01-17 03:00:23 +00:00
Fabio Labella
3b7f97603d Add Ref and Ticket bindings 2023-01-17 03:00:23 +00:00
Fabio Labella
77d5d1ea02 Add type signatures for Ticket and CAS on Ref 2023-01-17 03:00:23 +00:00
Fabio Labella
c5e3766e76 Pin hpack to version 34 2023-01-17 03:00:23 +00:00
Fabio Labella
661de0c380 Add atomic-ops dependency 2023-01-13 17:15:35 +00:00
Chris Penner
a885d68834 Slightly better error messages 2023-01-10 14:33:42 -06:00
Chris Penner
75c99b5c76 Update labels 2023-01-10 13:50:02 -06:00
Chris Penner
d318f9f593 Fix parsing rules for pattern blocks 2023-01-10 13:34:50 -06:00
Chris Penner
6f4fce913f Require that each pattern have at least one RHS. 2023-01-10 12:45:31 -06:00
Chris Penner
59e8a25693
Fix annotations for bindings and blocks (#3689)
* WIP: fix up anns for bindings, blocks, etc.

* Working annotations for lets

* Add nesting tests

* Fix nesting tests

* Fix annotations on let-rec blocks

* Fix bad test src

* Skip destructuring binds test for now.

* Remove debugging

* Better fallbacks for finding ref nodes

* Transcript updates

* Fix bad 'contains'

* Rewrite letrec and let combinators to avoid requiring semigroup

* Don't include block openers in the block itself.

We don't want things like '=' or '->' to be part of a block

* Re-run transcripts

* Remove redundant constraint
2023-01-10 11:12:51 -06:00
Cody Allen
624b0ec450
Merge pull request #3715 from unisonweb/topic/builtins
Tweak some builtin implementations
2023-01-09 09:51:29 -05:00
Chris Penner
84f36ff4a8
Parse share handles separate from name segments (#3704)
* Parse share handles with `-` in them
2023-01-09 08:42:44 -06:00
Simon Højberg
9e74fb1b41 Doc: add support for inline latex and svg
Add new helpers for creating `Embed` and `EmbedInline` for `LaTeX` and `Svg`,
similar to the form we use for `FrontMatter` and `Video`.
2023-01-05 15:38:38 -05:00
Cody Allen
50594818a8
Merge pull request #3717 from ceedubs/default-pull-silent
default pull to silent mode
2023-01-03 18:26:44 -05:00
Chris Penner
23745a7144 WIP 2023-01-03 09:58:55 -06:00
Chris Penner
4d4ebe704e WIP 2023-01-03 09:58:39 -06:00
Mitchell Rosen
68bc9e1561 ⅄ trunk → 22-12-14-tidy-up-hashing-package 2022-12-21 16:55:42 -05:00
Mitchell Rosen
99f6cc7a19 ⅄ trunk → 22-12-19-change-pull-empty-namespace-message 2022-12-21 11:56:51 -05:00
Cody Allen
bcba9df787
default pull to silent mode
What was `pull.silent` is now also `pull`.
What was `pull` is now `pull.verbose`.

Resolves #3566.

Before this change, the `Verbosity` type (which I believe was only used
for variations of pulling code) was either `Silent` or `Default`. This
is awkward because silent became the new default. So I changed it to
`Silent` or `Verbose` and filled in default values as needed.

I retained the verbose functionality for `debug.pull-exhaustive` because
if you are in the state that you need that command, some extra output
about what is happening might be useful.
2022-12-21 10:07:09 -05:00
Mitchell Rosen
5e9535425c prepend "test>" to edited tests 2022-12-20 15:49:09 -05:00
Dan Doel
f16514c9a9 Avoid trailing separators in temp directory functions 2022-12-20 15:12:01 -05:00
Dan Doel
884e966ad8 Make take/drop builtins behave better w.r.t large numbers 2022-12-20 11:29:02 -05:00
Paul Chiusano
3d24c5193c
Merge pull request #3714 from unisonweb/topic/debugging 2022-12-19 16:51:56 -06:00
Dan Doel
e148f3c2e8 Fix formatting. 2022-12-19 16:53:38 -05:00
Dan Doel
6ef58e5947 Add machinery for checking alpha equivalence of intermediate code 2022-12-19 16:33:29 -05:00
Mitchell Rosen
9dbafc10c9 warn after pulling an empty namespace 2022-12-19 16:05:15 -05:00
Chris Penner
031108c1ab WIP 2022-12-19 12:22:19 -06:00
Chris Penner
296feaa683 WIP 2022-12-19 12:19:46 -06:00
Chris Penner
c25f6af80a WIP 2022-12-19 11:58:01 -06:00
Chris Penner
8091d2472f WIP 2022-12-19 11:25:27 -06:00
Chris Penner
fa9b2e0b1b Add top level annotations to file types 2022-12-17 16:46:35 -06:00
Mitchell Rosen
af5d1f2f50
Merge pull request #3693 from unisonweb/22-12-12-diff-namespace-v2
Make `diff.namespace.to-patch` use "v2" branch diffs
2022-12-16 21:48:58 -05:00
Dan Doel
754a294d58 Revise implementation of foreign universal eq/compare
- It seems that there are situations where implementing foreign
  equality as:

      promote ((==) @ T)

  (where `promote` wraps the inputs with coercions) can cause memory
  faults. This is _not_ because the runtime is (currently) erroneously
  coercing between distinct types (at least in the test case used to
  find this error). Rather, it has something to do with `unsafeCoerce`
  causing invalid GHC to generate some invalid code, whether via
  optimization or otherwise.

  It seems that separating out the equality test into its own,
  noinline function prevents the issue. So, that has been done for all
  cases. It is actually quite difficult to find simple code that
  triggers the issue, however, so it is difficult to say whether this
  definitively fixes the problem.
2022-12-16 20:00:33 -05:00
Dan Doel
e2ea033747 Use unsafe checked arrays to back array builtins.
- These already have checks in the foreign operations, but another layer
  couldn't hurt for debugging.
2022-12-16 19:56:19 -05:00
Chris Penner
26703a1f84
Simply remove the error printing on scratch file contention (#3702) 2022-12-16 12:08:26 -06:00
Dan Doel
781881dbfb Add debug bounds checking for arrays used in the interpreter 2022-12-16 12:31:44 -05:00
Mitchell Rosen
a87a688471 fold U.Util.Hash into Unison.Hash 2022-12-15 13:48:36 -05:00
Mitchell Rosen
f21e6483e7 code review 2022-12-15 13:32:43 -05:00
Mitchell Rosen
6e99914c77 ⅄ trunk → 22-12-14-tidy-up-hashing-package 2022-12-15 12:46:57 -05:00
Mitchell Rosen
b062e7112f fix test suite again 2022-12-15 12:42:02 -05:00
Mitchell Rosen
3e395e3b89 move unison-hash:Unison.ContentAddressable to unison-hashing:Unison.Hashing.ContentAddressable 2022-12-15 12:31:30 -05:00
Mitchell Rosen
b5138c235e fix errors in test suite 2022-12-15 12:04:07 -05:00
Mitchell Rosen
b68531dad1 ⅄ trunk → 22-12-12-diff-namespace-v2 2022-12-15 11:45:22 -05:00
Mitchell Rosen
ee9309ee15 ⅄ trunk → 22-12-09-break-up-unison-util 2022-12-15 11:41:36 -05:00
Mitchell Rosen
4be5ff5346 ⅄ trunk → 22-12-14-tidy-up-hashing-package 2022-12-14 21:15:35 -05:00
Mitchell Rosen
3c20ab3834 change hashing v2 branch type name from Raw to Branch 2022-12-14 21:00:55 -05:00
Mitchell Rosen
9b423774a6 hide v2 hashing behind an interface 2022-12-14 20:59:46 -05:00
Mitchell Rosen
72c5f1db5e add instance ContentAddressable for hashing branch 2022-12-14 19:26:19 -05:00
Mitchell Rosen
bbc17e01a6 move Unison.Hash and friends to new unison-hash package 2022-12-14 19:03:52 -05:00
Mitchell Rosen
ce23976934 Move hashing-v2 name segment into its own module 2022-12-14 18:20:06 -05:00
Mitchell Rosen
9914000071 ⅄ trunk → 22-12-12-one-name-segment-type 2022-12-14 17:48:57 -05:00
Mitchell Rosen
2dbb867a3c
Merge pull request #3692 from unisonweb/22-12-12-hash-tags-in-core
Cleanup: share hash tags newtypes in codebase/parser-typechecker
2022-12-14 17:42:46 -05:00
Mitchell Rosen
8d25fe1b26
Merge pull request #3599 from unisonweb/22-11-10-get-term-transaction
Refactor: make getTerm in Transaction, not IO
2022-12-14 17:38:17 -05:00
Mitchell Rosen
bfca067ed1 ⅄ trunk → 22-12-12-hash-tags-in-core 2022-12-14 12:49:35 -05:00
Chris Penner
108688aff6
Remove external names from names-index lookups (#3688)
* Remove external names from names-index lookups
2022-12-14 10:16:47 -06:00
Mitchell Rosen
200c8f1cbd make diff.namespace.to-patch command use v2 branch diffs 2022-12-13 14:05:39 -05:00
Mitchell Rosen
f971d8c41d ⅄ trunk → 22-12-09-break-up-unison-util 2022-12-13 14:05:22 -05:00
Mitchell Rosen
ded584447c
Merge pull request #3686 from unisonweb/22-12-09-hashing-v2-cleanup
clean up codebase-sqlite-hashing-v2 package
2022-12-13 13:12:45 -05:00
Mitchell Rosen
b26bbbd31e ⅄ 22-12-12-hash-tags-in-core → 22-12-12-diff-namespace-v2 2022-12-12 16:50:47 -05:00
Mitchell Rosen
af371f100e hpack version flub snuck in through the basement door 2022-12-12 16:26:04 -05:00
Mitchell Rosen
a3a680e548 ⅄ trunk → 22-11-10-get-term-transaction 2022-12-12 16:24:10 -05:00
Mitchell Rosen
e46f44add3
Merge pull request #3594 from unisonweb/22-11-10-term-referents-by-prefix-transaction
Refactor: make termReferentsByPrefix in Transaction, not IO
2022-12-12 16:23:15 -05:00
Mitchell Rosen
98ebde82cd delete second copy of PatchHash (called EditHash) 2022-12-12 16:22:11 -05:00
Mitchell Rosen
fb35e9580c delete second copy of CausalHash 2022-12-12 15:56:44 -05:00
Mitchell Rosen
eb1e3234d5 add NameBasedDiff, nameBasedDiff 2022-12-12 14:47:40 -05:00
Mitchell Rosen
2c8f323d35 eliminate second NameSegment type (U.Codebase.Branch.Type.NameSegment) 2022-12-12 13:11:25 -05:00
Mitchell Rosen
4f38c03f5b pull Unison.Test.Cache out into its own test suite 2022-12-09 14:52:18 -05:00
Mitchell Rosen
7eee9e01bb remove vestigial unison-util package 2022-12-09 14:37:52 -05:00
Mitchell Rosen
a59fdcf2c1 move U.Util.Timing from unison-util to unison-prelude 2022-12-09 14:29:24 -05:00
Mitchell Rosen
c0b7b5fac2 move U.Util.Cache out of unison-util and into its own package unison-util-cache 2022-12-09 13:00:50 -05:00
Mitchell Rosen
62fcddc45f delete (almost) redundant copy of Unison.Util.Monoid called U.Util.Monoid
it had one additional function, `intercalateMapM`, which was copied over
2022-12-09 12:28:22 -05:00
Mitchell Rosen
de005ab72f clean up codebase-sqlite-hashing-v2 package 2022-12-09 11:56:24 -05:00
Chris Penner
de03baa23a
Merge pull request #3645 from unisonweb/cp/dont-strip-type-sigs
Don't strip type signatures during synthesis, even if redundant.
2022-12-09 10:48:39 -06:00
Chris Penner
4b36e27c7a Merge branch 'trunk' into cp/dont-strip-type-sigs 2022-12-09 10:24:41 -06:00
Mitchell Rosen
34676d0c28
Merge pull request #3646 from unisonweb/22-11-28-diff-namespace-patch
Add `diff.namespace.to-patch` command
2022-12-09 10:23:24 -05:00
Dan Doel
488e7e6f9d Fix an out-of-bounds in array comparison 2022-12-08 14:07:08 -05:00
dolio
49432e9b1d
Merge pull request #3672 from unisonweb/topic/ci-unit-tests
Fix CI to run some (previously skipped) unit tests in unison-parser-typechecker
2022-12-07 15:38:14 -05:00
Mitchell Rosen
570c855acd ⅄ trunk → 22-11-10-term-referents-by-prefix-transaction 2022-12-07 14:26:43 -05:00
Mitchell Rosen
6766d48c88 ⅄ trunk → 22-11-10-get-term-transaction 2022-12-07 14:25:33 -05:00
Paul Chiusano
b5bfbd032b fix test suite 2022-12-07 11:58:32 -06:00
mergify[bot]
e5253e631b
Merge pull request #3671 from unisonweb/fix/decomp-beta
Fix a corner case in new 'beta-reduced' decompilation
2022-12-07 17:45:09 +00:00
Mitchell Rosen
d9ceb081ba ⅄ trunk → 22-11-10-get-term-transaction 2022-12-07 12:33:11 -05:00
Mitchell Rosen
e397f1b75b
Merge pull request #3592 from unisonweb/22-11-08-terms-mentioning-type-transaction
Refactor: make termsMentioningType in Transaction, not IO
2022-12-07 12:28:14 -05:00
Dan Doel
4a28b0d064 Fix a corner case in new 'beta-reduced' decompilation
- The check was looking for occurrences of `f x y z ...` to make sure it
  was safe to eliminate variables that had been added by enclosure.
  However, it wasn't finding occurrences of `f` by itself, because that
  is not considered an application by the predicate that was being used.

- I also made the 'fix-up' code default to not eliminating any variables
  when there are *no* subsequent occurrences of `f`. Previously this
  would allow eliminating as many variables as possible. However, this
  can produce ill-scoped definitions. Avoiding this would require
  knowing which variables are in scope when reducing an unused
  definition, but that would require a more complicated rewriting
  process than is currently used.
2022-12-07 12:06:56 -05:00
Chris Penner
acd65dd014
Include file symbols in PPE used for rendering diagnostics (LSP) (#3652)
* Use file names in PPEs when analyzing diagnostic notes

* Refactor LSP pped management
2022-12-06 15:48:41 -06:00