mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 10:35:57 +03:00
Update the transcripts with cmark
`cmark`’s pretty-printer matches our output pretty well, with a few differences: - it puts a space between the fence and the info string for in code blocks; - it prefers `-` over `*` for bulleted lists (as do I) and it indents them; - it `\`-escapes certain chars very conservatively; - it prefers indented/unfenced code blocks if there is no info string; and - it prefers `*` over `_` (unlike any sane person). This also shows how the change fixes a number of issues: - fix2158-1.output.md also illustrates how this change fixes #1809; - alias-many.output.md and input-parse-errors.output.md show how fenced code blocks without an info string would use the beginning of the content as the info string; - transcripts-round-trip/main.output.md shows how output blocks for generated `unison` stanzas (which could contain nested fenced blocks) might not have long-enough fences; and - error-messages.output.md and generic-parse-errors.output.md show how Unison errors were reported on the wrong line number (and thus the printed error lines were also incorrect).
This commit is contained in:
parent
9e2fa2bbe7
commit
1dc181b99a
@ -1,6 +1,6 @@
|
||||
# Integration test: transcript
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
use .builtin
|
||||
|
||||
unique type MyBool = MyTrue | MyFalse
|
||||
|
@ -4,7 +4,7 @@ test-html-docs/main> builtins.mergeio lib.builtins
|
||||
Done.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
{{A doc directly in the namespace.}}
|
||||
some.ns.direct = 1
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
|
||||
## Structural find and replace
|
||||
|
||||
Here's a scratch file with some rewrite rules:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex1 = List.map (x -> x + 1) [1,2,3,4,5,6,7]
|
||||
|
||||
eitherToOptional e a =
|
||||
@ -49,7 +48,7 @@ scratch/main> rewrite eitherToOptional
|
||||
The rewritten file has been added to the top of scratch.u
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
``` unison:added-by-ucm scratch.u
|
||||
-- | Rewrote using:
|
||||
-- | Modified definition(s): ex1
|
||||
|
||||
@ -79,7 +78,7 @@ type Optional2 a = Some2 a | None2
|
||||
rule2 x = @rewrite signature Optional ==> Optional2
|
||||
```
|
||||
|
||||
```unison:added-by-ucm scratch.u
|
||||
``` unison:added-by-ucm scratch.u
|
||||
-- | Rewrote using:
|
||||
-- | Modified definition(s): Either.mapRight
|
||||
|
||||
@ -137,7 +136,7 @@ scratch/main> view ex1 Either.mapRight rule1
|
||||
```
|
||||
Another example, showing that we can rewrite to definitions that only exist in the file:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
unique ability Woot1 where woot1 : () -> Nat
|
||||
unique ability Woot2 where woot2 : () -> Nat
|
||||
|
||||
@ -167,7 +166,7 @@ scratch/main> rewrite woot1to2
|
||||
The rewritten file has been added to the top of scratch.u
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
``` unison:added-by-ucm scratch.u
|
||||
-- | Rewrote using:
|
||||
-- | Modified definition(s): wootEx
|
||||
|
||||
@ -204,7 +203,7 @@ scratch/main> view wootEx
|
||||
```
|
||||
This example shows that rewrite rules can to refer to term definitions that only exist in the file:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
foo1 =
|
||||
b = "b"
|
||||
123
|
||||
@ -246,7 +245,7 @@ scratch/main> view foo1 foo2 sameFileEx
|
||||
```
|
||||
## Capture avoidance
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
bar1 =
|
||||
b = "bar"
|
||||
123
|
||||
@ -276,7 +275,7 @@ scratch/main> rewrite rule
|
||||
The rewritten file has been added to the top of scratch.u
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
``` unison:added-by-ucm scratch.u
|
||||
-- | Rewrote using:
|
||||
-- | Modified definition(s): sameFileEx
|
||||
|
||||
@ -321,7 +320,7 @@ scratch/main> load
|
||||
```
|
||||
In this example, the `a` is locally bound by the rule, so it shouldn't capture the `a = 39494` binding which is in scope at the point of the replacement:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
bar2 =
|
||||
a = 39494
|
||||
233
|
||||
@ -341,7 +340,7 @@ scratch/main> rewrite rule
|
||||
The rewritten file has been added to the top of scratch.u
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
``` unison:added-by-ucm scratch.u
|
||||
-- | Rewrote using:
|
||||
-- | Modified definition(s): bar2
|
||||
|
||||
@ -378,11 +377,11 @@ scratch/main> load
|
||||
```
|
||||
## Structural find
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
eitherEx = Left ("hello", "there")
|
||||
```
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
findEitherEx x = @rewrite term Left ("hello", x) ==> Left ("hello" Text.++ x)
|
||||
findEitherFailure = @rewrite signature a . Either Failure a ==> ()
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
This transcript verifies that the pretty-printer produces code that can be successfully parsed, for a variety of examples. Terms or types that fail to round-trip can be added to either `reparses-with-same-hash.u` or `reparses.u` as regression tests.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = ()
|
||||
```
|
||||
|
||||
@ -30,7 +30,7 @@ So we can see the pretty-printed output:
|
||||
definitions currently in this namespace.
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
````` unison:added-by-ucm scratch.u
|
||||
structural ability Abort where abort : {Abort} a
|
||||
|
||||
structural ability Ask a where ask : {Ask a} a
|
||||
@ -766,7 +766,7 @@ UUID.randomUUIDBytes = do
|
||||
|
||||
(|>) : a -> (a ->{e} b) ->{e} b
|
||||
a |> f = f a
|
||||
```
|
||||
`````
|
||||
|
||||
This diff should be empty if the two namespaces are equivalent. If it's nonempty, the diff will show us the hashes that differ.
|
||||
|
||||
@ -780,7 +780,7 @@ Now check that definitions in 'reparses.u' at least parse on round trip:
|
||||
|
||||
This just makes 'roundtrip.u' the latest scratch file.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = ()
|
||||
```
|
||||
|
||||
@ -795,7 +795,7 @@ x = ()
|
||||
definitions currently in this namespace.
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
```` unison:added-by-ucm scratch.u
|
||||
explanationOfThisFile : Text
|
||||
explanationOfThisFile =
|
||||
"""
|
||||
@ -815,7 +815,7 @@ sloppyDocEval =
|
||||
1 + 1
|
||||
```
|
||||
}}
|
||||
```
|
||||
````
|
||||
|
||||
These are currently all expected to have different hashes on round trip.
|
||||
|
||||
|
@ -11,7 +11,7 @@ transcripts which contain less boilerplate.
|
||||
|
||||
The test shows that `hex (fromHex str) == str` as expected.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
test> hex.tests.ex1 = checks let
|
||||
s = "3984af9b"
|
||||
[hex (fromHex s) == s]
|
||||
@ -20,7 +20,7 @@ test> hex.tests.ex1 = checks let
|
||||
Lets do some basic testing of our test harness to make sure its
|
||||
working.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
testAutoClean : '{io2.IO}[Result]
|
||||
testAutoClean _ =
|
||||
go: '{Stream Result, Exception, io2.IO, TempDirs} Text
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
unique type EncDec = EncDec Text (Nat -> Bytes) (Bytes -> Optional (Nat, Bytes))
|
||||
|
||||
BE64 = EncDec "64 bit Big Endian" encodeNat64be decodeNat64be
|
||||
|
@ -1,10 +1,9 @@
|
||||
|
||||
Test for code serialization operations.
|
||||
|
||||
Define a function, serialize it, then deserialize it back to an actual
|
||||
function. Also ask for its dependencies for display later.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
save : a -> Bytes
|
||||
save x = Value.serialize (Value.value x)
|
||||
|
||||
@ -241,7 +240,7 @@ scratch/main> add
|
||||
->{Throw Text} ()
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
structural ability Zap where
|
||||
zap : Three Nat Nat Nat
|
||||
|
||||
@ -393,7 +392,7 @@ scratch/main> io.test badLoad
|
||||
Tip: Use view 1 to view the source of a test.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
codeTests : '{io2.IO} [Result]
|
||||
codeTests =
|
||||
'[ idempotence "idem f" (termLink f)
|
||||
@ -489,7 +488,7 @@ scratch/main> io.test codeTests
|
||||
Tip: Use view 1 to view the source of a test.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
validateTest : Link.Term ->{IO} Result
|
||||
validateTest l = match Code.lookup l with
|
||||
None -> Fail "Couldn't look up link"
|
||||
|
@ -2,18 +2,18 @@
|
||||
|
||||
Unison documentation is written in Unison and has some neat features:
|
||||
|
||||
* The documentation type provides a rich vocabulary of elements that go beyond markdown, including asides, callouts, tooltips, and more.
|
||||
* Docs may contain Unison code which is parsed and typechecked to ensure validity. No more out of date examples that don't compile or assume a bunch of implicit context!
|
||||
* Embeded examples are live and can show the results of evaluation. This uses the same evaluation cache as Unison's scratch files, allowing Unison docs to function like well-commented spreadsheets or notebooks.
|
||||
* Links to other definitions are typechecked to ensure they point to valid definitions. The links are resolved to hashes and won't be broken by name changes or moving definitions around.
|
||||
* Docs can be included in other docs and you can assemble documentation programmatically, using Unison code.
|
||||
* There's a powerful textual syntax for all of the above, which we'll introduce next.
|
||||
- The documentation type provides a rich vocabulary of elements that go beyond markdown, including asides, callouts, tooltips, and more.
|
||||
- Docs may contain Unison code which is parsed and typechecked to ensure validity. No more out of date examples that don't compile or assume a bunch of implicit context\!
|
||||
- Embeded examples are live and can show the results of evaluation. This uses the same evaluation cache as Unison's scratch files, allowing Unison docs to function like well-commented spreadsheets or notebooks.
|
||||
- Links to other definitions are typechecked to ensure they point to valid definitions. The links are resolved to hashes and won't be broken by name changes or moving definitions around.
|
||||
- Docs can be included in other docs and you can assemble documentation programmatically, using Unison code.
|
||||
- There's a powerful textual syntax for all of the above, which we'll introduce next.
|
||||
|
||||
## Introduction
|
||||
|
||||
Documentation blocks start with `{{` and end with a matching `}}`. You can introduce doc blocks anywhere you'd use an expression, and you can also have anonymous documentation blocks immediately before a top-level term or type.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
name = {{Alice}}
|
||||
d1 = {{ Hello there {{name}}! }}
|
||||
|
||||
@ -769,3 +769,4 @@ scratch/main> display doc.guide
|
||||
|
||||
```
|
||||
🌻 THE END
|
||||
|
||||
|
@ -6,7 +6,7 @@ Exception ability directly, and the last is code validation. I don't
|
||||
have an easy way to test the last at the moment, but the other two are
|
||||
tested here.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
test1 : '{IO, Exception} [Result]
|
||||
test1 = do
|
||||
_ = fromUtf8 0xsee
|
||||
|
@ -1,6 +1,6 @@
|
||||
This transcript tests an ability check failure regression.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural ability Async t g where
|
||||
fork : '{Async t g, g} a -> t a
|
||||
await : t a -> a
|
||||
@ -36,6 +36,7 @@ some subtyping.
|
||||
|
||||
However, the ability handling was just processing rows in whatever
|
||||
order they occurred, and during inference it happened that `g`
|
||||
occurred in the row before `Async t g. Processing the stricter parts
|
||||
occurred in the row before `Async t g`. Processing the stricter parts
|
||||
first is better, becauase it can solve things more precisely and avoid
|
||||
ambiguities relating to subtyping.
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
This tests a case where a function was somehow discarding abilities.
|
||||
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural ability Trivial where
|
||||
trivial : ()
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
Tests a former error due to bad calling conventions on delay.impl
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
timingApp2 : '{IO, Exception} ()
|
||||
timingApp2 _ =
|
||||
printLine "Hello"
|
||||
|
@ -1,7 +1,7 @@
|
||||
This file tests some obscure issues involved with abilities and over-applied
|
||||
functions.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
Stream.fromList : [a] -> '{Stream a} ()
|
||||
Stream.fromList l _ =
|
||||
_ = List.map (x -> emit x) l
|
||||
@ -62,7 +62,7 @@ increment n = 1 + n
|
||||
[100, 200, 300, 400]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
structural ability E where
|
||||
eff : () -> ()
|
||||
|
||||
@ -105,7 +105,7 @@ foo _ =
|
||||
7
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
structural ability Over where
|
||||
over : Nat ->{Over} (Nat -> Nat)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
arrayList v n = do
|
||||
use ImmutableByteArray read8
|
||||
ma = Scope.bytearrayOf v n
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
{{
|
||||
A simple doc.
|
||||
}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
Test case for a variable capture problem during let floating. The
|
||||
encloser wasn't accounting for variables bound by matches.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ability Issue t where
|
||||
one : '{Issue t} () -> {Issue t} ()
|
||||
two : '{Issue t} () -> {Issue t} ()
|
||||
|
@ -1,7 +1,7 @@
|
||||
Checks for some bad type checking behavior. Some ability subtyping was
|
||||
too lenient when higher-order functions were involved.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
foreach : (a ->{g} ()) -> [a] ->{g} ()
|
||||
foreach f = cases
|
||||
[] -> ()
|
||||
@ -38,9 +38,9 @@ go = do
|
||||
|
||||
|
||||
```
|
||||
This comes from issue #3513
|
||||
This comes from issue \#3513
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
(<<) : (b ->{e} c) -> (a ->{e} b) -> a ->{e} c
|
||||
(<<) f g x = f (g x)
|
||||
|
||||
|
@ -45,7 +45,7 @@ Notice the `fromBase16` and `toBase16` functions. Here's some convenience functi
|
||||
|
||||
Here's a few usage examples:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex1 = fromHex "2947db"
|
||||
|> crypto.hashBytes Sha3_512
|
||||
|> hex
|
||||
@ -155,7 +155,7 @@ scratch/main> find-in builtin.crypto
|
||||
```
|
||||
Note that the universal versions of `hash` and `hmac` are currently unimplemented and will bomb at runtime:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
> hash Sha3_256 (fromHex "3849238492")
|
||||
```
|
||||
|
||||
@ -177,9 +177,9 @@ Note that the universal versions of `hash` and `hmac` are currently unimplemente
|
||||
```
|
||||
## Hashing tests
|
||||
|
||||
Here are some test vectors (taken from [here](https://www.di-mgt.com.au/sha_testvectors.html) and [here](https://en.wikipedia.org/wiki/BLAKE_(hash_function))) for the various hashing algorithms:
|
||||
Here are some test vectors (taken from [here](https://www.di-mgt.com.au/sha_testvectors.html) and [here](https://en.wikipedia.org/wiki/BLAKE_\(hash_function\))) for the various hashing algorithms:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex alg input expected = checks [hashBytes alg (ascii input) == fromHex expected]
|
||||
|
||||
test> sha3_512.tests.ex1 =
|
||||
@ -351,7 +351,7 @@ scratch/main> test
|
||||
|
||||
These test vectors are taken from [RFC 4231](https://tools.ietf.org/html/rfc4231#section-4.3).
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex' alg secret msg expected = checks [hmacBytes alg (fromHex secret) (ascii msg) == fromHex expected]
|
||||
|
||||
test> hmac_sha2_256.tests.ex1 =
|
||||
@ -422,7 +422,7 @@ test> hmac_sha2_512.tests.ex2 =
|
||||
|
||||
Test vectors here pulled from [Wikipedia's writeup](https://en.wikipedia.org/wiki/MD5).
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex alg input expected = checks [hashBytes alg (ascii input) == fromHex expected]
|
||||
|
||||
test> md5.tests.ex1 =
|
||||
|
@ -9,8 +9,7 @@ MVars are the building block on which many other concurrency
|
||||
primitives can be built, such as Futures, Run at most once initializer
|
||||
blocks, Queues, etc.
|
||||
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
eitherCk : (a -> Boolean) -> Either e a -> Boolean
|
||||
eitherCk f = cases
|
||||
Left _ -> false
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
testNat: Nat -> Optional Int -> Optional Float -> {Stream Result}()
|
||||
testNat n expectInt expectFloat =
|
||||
float = Float.fromRepresentation n
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
serverSocket = compose2 reraise IO.serverSocket.impl
|
||||
socketPort = compose reraise socketPort.impl
|
||||
listen = compose reraise listen.impl
|
||||
@ -16,14 +16,13 @@ socketAccept = compose reraise socketAccept.impl
|
||||
This section tests functions in the IO builtin related to binding to
|
||||
TCP server socket, as to be able to accept incoming TCP connections.
|
||||
|
||||
```builtin
|
||||
.io2.IO.serverSocket : Optional Text -> Text ->{io2.IO} Either Failure io2.Socket
|
||||
|
||||
```
|
||||
builtin.io2.IO.serverSocket : Optional Text -> Text ->{io2.IO} Either Failure io2.Socket
|
||||
```
|
||||
|
||||
This function takes two parameters, The first is the Hostname. If None
|
||||
is provided, We will attempt to bind to 0.0.0.0 (All ipv4
|
||||
addresses). We currently only support IPV4 (we should fix this!)
|
||||
addresses). We currently only support IPV4 (we should fix this\!)
|
||||
The second is the name of the port to bind to. This can be
|
||||
a decimal representation of a port number between 1-65535. This can be
|
||||
a named port like "ssh" (for port 22) or "kermit" (for port 1649),
|
||||
@ -54,7 +53,7 @@ stored in `/etc/services` and queried with the `getent` tool:
|
||||
|
||||
Below shows different examples of how we might specify the server coordinates.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
testExplicitHost : '{io2.IO} [Result]
|
||||
testExplicitHost _ =
|
||||
test = 'let
|
||||
@ -130,7 +129,7 @@ scratch/main> io.test testDefaultPort
|
||||
```
|
||||
This example demonstrates connecting a TCP client socket to a TCP server socket. A thread is started for both client and server. The server socket asks for any availalbe port (by passing "0" as the port number). The server thread then queries for the actual assigned port number, and puts that into an MVar which the client thread can read. The client thread then reads a string from the server and reports it back to the main thread via a different MVar.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
serverThread: MVar Nat -> Text -> '{io2.IO}()
|
||||
serverThread portVar toSend = 'let
|
||||
go : '{io2.IO, Exception}()
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
directory = "unison-src/transcripts-using-base/serialized-cases/"
|
||||
|
||||
availableCases : '{IO,Exception} [Text]
|
||||
|
@ -3,7 +3,7 @@
|
||||
Ref support a CAS operation that can be used as a building block to
|
||||
change state atomically without locks.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
casTest: '{io2.IO} [Result]
|
||||
casTest = do
|
||||
test = do
|
||||
@ -52,7 +52,7 @@ scratch/main> io.test casTest
|
||||
```
|
||||
Promise is a simple one-shot awaitable condition.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
promiseSequentialTest : '{IO} [Result]
|
||||
promiseSequentialTest = do
|
||||
test = do
|
||||
@ -126,7 +126,7 @@ scratch/main> io.test promiseConcurrentTest
|
||||
```
|
||||
CAS can be used to write an atomic update function.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} ()
|
||||
atomicUpdate ref f =
|
||||
ticket = Ref.readForCas ref
|
||||
@ -158,7 +158,7 @@ scratch/main> add
|
||||
Promise can be used to write an operation that spawns N concurrent
|
||||
tasks and collects their results
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
spawnN : Nat -> '{IO} a ->{IO} [a]
|
||||
spawnN n fa =
|
||||
use Nat eq drop
|
||||
@ -198,7 +198,7 @@ We can use these primitives to write a more interesting example, where
|
||||
multiple threads repeatedly update an atomic counter, we check that
|
||||
the value of the counter is correct after all threads are done.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
fullTest : '{IO} [Result]
|
||||
fullTest = do
|
||||
use Nat * + eq drop
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
structural type Tree a = Leaf | Node (Tree a) a (Tree a)
|
||||
|
||||
foldMap : r -> (r -> r -> r) -> (a -> r) -> Tree a -> r
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
l1 = [1.0,2.0,3.0]
|
||||
l2 = [+1,+2,+3]
|
||||
l3 = [?a, ?b, ?c]
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
structural ability Exit a where
|
||||
exit : a -> b
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
structural ability DC r where
|
||||
shift : ((a -> r) -> r) -> a
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
mutual0 = cases
|
||||
0 -> "okay"
|
||||
n ->
|
||||
|
@ -1,6 +1,7 @@
|
||||
Loops that access a shared counter variable, accessed in transactions.
|
||||
Some thread delaying is just accomplished by counting in a loop.
|
||||
```unison
|
||||
|
||||
``` unison
|
||||
count : Nat -> ()
|
||||
count = cases
|
||||
0 -> ()
|
||||
@ -56,7 +57,7 @@ scratch/main> add
|
||||
```
|
||||
Test case.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
spawn : Nat ->{io2.IO} Result
|
||||
spawn k = let
|
||||
out1 = TVar.newIO None
|
||||
|
@ -4,13 +4,13 @@ https://github.com/unisonweb/unison/issues/2195
|
||||
|
||||
We add a simple definition.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 999
|
||||
```
|
||||
|
||||
Now, we update that definition and define a test-watch which depends on it.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 1000
|
||||
test> mytest = checks [x + 1 == 1001]
|
||||
```
|
||||
@ -54,9 +54,9 @@ scratch/main> add
|
||||
Tip: Use `help filestatus` to learn more.
|
||||
|
||||
```
|
||||
---
|
||||
-----
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
y = 42
|
||||
test> useY = checks [y + 1 == 43]
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
Lets just make sure we can start a thread
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
otherThread : '{io2.IO}()
|
||||
otherThread = 'let
|
||||
watch "I'm the other Thread" ()
|
||||
@ -32,7 +32,7 @@ testBasicFork = 'let
|
||||
```
|
||||
See if we can get another thread to stuff a value into a MVar
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
thread1 : Nat -> MVar Nat -> '{io2.IO}()
|
||||
thread1 x mv = 'let
|
||||
go = 'let
|
||||
@ -89,7 +89,7 @@ scratch/main> io.test testBasicMultiThreadMVar
|
||||
Tip: Use view 1 to view the source of a test.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
sendingThread: Nat -> MVar Nat -> '{io2.IO}()
|
||||
sendingThread toSend mv = 'let
|
||||
go = 'let
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Tests for TLS builtins
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
-- generated with:
|
||||
-- openssl req -newkey rsa:2048 -subj '/CN=test.unison.cloud/O=Unison/C=US' -nodes -keyout key.pem -x509 -days 3650 -out cert.pem
|
||||
|
||||
@ -15,7 +15,7 @@ not_a_cert = "-----BEGIN SCHERMIFICATE-----\n-----END SCHERMIFICATE-----"
|
||||
|
||||
First lets make sure we can load our cert and private key
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
this_should_work=match (decodeCert.impl (toUtf8 self_signed_cert_pem2) with
|
||||
Left (Failure _ t _) -> [Fail t]
|
||||
Right _ -> [Ok "succesfully decoded self_signed_pem"]
|
||||
@ -71,7 +71,7 @@ We'll create a server and a client, and start threads for each.
|
||||
The server will report the port it is bound to via a passed MVar which
|
||||
the client can read.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
serverThread: MVar Nat -> Text -> '{io2.IO}()
|
||||
serverThread portVar toSend = 'let
|
||||
go: '{io2.IO, Exception}()
|
||||
|
@ -1,4 +1,4 @@
|
||||
Test for new Text -> Bytes conversions explicitly using UTF-8 as the encoding
|
||||
Test for new Text -\> Bytes conversions explicitly using UTF-8 as the encoding
|
||||
|
||||
Unison has function for converting between `Text` and a UTF-8 `Bytes` encoding of the Text.
|
||||
|
||||
@ -13,7 +13,7 @@ scratch/main> find Utf8
|
||||
```
|
||||
ascii characters are encoded as single bytes (in the range 0-127).
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ascii: Text
|
||||
ascii = "ABCDE"
|
||||
|
||||
@ -44,7 +44,7 @@ ascii = "ABCDE"
|
||||
```
|
||||
non-ascii characters are encoded as multiple bytes.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
greek: Text
|
||||
greek = "ΑΒΓΔΕ"
|
||||
|
||||
@ -73,7 +73,7 @@ greek = "ΑΒΓΔΕ"
|
||||
```
|
||||
We can check that encoding and then decoding should give us back the same `Text` we started with
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
checkRoundTrip: Text -> [Result]
|
||||
checkRoundTrip t =
|
||||
bytes = toUtf8 t
|
||||
@ -110,7 +110,7 @@ test> greekTest = checkRoundTrip greek
|
||||
```
|
||||
If we try to decode an invalid set of bytes, we get back `Text` explaining the decoding error:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
greek_bytes = Bytes.fromList [206, 145, 206, 146, 206, 147, 206, 148, 206]
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
Some random ability stuff to ensure things work.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
unique ability A where
|
||||
one : Nat ->{A} Nat
|
||||
two : Nat -> Nat ->{A} Nat
|
||||
|
@ -1,6 +1,6 @@
|
||||
The order of a set of abilities is normalized before hashing.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
unique ability Foo where
|
||||
foo : ()
|
||||
|
||||
|
@ -5,7 +5,7 @@ https://github.com/unisonweb/unison/issues/2786
|
||||
First we add an ability to the codebase.
|
||||
Note that this will create the name `Channels.send` as an ability constructor.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
unique ability Channels where
|
||||
send : a -> {Channels} ()
|
||||
```
|
||||
@ -31,11 +31,11 @@ scratch/main> add
|
||||
ability Channels
|
||||
|
||||
```
|
||||
Now we update the ability, changing the name of the constructor, _but_, we simultaneously
|
||||
Now we update the ability, changing the name of the constructor, *but*, we simultaneously
|
||||
add a new top-level term with the same name as the constructor which is being
|
||||
removed from Channels.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
unique ability Channels where
|
||||
sends : [a] -> {Channels} ()
|
||||
|
||||
@ -89,9 +89,9 @@ scratch/main> update.old patch thing
|
||||
ability Channels
|
||||
|
||||
```
|
||||
If however, `Channels.send` and `thing` _depend_ on `Channels`, updating them should succeed since it pulls in the ability as a dependency.
|
||||
If however, `Channels.send` and `thing` *depend* on `Channels`, updating them should succeed since it pulls in the ability as a dependency.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
unique ability Channels where
|
||||
sends : [a] -> {Channels} ()
|
||||
|
||||
@ -165,7 +165,7 @@ scratch/main> update.old
|
||||
```
|
||||
# Constructor-term conflict
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
X.x = 1
|
||||
```
|
||||
|
||||
@ -190,7 +190,7 @@ scratch/main2> add
|
||||
X.x : Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
structural ability X where
|
||||
x : ()
|
||||
```
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Basic usage
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
even : Nat -> Boolean
|
||||
even x = if x == 0 then true else odd (drop x 1)
|
||||
|
||||
@ -47,6 +47,7 @@ scratch/main> run is2even
|
||||
```
|
||||
it errors if the desired result name conflicts with a name in the
|
||||
unison file
|
||||
|
||||
```ucm
|
||||
scratch/main> add.run is2even
|
||||
|
||||
@ -57,6 +58,7 @@ scratch/main> add.run is2even
|
||||
|
||||
```
|
||||
otherwise, the result is successfully persisted
|
||||
|
||||
```ucm
|
||||
scratch/main> add.run foo.bar.baz
|
||||
|
||||
@ -74,7 +76,7 @@ scratch/main> view foo.bar.baz
|
||||
```
|
||||
## It resolves references within the unison file
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
z b = b Nat.+ 12
|
||||
y a b = a Nat.+ b Nat.+ z 10
|
||||
|
||||
@ -115,7 +117,7 @@ scratch/main> add.run result
|
||||
```
|
||||
## It resolves references within the codebase
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
inc : Nat -> Nat
|
||||
inc x = x + 1
|
||||
```
|
||||
@ -141,7 +143,7 @@ scratch/main> add inc
|
||||
inc : Nat -> Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
main : '(Nat -> Nat)
|
||||
main _ x = inc x
|
||||
```
|
||||
@ -178,7 +180,7 @@ scratch/main> view natfoo
|
||||
```
|
||||
## It captures scratch file dependencies at run time
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 1
|
||||
y = x + x
|
||||
main = 'y
|
||||
@ -205,7 +207,7 @@ scratch/main> run main
|
||||
2
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
x = 50
|
||||
```
|
||||
|
||||
@ -223,6 +225,7 @@ x = 50
|
||||
|
||||
```
|
||||
this saves 2 to xres, rather than 100
|
||||
|
||||
```ucm
|
||||
scratch/main> add.run xres
|
||||
|
||||
@ -238,7 +241,7 @@ scratch/main> view xres
|
||||
```
|
||||
## It fails with a message if add cannot complete cleanly
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
main = '5
|
||||
```
|
||||
|
||||
@ -272,7 +275,7 @@ scratch/main> add.run xres
|
||||
```
|
||||
## It works with absolute names
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
main = '5
|
||||
```
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
```unison
|
||||
``` unison
|
||||
test> foo : [Test.Result]
|
||||
foo = []
|
||||
```
|
||||
|
||||
Apparently when we add a test watch, we add a type annotation to it, even if it already has one. We don't want this to happen though!
|
||||
Apparently when we add a test watch, we add a type annotation to it, even if it already has one. We don't want this to happen though\!
|
||||
|
||||
```ucm
|
||||
scratch/main> add
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Let's set up some definitions to start:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 1
|
||||
y = 2
|
||||
|
||||
@ -41,7 +41,7 @@ scratch/main> add
|
||||
```
|
||||
Let's add an alias for `1` and `One`:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
z = 1
|
||||
|
||||
structural type Z = One Nat
|
||||
@ -79,7 +79,7 @@ scratch/main> add
|
||||
```
|
||||
Let's update something that has an alias (to a value that doesn't have a name already):
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 3
|
||||
structural type X = Three Nat Nat Nat
|
||||
```
|
||||
@ -118,7 +118,7 @@ scratch/main> update
|
||||
```
|
||||
Update it to something that already exists with a different name:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 2
|
||||
structural type X = Two Nat Nat
|
||||
```
|
||||
|
@ -1,17 +1,14 @@
|
||||
The `alias.many` command can be used to copy definitions from the current namespace into your curated one.
|
||||
The names that will be used in the target namespace are the names you specify, relative to the current namespace:
|
||||
|
||||
```scratch
|
||||
/main> help alias.many
|
||||
scratch/main> help alias.many
|
||||
|
||||
alias.many (or copy)
|
||||
`alias.many <relative1> [relative2...] <namespace>` creates aliases `relative1`, `relative2`, ...
|
||||
in the namespace `namespace`.
|
||||
`alias.many foo.foo bar.bar .quux` creates aliases `.quux.foo.foo` and `.quux.bar.bar`.
|
||||
alias.many (or copy)
|
||||
`alias.many <relative1> [relative2...] <namespace>` creates aliases `relative1`, `relative2`, ...
|
||||
in the namespace `namespace`.
|
||||
`alias.many foo.foo bar.bar .quux` creates aliases `.quux.foo.foo` and `.quux.bar.bar`.
|
||||
|
||||
```
|
||||
|
||||
Let's try it!
|
||||
Let's try it\!
|
||||
|
||||
```ucm
|
||||
scratch/main> alias.many List.adjacentPairs List.all List.any List.chunk List.chunksOf List.dropWhile List.first List.init List.intersperse List.isEmpty List.last List.replicate List.splitAt List.tail List.takeWhile mylib
|
||||
@ -62,4 +59,5 @@ scratch/main> find-in mylib
|
||||
|
||||
|
||||
```
|
||||
Thanks, `alias.many!
|
||||
Thanks, `alias.many`\!
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
|
||||
This tests a variable related bug in the ANF compiler.
|
||||
|
||||
The nested let would get flattened out, resulting in:
|
||||
|
||||
bar = result
|
||||
|
||||
which would be handled by renaming. However, the _context_ portion of
|
||||
which would be handled by renaming. However, the *context* portion of
|
||||
the rest of the code was not being renamed correctly, so `bar` would
|
||||
remain in the definition of `baz`.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
foo _ =
|
||||
id x = x
|
||||
void x = ()
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Any.unsafeExtract is a way to extract the value contained in an Any. This is unsafe because it allows the programmer to coerce a value into any type, which would cause undefined behaviour if used to coerce a value to the wrong type.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
test> Any.unsafeExtract.works =
|
||||
use Nat !=
|
||||
checks [1 == Any.unsafeExtract (Any 1),
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Doc rendering
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type Maybe a = Nothing | Just a
|
||||
otherTerm = "text"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# find api
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
rachel.filesystem.x = 42
|
||||
ross.httpClient.y = 43
|
||||
joey.httpServer.z = 44
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Get Definitions Test
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
nested.names.x.doc = {{ Documentation }}
|
||||
nested.names.x = 42
|
||||
```
|
||||
@ -205,7 +205,7 @@ GET /api/projects/scratch/branches/main/getDefinition?names=%23qkhkl0n238&relati
|
||||
},
|
||||
"typeDefinitions": {}
|
||||
}
|
||||
``````unison
|
||||
`````` unison
|
||||
doctest.thing.doc = {{ The correct docs for the thing }}
|
||||
doctest.thing = "A thing"
|
||||
doctest.thingalias.doc = {{ Docs for the alias, should not be displayed }}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Namespace Details Test
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
{{ Documentation }}
|
||||
nested.names.x = 42
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Namespace list api
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
{{ Documentation }}
|
||||
nested.names.x = 42
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Definition Summary APIs
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
nat : Nat
|
||||
nat = 42
|
||||
doc : Doc2
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Should block an `add` if it requires an update on an in-file dependency.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 1
|
||||
```
|
||||
|
||||
@ -29,7 +29,7 @@ scratch/main> add
|
||||
```
|
||||
Update `x`, and add a new `y` which depends on the update
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 10
|
||||
y = x + 1
|
||||
```
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
For example:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex thing =
|
||||
thing y = y
|
||||
-- refers to `thing` in this block
|
||||
@ -39,7 +39,7 @@ ex thing =
|
||||
|
||||
The `thing` reference in `bar` refers to the one declared locally in the block that `bar` is part of. This is true even if the declaration which shadows the outer name appears later in the block, for instance:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex thing =
|
||||
bar x = thing x + 1
|
||||
thing y = y
|
||||
@ -72,7 +72,7 @@ ex thing =
|
||||
|
||||
This is just the normal lexical scoping behavior. For example:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex thing =
|
||||
bar x = thing x + 1 -- references outer `thing`
|
||||
baz z =
|
||||
@ -103,9 +103,9 @@ ex thing =
|
||||
4201
|
||||
|
||||
```
|
||||
Here's another example, showing that bindings cannot reference bindings declared in blocks nested in the _body_ (the final expression) of a block:
|
||||
Here's another example, showing that bindings cannot reference bindings declared in blocks nested in the *body* (the final expression) of a block:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex thing =
|
||||
bar x = thing x + 1 -- refers to outer thing
|
||||
let
|
||||
@ -137,9 +137,9 @@ ex thing =
|
||||
```
|
||||
### Blocks can define one or more functions which are recursive or mutually recursive
|
||||
|
||||
We call these groups of definitions that reference each other in a block _cycles_. For instance:
|
||||
We call these groups of definitions that reference each other in a block *cycles*. For instance:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
sumTo n =
|
||||
-- A recursive function, defined inside a block
|
||||
go acc n =
|
||||
@ -174,7 +174,7 @@ The `go` function is a one-element cycle (it reference itself), and `ping` and `
|
||||
|
||||
For instance, this works:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex n =
|
||||
ping x = pong + 1 + x
|
||||
pong = 42
|
||||
@ -198,7 +198,7 @@ Since the forward reference to `pong` appears inside `ping`.
|
||||
|
||||
This, however, will not compile:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex n =
|
||||
pong = ping + 1
|
||||
ping = 42
|
||||
@ -217,7 +217,7 @@ ex n =
|
||||
```
|
||||
This also won't compile; it's a cyclic reference that isn't guarded:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex n =
|
||||
loop = loop
|
||||
loop
|
||||
@ -234,7 +234,7 @@ ex n =
|
||||
```
|
||||
This, however, will compile. This also shows that `'expr` is another way of guarding a definition.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex n =
|
||||
loop = '(!loop)
|
||||
!loop
|
||||
@ -253,13 +253,13 @@ ex n =
|
||||
ex : n -> r
|
||||
|
||||
```
|
||||
Just don't try to run it as it's an infinite loop!
|
||||
Just don't try to run it as it's an infinite loop\!
|
||||
|
||||
### Cyclic definitions in a block don't have access to any abilities
|
||||
|
||||
The reason is it's unclear what the order should be of any requests that are made. It can also be viewed of a special case of the restriction that elements of a cycle must all be guarded. Here's an example:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural ability SpaceAttack where
|
||||
launchMissiles : Text -> Nat
|
||||
|
||||
@ -279,11 +279,11 @@ ex n =
|
||||
|
||||
|
||||
```
|
||||
### The _body_ of recursive functions can certainly access abilities
|
||||
### The *body* of recursive functions can certainly access abilities
|
||||
|
||||
For instance, this works fine:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural ability SpaceAttack where
|
||||
launchMissiles : Text -> Nat
|
||||
|
||||
@ -311,7 +311,7 @@ ex n =
|
||||
|
||||
For instance, `zap` here isn't considered part of the cycle (it doesn't reference `ping` or `pong`), so this typechecks fine:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural ability SpaceAttack where
|
||||
launchMissiles : Text -> Nat
|
||||
|
||||
@ -338,7 +338,7 @@ ex n =
|
||||
```
|
||||
This is actually parsed as if you moved `zap` after the cycle it find itself a part of:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural ability SpaceAttack where
|
||||
launchMissiles : Text -> Nat
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Regression test for https://github.com/unisonweb/unison/pull/2819
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
hangExample : Boolean
|
||||
hangExample =
|
||||
("a long piece of text to hang the line" == "")
|
||||
|
@ -2,7 +2,7 @@ The `branch` command creates a new branch.
|
||||
|
||||
First, we'll create a term to include in the branches.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
someterm = 18
|
||||
```
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
foo = 5
|
||||
foo.bar = 1
|
||||
```
|
||||
@ -26,7 +26,7 @@ p0/main> add
|
||||
foo.bar : ##Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
bonk = 5
|
||||
donk.bonk = 1
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
bonk : forall a. a -> a
|
||||
bonk x =
|
||||
zonk : forall a. a -> a
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
We can display the guide before and after adding it to the codebase:
|
||||
|
||||
```ucm
|
||||
@ -414,7 +413,7 @@ We can display the guide before and after adding it to the codebase:
|
||||
```
|
||||
But we can't display this due to a decompilation problem.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
rendered = Pretty.get (docFormatConsole doc.guide)
|
||||
```
|
||||
|
||||
@ -845,7 +844,7 @@ rendered = Pretty.get (docFormatConsole doc.guide)
|
||||
```
|
||||
And then this sometimes generates a GHC crash "strange closure error" but doesn't seem deterministic.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
rendered = Pretty.get (docFormatConsole doc.guide)
|
||||
|
||||
> rendered
|
||||
|
@ -4,7 +4,7 @@ This transcript defines unit tests for builtin functions. There's a single `scra
|
||||
|
||||
## `Int` functions
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
use Int
|
||||
|
||||
-- used for some take/drop tests later
|
||||
@ -83,7 +83,7 @@ test> Int.tests.conversions =
|
||||
|
||||
## `Nat` functions
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
use Nat
|
||||
|
||||
test> Nat.tests.arithmetic =
|
||||
@ -153,7 +153,8 @@ test> Nat.tests.conversions =
|
||||
```
|
||||
|
||||
## `Boolean` functions
|
||||
```unison
|
||||
|
||||
``` unison
|
||||
test> Boolean.tests.orTable =
|
||||
checks [
|
||||
true || true == true,
|
||||
@ -177,7 +178,7 @@ test> Boolean.tests.notTable =
|
||||
|
||||
## `Text` functions
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
test> Text.tests.takeDropAppend =
|
||||
checks [
|
||||
"yabba" ++ "dabba" == "yabbadabba",
|
||||
@ -271,7 +272,7 @@ test> Text.tests.indexOfEmoji =
|
||||
|
||||
## `Bytes` functions
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
test> Bytes.tests.at =
|
||||
bs = Bytes.fromList [77, 13, 12]
|
||||
checks [
|
||||
@ -331,7 +332,7 @@ test> Bytes.tests.indexOf =
|
||||
|
||||
## `List` comparison
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
test> checks [
|
||||
compare [] [1,2,3] == -1,
|
||||
compare [1,2,3] [1,2,3,4] == -1,
|
||||
@ -345,7 +346,8 @@ test> checks [
|
||||
```
|
||||
|
||||
Other list functions
|
||||
```unison
|
||||
|
||||
``` unison
|
||||
test> checks [
|
||||
List.take bigN [1,2,3] == [1,2,3],
|
||||
List.drop bigN [1,2,3] == []
|
||||
@ -354,7 +356,7 @@ test> checks [
|
||||
|
||||
## `Any` functions
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
> [Any "hi", Any (41 + 1)]
|
||||
|
||||
test> Any.test1 = checks [(Any "hi" == Any "hi")]
|
||||
@ -392,7 +394,7 @@ test> Any.test2 = checks [(not (Any "hi" == Any 42))]
|
||||
```
|
||||
## Sandboxing functions
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
openFile1 t = openFile t
|
||||
openFile2 t = openFile1 t
|
||||
|
||||
@ -453,7 +455,7 @@ openFile]
|
||||
✅ Passed Passed
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
openFilesIO = do
|
||||
checks
|
||||
[ not (validateSandboxedSimpl [] (value openFile))
|
||||
@ -501,7 +503,7 @@ scratch/main> io.test openFilesIO
|
||||
|
||||
Just exercises the function
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
> Universal.murmurHash 1
|
||||
test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]]
|
||||
```
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
This should render as `Bytes.fromList [1,2,3,4]`, not `##Bytes.fromSequence [1,2,3,4]`:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
> Bytes.fromList [1,2,3,4]
|
||||
```
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Regression test for https://github.com/unisonweb/unison/issues/763
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
(+-+) : Nat -> Nat -> Nat
|
||||
(+-+) x y = x * y
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
See [this ticket](https://github.com/unisonweb/unison/issues/873); the point being, this shouldn't crash the runtime. :)
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
(-) = builtin.Nat.sub
|
||||
```
|
||||
|
||||
@ -25,7 +25,7 @@ scratch/main> add
|
||||
- : Nat -> Nat -> Int
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
baz x = x - 1
|
||||
```
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
structural type Zoink a b c = Zoink a b c
|
||||
|
||||
> Any ()
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
f : (() -> a) -> Nat
|
||||
f x = 42
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
Update a member of a cycle, but retain the cycle.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ping : 'Nat
|
||||
ping _ = !pong + 1
|
||||
|
||||
@ -31,7 +31,7 @@ scratch/main> add
|
||||
pong : 'Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
ping : 'Nat
|
||||
ping _ = !pong + 3
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
Update a member of a cycle with a type-preserving update, but sever the cycle.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ping : 'Nat
|
||||
ping _ = !pong + 1
|
||||
|
||||
@ -31,7 +31,7 @@ scratch/main> add
|
||||
pong : 'Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
ping : 'Nat
|
||||
ping _ = 3
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
Update a member of a cycle with a type-changing update, thus severing the cycle.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ping : 'Nat
|
||||
ping _ = !pong + 1
|
||||
|
||||
@ -31,7 +31,7 @@ scratch/main> add
|
||||
pong : 'Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
ping : Nat
|
||||
ping = 3
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
`update` properly discovers and establishes new cycles.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ping : 'Nat
|
||||
ping _ = 1
|
||||
|
||||
@ -31,7 +31,7 @@ scratch/main> add
|
||||
pong : 'Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
ping : 'Nat
|
||||
ping _ = !clang + 1
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Not yet working: properly updating nameless implicit terms.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
inner.ping : 'Nat
|
||||
inner.ping _ = !pong + 1
|
||||
|
||||
@ -34,7 +34,7 @@ scratch/main> add
|
||||
Here we queue up an update by saving in a namespace where `inner.ping` and `pong` both have names, but then apply the
|
||||
update in a namespace where only `ping` has a name.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
inner.ping : 'Nat
|
||||
inner.ping _ = !pong + 3
|
||||
```
|
||||
@ -72,4 +72,5 @@ scratch/main> view inner.ping
|
||||
```
|
||||
The bug here is that `inner.ping` still refers to `pong` by name. But if we properly identified the nameless (in the
|
||||
context that the update was applied) `pong` as an implicit term to include in the new `ping`'s cycle, then `ping` would
|
||||
be left referring to a nameless thing (namely, `pong`, but updated to refer to the new `ping).
|
||||
be left referring to a nameless thing (namely, `pong`, but updated to refer to the new `ping`).
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
x = 30
|
||||
|
||||
y : Nat
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
a.b.one = 1
|
||||
a.two = 2
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
First we'll set up two libraries, and then we'll use them in some projects and show what `names` are deep-loaded for them.
|
||||
|
||||
Our two "libraries":
|
||||
```unison
|
||||
|
||||
``` unison
|
||||
text.a = 1
|
||||
text.b = 2
|
||||
text.c = 3
|
||||
@ -12,6 +13,7 @@ http.z = 8
|
||||
```
|
||||
|
||||
Our `app1` project includes the text library twice and the http library twice as direct dependencies.
|
||||
|
||||
```ucm
|
||||
scratch/app1> fork text lib.text_v1
|
||||
|
||||
@ -39,6 +41,7 @@ scratch/app1> delete.namespace http
|
||||
|
||||
```
|
||||
As such, we see two copies of `a` and two copies of `x` via these direct dependencies.
|
||||
|
||||
```ucm
|
||||
scratch/app1> names a
|
||||
|
||||
@ -59,6 +62,7 @@ scratch/app1> names x
|
||||
```
|
||||
Our `app2` project includes the `http` library twice as direct dependencies, and once as an indirect dependency via `webutil`.
|
||||
It also includes the `text` library twice as indirect dependencies via `webutil`
|
||||
|
||||
```ucm
|
||||
scratch/app2> fork http lib.http_v1
|
||||
|
||||
@ -91,6 +95,7 @@ scratch/app2> delete.namespace text
|
||||
```
|
||||
Now we see two copies of `x` via direct dependencies on `http`, and one copy of `a` via indirect dependency on `text` via `webutil`.
|
||||
We see neither the second indirect copy of `a` nor the indirect copy of `x` via webutil because we already have names for them.
|
||||
|
||||
```ucm
|
||||
scratch/app2> names a
|
||||
|
||||
|
@ -4,7 +4,7 @@ diffs/main> builtins.merge
|
||||
Done.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
term =
|
||||
_ = "Here's some text"
|
||||
1 + 1
|
||||
@ -42,7 +42,7 @@ diffs/main> branch.create new
|
||||
`switch /main` then `merge /new`.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
term =
|
||||
_ = "Here's some different text"
|
||||
1 + 2
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
# Delete namespace dependents check
|
||||
|
||||
This is a regression test, previously `delete.namespace` allowed a delete as long as the deletions had a name _anywhere_ in your codebase, it should only check the current project branch.
|
||||
This is a regression test, previously `delete.namespace` allowed a delete as long as the deletions had a name *anywhere* in your codebase, it should only check the current project branch.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
sub.dependency = 123
|
||||
|
||||
dependent = dependency + 99
|
||||
|
@ -1,6 +1,6 @@
|
||||
# delete.namespace.force
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
no_dependencies.thing = "no dependents on this term"
|
||||
|
||||
dependencies.term1 = 1
|
||||
|
@ -7,7 +7,7 @@ scratch/main> delete foo
|
||||
foo
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
foo = 1
|
||||
structural type Foo = Foo ()
|
||||
```
|
||||
|
@ -17,7 +17,7 @@ exist.
|
||||
Now for some easy cases. Deleting an unambiguous term, then deleting an
|
||||
unambiguous type.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
foo = 1
|
||||
structural type Foo = Foo ()
|
||||
```
|
||||
@ -57,7 +57,7 @@ structural type Foo = Foo ()
|
||||
```
|
||||
How about an ambiguous term?
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
foo = 1
|
||||
bar = 2
|
||||
```
|
||||
@ -101,7 +101,7 @@ A delete should remove both versions of the term.
|
||||
```
|
||||
Let's repeat all that on a type, for completeness.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type Foo = Foo ()
|
||||
structural type Bar = Bar
|
||||
```
|
||||
@ -144,7 +144,7 @@ structural type Bar = Bar
|
||||
```
|
||||
Finally, let's try to delete a term and a type with the same name.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
foo = 1
|
||||
structural type foo = Foo ()
|
||||
```
|
||||
@ -169,7 +169,7 @@ structural type foo = Foo ()
|
||||
```
|
||||
We want to be able to delete multiple terms at once
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
a = "a"
|
||||
b = "b"
|
||||
c = "c"
|
||||
@ -197,7 +197,7 @@ c = "c"
|
||||
```
|
||||
We can delete terms and types in the same invocation of delete
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type Foo = Foo ()
|
||||
a = "a"
|
||||
b = "b"
|
||||
@ -238,7 +238,7 @@ c = "c"
|
||||
```
|
||||
We can delete a type and its constructors
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type Foo = Foo ()
|
||||
```
|
||||
|
||||
@ -266,7 +266,7 @@ structural type Foo = Foo ()
|
||||
```
|
||||
You should not be able to delete terms which are referenced by other terms
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
a = 1
|
||||
b = 2
|
||||
c = 3
|
||||
@ -299,7 +299,7 @@ d = a + b + c
|
||||
```
|
||||
But you should be able to delete all terms which reference each other in a single command
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
e = 11
|
||||
f = 12 + e
|
||||
g = 13 + f
|
||||
@ -330,7 +330,7 @@ h = e + f + g
|
||||
```
|
||||
You should be able to delete a type and all the functions that reference it in a single command
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type Foo = Foo Nat
|
||||
|
||||
incrementFoo : Foo -> Nat
|
||||
@ -359,7 +359,7 @@ incrementFoo = cases
|
||||
```
|
||||
If you mess up on one of the names of your command, delete short circuits
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
e = 11
|
||||
f = 12 + e
|
||||
g = 13 + f
|
||||
@ -386,7 +386,7 @@ h = e + f + g
|
||||
```
|
||||
Cyclical terms which are guarded by a lambda are allowed to be deleted
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ping _ = 1 Nat.+ !pong
|
||||
pong _ = 4 Nat.+ !ping
|
||||
```
|
||||
|
@ -1,8 +1,10 @@
|
||||
### `debug.file`
|
||||
|
||||
I can use `debug.file` to see the hashes of the last typechecked file.
|
||||
|
||||
Given this .u file:
|
||||
```unison
|
||||
|
||||
``` unison
|
||||
structural type outside.A = A Nat outside.B
|
||||
structural type outside.B = B Int
|
||||
outside.c = 3
|
||||
@ -30,7 +32,9 @@ scratch/main> debug.file
|
||||
This will help me make progress in some situations when UCM is being deficient or broken.
|
||||
|
||||
### `dependents` / `dependencies`
|
||||
|
||||
But wait, there's more. I can check the dependencies and dependents of a definition:
|
||||
|
||||
```ucm
|
||||
scratch/main> add
|
||||
|
||||
@ -110,3 +114,4 @@ scratch/main> dependents d
|
||||
|
||||
```
|
||||
We don't have an index for dependents of constructors, but iirc if you ask for that, it will show you dependents of the structural type that provided the constructor.
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Here's a couple examples:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex0 : Nat -> Nat
|
||||
ex0 n =
|
||||
(a, _, (c,d)) = ("uno", "dos", (n, 7))
|
||||
@ -52,7 +52,7 @@ Notice that `ex0` is printed using the `cases` syntax (but `ex1` is not). The pr
|
||||
|
||||
A destructuring bind is just syntax for a single branch pattern match. Notice that Unison detects this function as an alias of `ex1`:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex2 : (a,b,(Nat,Nat)) -> Nat
|
||||
ex2 tup = match tup with
|
||||
(a, b, (c,d)) -> c + d
|
||||
@ -76,7 +76,7 @@ ex2 tup = match tup with
|
||||
|
||||
Destructuring binds can't be recursive: the left-hand side bound variables aren't available on the right hand side. For instance, this doesn't typecheck:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex4 =
|
||||
(a,b) = (a Nat.+ b, 19)
|
||||
"Doesn't typecheck"
|
||||
@ -104,7 +104,7 @@ ex4 =
|
||||
```
|
||||
Even though the parser accepts any pattern on the LHS of a bind, it looks pretty weird to see things like `12 = x`, so we avoid showing a destructuring bind when the LHS is a "literal" pattern (like `42` or "hi"). Again these examples wouldn't compile with coverage checking.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex5 : 'Text
|
||||
ex5 _ = match 99 + 1 with
|
||||
12 -> "Hi"
|
||||
@ -155,7 +155,7 @@ Notice how it prints both an ordinary match.
|
||||
|
||||
Also, for clarity, the pretty-printer shows a single-branch match if the match shadows free variables of the scrutinee, for example:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
ex6 x = match x with
|
||||
(x, y) -> x Nat.+ y
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
b1.x = 23
|
||||
b1.fslkdjflskdjflksjdf = 663
|
||||
b2.x = 23
|
||||
@ -58,16 +58,16 @@ b2.abc = 23
|
||||
```
|
||||
Things we want to test:
|
||||
|
||||
* Diffing identical namespaces
|
||||
* Adds, removes, updates
|
||||
* Adds with multiple names
|
||||
* Moved and copied definitions
|
||||
* Moves that have more that 1 initial or final name
|
||||
* ... terms and types
|
||||
* New patches, modified patches, deleted patches, moved patches
|
||||
* With and without propagated updates
|
||||
- Diffing identical namespaces
|
||||
- Adds, removes, updates
|
||||
- Adds with multiple names
|
||||
- Moved and copied definitions
|
||||
- Moves that have more that 1 initial or final name
|
||||
- ... terms and types
|
||||
- New patches, modified patches, deleted patches, moved patches
|
||||
- With and without propagated updates
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
fromJust = 1
|
||||
b = 2
|
||||
bdependent = b
|
||||
@ -122,7 +122,7 @@ Here's what we've done so far:
|
||||
The namespaces are identical.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
junk = "asldkfjasldkfj"
|
||||
```
|
||||
|
||||
@ -142,7 +142,7 @@ junk = "asldkfjasldkfj"
|
||||
Done.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
fromJust = 99
|
||||
b = "oog"
|
||||
d = 4
|
||||
@ -283,7 +283,7 @@ unique type Y a b = Y a b
|
||||
3. fromJust' ┘ 4. fromJust' (removed)
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
bdependent = "banana"
|
||||
```
|
||||
|
||||
@ -316,7 +316,7 @@ bdependent = "banana"
|
||||
Currently, the auto-propagated name-conflicted definitions are not explicitly
|
||||
shown, only their also-conflicted dependency is shown.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
a = 333
|
||||
b = a + 1
|
||||
```
|
||||
@ -340,7 +340,7 @@ b = a + 1
|
||||
Done.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
a = 444
|
||||
```
|
||||
|
||||
@ -352,7 +352,7 @@ a = 444
|
||||
a : ##Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
a = 555
|
||||
```
|
||||
|
||||
@ -412,7 +412,7 @@ a = 555
|
||||
```
|
||||
## Should be able to diff a namespace hash from history.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 1
|
||||
```
|
||||
|
||||
@ -439,7 +439,7 @@ x = 1
|
||||
x : ##Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
y = 2
|
||||
```
|
||||
|
||||
@ -489,43 +489,44 @@ Updates: -- 1 to 1
|
||||
|
||||
New name conflicts: -- updates where RHS has multiple hashes (excluding when RHS=LHS)
|
||||
|
||||
1. foo#jk19sm5bf8 : Nat - do we want to force a hashqualified? Arya thinks so
|
||||
↓
|
||||
2. ┌ foo#0ja1qfpej6 : Nat
|
||||
3. └ foo#jk19sm5bf8 : Nat
|
||||
1. foo\#jk19sm5bf8 : Nat - do we want to force a hashqualified? Arya thinks so
|
||||
↓
|
||||
2. ┌ foo\#0ja1qfpej6 : Nat
|
||||
3. └ foo\#jk19sm5bf8 : Nat
|
||||
|
||||
Resolved name conflicts: -- updates where LHS had multiple hashes and RHS has one
|
||||
|
||||
4. ┌ bar#0ja1qfpej6 : Nat
|
||||
5. └ bar#jk19sm5bf8 : Nat
|
||||
↓
|
||||
6. bar#jk19sm5bf8 : Nat
|
||||
4. ┌ bar\#0ja1qfpej6 : Nat
|
||||
5. └ bar\#jk19sm5bf8 : Nat
|
||||
↓
|
||||
6. bar\#jk19sm5bf8 : Nat
|
||||
|
||||
## Display issues to fixup
|
||||
|
||||
- [d] Do we want to surface new edit conflicts in patches?
|
||||
- [t] two different auto-propagated changes creating a name conflict should show
|
||||
up somewhere besides the auto-propagate count
|
||||
- [t] Things look screwy when the type signature doesn't fit and has to get broken
|
||||
up into multiple lines. Maybe just disallow that?
|
||||
- [d] Delete blank line in between copies / renames entries if all entries are 1 to 1
|
||||
see todo in the code
|
||||
- [x] incorrectly calculated bracket alignment on hashqualified "Name changes" (delete.output.md)
|
||||
- [x] just handle deletion of isPropagated in propagate function, leave HandleInput alone (assuming this does the trick)
|
||||
- [x] might want unqualified names to be qualified sometimes:
|
||||
- [x] if a name is updated to a not-yet-named reference, it's shown as both an update and an add
|
||||
- [x] similarly, if a conflicted name is resolved by deleting the last name to
|
||||
a reference, I (arya) suspect it will show up as a Remove
|
||||
- [d] Maybe group and/or add headings to the types, constructors, terms
|
||||
- [x] add tagging of propagated updates to test propagated updates output
|
||||
- [x] missing old names in deletion ppe (delete.output.md) (superseded by \#1143)
|
||||
- [x] delete.term has some bonkers output
|
||||
- [x] Make a decision about how we want to show constructors in the diff
|
||||
- [x] 12.patch patch needs a space
|
||||
- [x] This looks like garbage
|
||||
- [x] Extra 2 blank lines at the end of the add section
|
||||
- [x] Fix alignment issues with buildTable, convert to column3M (to be written)
|
||||
- [x] adding an alias is showing up as an Add and a Copy; should just show as Copy
|
||||
- [x] removing one of multiple aliases appears in removes + moves + copies section
|
||||
- [x] some overlapping cases between Moves and Copies^
|
||||
- [x] Maybe don't list the type signature twice for aliases?
|
||||
- \[d\] Do we want to surface new edit conflicts in patches?
|
||||
- \[t\] two different auto-propagated changes creating a name conflict should show
|
||||
up somewhere besides the auto-propagate count
|
||||
- \[t\] Things look screwy when the type signature doesn't fit and has to get broken
|
||||
up into multiple lines. Maybe just disallow that?
|
||||
- \[d\] Delete blank line in between copies / renames entries if all entries are 1 to 1
|
||||
see todo in the code
|
||||
- \[x\] incorrectly calculated bracket alignment on hashqualified "Name changes" (delete.output.md)
|
||||
- \[x\] just handle deletion of isPropagated in propagate function, leave HandleInput alone (assuming this does the trick)
|
||||
- \[x\] might want unqualified names to be qualified sometimes:
|
||||
- \[x\] if a name is updated to a not-yet-named reference, it's shown as both an update and an add
|
||||
- \[x\] similarly, if a conflicted name is resolved by deleting the last name to
|
||||
a reference, I (arya) suspect it will show up as a Remove
|
||||
- \[d\] Maybe group and/or add headings to the types, constructors, terms
|
||||
- \[x\] add tagging of propagated updates to test propagated updates output
|
||||
- \[x\] missing old names in deletion ppe (delete.output.md) (superseded by \#1143)
|
||||
- \[x\] delete.term has some bonkers output
|
||||
- \[x\] Make a decision about how we want to show constructors in the diff
|
||||
- \[x\] 12.patch patch needs a space
|
||||
- \[x\] This looks like garbage
|
||||
- \[x\] Extra 2 blank lines at the end of the add section
|
||||
- \[x\] Fix alignment issues with buildTable, convert to column3M (to be written)
|
||||
- \[x\] adding an alias is showing up as an Add and a Copy; should just show as Copy
|
||||
- \[x\] removing one of multiple aliases appears in removes + moves + copies section
|
||||
- \[x\] some overlapping cases between Moves and Copies^
|
||||
- \[x\] Maybe don't list the type signature twice for aliases?
|
||||
|
||||
|
@ -2,7 +2,7 @@ This transcript explains a few minor details about doc parsing and pretty-printi
|
||||
|
||||
Docs can be used as inline code comments.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
foo : Nat -> Nat
|
||||
foo n =
|
||||
_ = [: do the thing :]
|
||||
@ -34,7 +34,7 @@ scratch/main> view foo
|
||||
```
|
||||
Note that `@` and `:]` must be escaped within docs.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
escaping = [: Docs look [: like \@this \:] :]
|
||||
```
|
||||
|
||||
@ -60,7 +60,7 @@ scratch/main> view escaping
|
||||
```
|
||||
(Alas you can't have `\@` or `\:]` in your doc, as there's currently no way to 'unescape' them.)
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
-- Note that -- comments are preserved within doc literals.
|
||||
commented = [:
|
||||
example:
|
||||
@ -98,7 +98,7 @@ scratch/main> view commented
|
||||
|
||||
Handling of indenting in docs between the parser and pretty-printer is a bit fiddly.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
-- The leading and trailing spaces are stripped from the stored Doc by the
|
||||
-- lexer, and one leading and trailing space is inserted again on view/edit
|
||||
-- by the pretty-printer.
|
||||
@ -125,7 +125,7 @@ scratch/main> view doc1
|
||||
doc1 = [: hi :]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- Lines (apart from the first line, i.e. the bit between the [: and the
|
||||
-- first newline) are unindented until at least one of
|
||||
-- them hits the left margin (by a post-processing step in the parser).
|
||||
@ -161,7 +161,7 @@ scratch/main> view doc2
|
||||
and the rest. :]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
doc3 = [: When Unison identifies a paragraph, it removes any newlines from it before storing it, and then reflows the paragraph text to fit the display window on display/view/edit.
|
||||
|
||||
For these purposes, a paragraph is any sequence of non-empty lines that have zero indent (after the unindenting mentioned above.)
|
||||
@ -215,7 +215,7 @@ scratch/main> view doc3
|
||||
:]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
doc4 = [: Here's another example of some paragraphs.
|
||||
|
||||
All these lines have zero indent.
|
||||
@ -248,7 +248,7 @@ scratch/main> view doc4
|
||||
- Apart from this one. :]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- The special treatment of the first line does mean that the following
|
||||
-- is pretty-printed not so prettily. To fix that we'd need to get the
|
||||
-- lexer to help out with interpreting doc literal indentation (because
|
||||
@ -281,7 +281,7 @@ scratch/main> view doc5
|
||||
and the rest. :]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- You can do the following to avoid that problem.
|
||||
doc6 = [:
|
||||
- foo
|
||||
@ -316,7 +316,7 @@ scratch/main> view doc6
|
||||
```
|
||||
### More testing
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
-- Check empty doc works.
|
||||
empty = [::]
|
||||
|
||||
@ -344,7 +344,7 @@ scratch/main> view empty
|
||||
empty = [: :]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
test1 = [:
|
||||
The internal logic starts to get hairy when you use the \@ features, for example referencing a name like @List.take. Internally, the text between each such usage is its own blob (blob ends here --> @List.take), so paragraph reflow has to be aware of multiple blobs to do paragraph reflow (or, more accurately, to do the normalization step where newlines with a paragraph are removed.)
|
||||
|
||||
@ -460,7 +460,7 @@ scratch/main> view test1
|
||||
:]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- Regression test for #1363 - preservation of spaces after @ directives in first line when unindenting
|
||||
reg1363 = [: `@List.take foo` bar
|
||||
baz :]
|
||||
@ -486,7 +486,7 @@ scratch/main> view reg1363
|
||||
reg1363 = [: `@List.take foo` bar baz :]
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- Demonstrate doc display when whitespace follows a @[source] or @[evaluate]
|
||||
-- whose output spans multiple lines.
|
||||
|
||||
@ -510,6 +510,7 @@ test2 = [:
|
||||
|
||||
```
|
||||
View is fine.
|
||||
|
||||
```ucm
|
||||
scratch/main> view test2
|
||||
|
||||
@ -521,6 +522,7 @@ scratch/main> view test2
|
||||
|
||||
```
|
||||
But note it's not obvious how display should best be handling this. At the moment it just does the simplest thing:
|
||||
|
||||
```ucm
|
||||
scratch/main> display test2
|
||||
|
||||
|
@ -6,7 +6,7 @@ not the ability `Patterns`; the lexer should see this as a single identifier.
|
||||
|
||||
See https://github.com/unisonweb/unison/issues/2642 for an example.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
abilityPatterns : ()
|
||||
abilityPatterns = ()
|
||||
|
||||
|
@ -16,7 +16,7 @@ scratch/main> view lib.builtins.Doc
|
||||
```
|
||||
You can create these `Doc` values with ordinary code, or you can use the special syntax. A value of structural type `Doc` can be created via syntax like:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
doc1 = [: This is some documentation.
|
||||
|
||||
It can span multiple lines.
|
||||
@ -43,17 +43,17 @@ Syntax:
|
||||
|
||||
`[:` starts a documentation block; `:]` finishes it. Within the block:
|
||||
|
||||
* Links to definitions are done with `@List`. `\@` (and `\:]`) if you want to escape.
|
||||
* `@[signature] List.take` expands to the type signature of `List.take`
|
||||
* `@[source] List.map` expands to the full source of `List.map`
|
||||
* `@[include] someOtherDoc`, inserts a value `someOtherDoc : Doc` here.
|
||||
* `@[evaluate] someDefinition` expands to the result of evaluating `someDefinition`, which must be a pre-existing definition in the codebase (can't be an arbitrary expression).
|
||||
- Links to definitions are done with `@List`. `\@` (and `\:]`) if you want to escape.
|
||||
- `@[signature] List.take` expands to the type signature of `List.take`
|
||||
- `@[source] List.map` expands to the full source of `List.map`
|
||||
- `@[include] someOtherDoc`, inserts a value `someOtherDoc : Doc` here.
|
||||
- `@[evaluate] someDefinition` expands to the result of evaluating `someDefinition`, which must be a pre-existing definition in the codebase (can't be an arbitrary expression).
|
||||
|
||||
### An example
|
||||
|
||||
We are going to document `List.take` using some verbiage and a few examples. First we have to add the examples to the codebase:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
List.take.ex1 = take 0 [1,2,3,4,5]
|
||||
List.take.ex2 = take 2 [1,2,3,4,5]
|
||||
```
|
||||
@ -83,7 +83,7 @@ scratch/main> add
|
||||
```
|
||||
And now let's write our docs and reference these examples:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
List.take.doc = [:
|
||||
`@List.take n xs` returns the first `n` elements of `xs`. (No need to add line breaks manually. The display command will do wrapping of text for you. Indent any lines where you don't want it to do this.)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Test parsing and round-trip of doc2 syntax elements
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
otherDoc : a -> Doc2
|
||||
otherDoc _ = {{ yo }}
|
||||
|
||||
@ -113,7 +113,7 @@ Format it to check that everything pretty-prints in a valid way.
|
||||
scratch/main> debug.format
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
``` unison:added-by-ucm scratch.u
|
||||
otherDoc : a -> Doc2
|
||||
otherDoc _ = {{ yo }}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
otherDoc : a -> Doc2
|
||||
otherDoc _ = {{ yo }}
|
||||
|
||||
@ -159,7 +159,7 @@ scratch/main> debug.doc-to-markdown fulldoc
|
||||
```
|
||||
You can add docs to a term or type with a top-level doc literal above the binding:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
{{ This is a term doc }}
|
||||
myTerm = 10
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
If `foo#old` exists in old, and `foo#new` exists in new, you might think `upgrade old new` would rewrite references to
|
||||
`#old` with references to `#new`. And it will... !!unless!! `#old` still exists in new.
|
||||
`#old` with references to `#new`. And it will... \!\!unless\!\! `#old` still exists in new.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
lib.old.foo = 18
|
||||
lib.new.other = 18
|
||||
lib.new.foo = 19
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Term and ability constructor collisions should cause a parse error.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural ability Stream where
|
||||
send : a -> ()
|
||||
|
||||
@ -26,7 +26,7 @@ Stream.send _ = ()
|
||||
```
|
||||
Term and type constructor collisions should cause a parse error.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type X = x
|
||||
|
||||
X.x : a -> ()
|
||||
@ -49,7 +49,7 @@ X.x _ = ()
|
||||
```
|
||||
Ability and type constructor collisions should cause a parse error.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type X = x
|
||||
structural ability X where
|
||||
x : ()
|
||||
@ -69,7 +69,7 @@ structural ability X where
|
||||
```
|
||||
Field accessors and terms with the same name should cause a parse error.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type X = {x : ()}
|
||||
X.x.modify = ()
|
||||
X.x.set = ()
|
||||
@ -103,7 +103,7 @@ X.x = ()
|
||||
```
|
||||
Types and terms with the same name are allowed.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type X = Z
|
||||
|
||||
X = ()
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Trivial duplicate terms should be detected:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 1
|
||||
x = 2
|
||||
```
|
||||
@ -21,7 +21,7 @@ x = 2
|
||||
```
|
||||
Equivalent duplicate terms should be detected:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 1
|
||||
x = 1
|
||||
```
|
||||
@ -40,7 +40,7 @@ x = 1
|
||||
```
|
||||
Duplicates from record accessors/setters should be detected
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type Record = {x: Nat, y: Nat}
|
||||
Record.x = 1
|
||||
Record.x.set = 2
|
||||
@ -74,7 +74,7 @@ Record.x.modify = 2
|
||||
```
|
||||
Duplicate terms and constructors should be detected:
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
structural type SumType = X
|
||||
|
||||
SumType.X = 1
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
up = 0xs0123456789abcdef
|
||||
down = 0xsfedcba9876543210
|
||||
|
||||
|
@ -4,7 +4,7 @@ scratch/main> builtins.merge
|
||||
Done.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
---
|
||||
title: /private/tmp/scratch.u
|
||||
---
|
||||
@ -16,7 +16,6 @@ mytest = [Ok "ok"]
|
||||
|
||||
```
|
||||
|
||||
|
||||
```ucm
|
||||
|
||||
Loading changes detected in /private/tmp/scratch.u.
|
||||
@ -60,7 +59,7 @@ scratch/main> edit mytest
|
||||
definitions currently in this namespace.
|
||||
|
||||
```
|
||||
```unison:added-by-ucm /private/tmp/scratch.u
|
||||
``` unison:added-by-ucm /private/tmp/scratch.u
|
||||
bar : Nat
|
||||
bar = 456
|
||||
|
||||
@ -68,7 +67,7 @@ foo : Nat
|
||||
foo = 123
|
||||
```
|
||||
|
||||
```unison:added-by-ucm /private/tmp/scratch.u
|
||||
``` unison:added-by-ucm /private/tmp/scratch.u
|
||||
test> mytest = [Ok "ok"]
|
||||
```
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
```unison
|
||||
``` unison
|
||||
{{ ping doc }}
|
||||
nested.cycle.ping n = n Nat.+ pong n
|
||||
|
||||
@ -79,7 +79,7 @@ project/main> edit.namespace
|
||||
definitions currently in this namespace.
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
``` unison:added-by-ucm scratch.u
|
||||
type Foo = { bar : Nat, baz : Nat }
|
||||
|
||||
nested.cycle.ping : Nat -> Nat
|
||||
@ -121,7 +121,7 @@ project/main> edit.namespace nested simple
|
||||
definitions currently in this namespace.
|
||||
|
||||
```
|
||||
```unison:added-by-ucm scratch.u
|
||||
``` unison:added-by-ucm scratch.u
|
||||
nested.cycle.ping : Nat -> Nat
|
||||
nested.cycle.ping n =
|
||||
use Nat +
|
||||
|
@ -1,10 +1,11 @@
|
||||
# Empty namespace behaviours
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
mynamespace.x = 1
|
||||
```
|
||||
|
||||
The deleted namespace shouldn't appear in `ls` output.
|
||||
|
||||
```ucm
|
||||
scratch/main> ls
|
||||
|
||||
@ -57,7 +58,7 @@ scratch/main> history mynamespace
|
||||
```
|
||||
Add and then delete a term to add some history to a deleted namespace.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
deleted.x = 1
|
||||
stuff.thing = 2
|
||||
```
|
||||
@ -96,7 +97,7 @@ scratch/main> history deleted
|
||||
```
|
||||
## move.namespace
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
moveoverme.x = 1
|
||||
moveme.y = 2
|
||||
```
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
The Unison codebase, when first initialized, contains no definitions in its namespace.
|
||||
|
||||
Not even `Nat` or `+`!
|
||||
Not even `Nat` or `+`\!
|
||||
|
||||
BEHOLD!!!
|
||||
BEHOLD\!\!\!
|
||||
|
||||
```ucm
|
||||
scratch/main> ls
|
||||
@ -37,4 +37,5 @@ scratch/main> ls lib
|
||||
2. builtinsio/ (643 terms, 92 types)
|
||||
|
||||
```
|
||||
More typically, you'd start out by pulling `base.
|
||||
More typically, you'd start out by pulling `base`.
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
This file contains programs with parse errors and type errors, for visual inspection of error message quality and to check for regressions or changes to error reporting.
|
||||
|
||||
## Parse errors
|
||||
@ -7,7 +6,7 @@ Some basic errors of literals.
|
||||
|
||||
### Floating point literals
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 1. -- missing some digits after the decimal
|
||||
```
|
||||
|
||||
@ -23,7 +22,7 @@ x = 1. -- missing some digits after the decimal
|
||||
or `1.1e37`.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
x = 1e -- missing an exponent
|
||||
```
|
||||
|
||||
@ -39,7 +38,7 @@ x = 1e -- missing an exponent
|
||||
`1e37`.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
x = 1e- -- missing an exponent
|
||||
```
|
||||
|
||||
@ -55,7 +54,7 @@ x = 1e- -- missing an exponent
|
||||
`1e-37`.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
x = 1E+ -- missing an exponent
|
||||
```
|
||||
|
||||
@ -73,7 +72,7 @@ x = 1E+ -- missing an exponent
|
||||
```
|
||||
### Hex, octal, and bytes literals
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x = 0xoogabooga -- invalid hex chars
|
||||
```
|
||||
|
||||
@ -89,7 +88,7 @@ x = 0xoogabooga -- invalid hex chars
|
||||
0123456789abcdefABCDEF) after the 0x.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
x = 0o987654321 -- 9 and 8 are not valid octal char
|
||||
```
|
||||
|
||||
@ -105,7 +104,7 @@ x = 0o987654321 -- 9 and 8 are not valid octal char
|
||||
the 0o.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
x = 0xsf -- odd number of hex chars in a bytes literal
|
||||
```
|
||||
|
||||
@ -121,7 +120,7 @@ x = 0xsf -- odd number of hex chars in a bytes literal
|
||||
of 0123456789abcdefABCDEF) after the 0xs.
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
x = 0xsnotvalidhexchars -- invalid hex chars in a bytes literal
|
||||
```
|
||||
|
||||
@ -139,7 +138,7 @@ x = 0xsnotvalidhexchars -- invalid hex chars in a bytes literal
|
||||
```
|
||||
### Layout errors
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
foo = else -- not matching if
|
||||
```
|
||||
|
||||
@ -153,7 +152,7 @@ foo = else -- not matching if
|
||||
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
foo = then -- unclosed
|
||||
```
|
||||
|
||||
@ -167,7 +166,7 @@ foo = then -- unclosed
|
||||
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
foo = with -- unclosed
|
||||
```
|
||||
|
||||
@ -183,7 +182,7 @@ foo = with -- unclosed
|
||||
```
|
||||
### Matching
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
-- No cases
|
||||
foo = match 1 with
|
||||
```
|
||||
@ -201,7 +200,7 @@ foo = match 1 with
|
||||
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
foo = match 1 with
|
||||
2 -- no right-hand-side
|
||||
```
|
||||
@ -212,7 +211,8 @@ foo = match 1 with
|
||||
|
||||
I got confused here:
|
||||
|
||||
3 |
|
||||
2 | 2 -- no right-hand-side
|
||||
|
||||
|
||||
I was surprised to find an end of section here.
|
||||
I was expecting one of these instead:
|
||||
@ -222,7 +222,7 @@ foo = match 1 with
|
||||
* pattern guard
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- Mismatched arities
|
||||
foo = cases
|
||||
1, 2 -> ()
|
||||
@ -243,7 +243,7 @@ foo = cases
|
||||
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- Missing a '->'
|
||||
x = match Some a with
|
||||
None ->
|
||||
@ -258,7 +258,8 @@ x = match Some a with
|
||||
|
||||
I got confused here:
|
||||
|
||||
7 |
|
||||
6 | 2
|
||||
|
||||
|
||||
I was surprised to find an end of section here.
|
||||
I was expecting one of these instead:
|
||||
@ -271,7 +272,7 @@ x = match Some a with
|
||||
* true
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- Missing patterns
|
||||
x = match Some a with
|
||||
None -> 1
|
||||
@ -294,7 +295,7 @@ x = match Some a with
|
||||
* newline or semicolon
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- Guards following an unguarded case
|
||||
x = match Some a with
|
||||
None -> 1
|
||||
@ -318,7 +319,7 @@ x = match Some a with
|
||||
```
|
||||
### Watches
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
-- Empty watch
|
||||
>
|
||||
```
|
||||
@ -335,7 +336,7 @@ x = match Some a with
|
||||
```
|
||||
### Keywords
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
use.keyword.in.namespace = 1
|
||||
```
|
||||
|
||||
@ -351,7 +352,7 @@ use.keyword.in.namespace = 1
|
||||
or wrapping it in backticks (like `namespace` ).
|
||||
|
||||
```
|
||||
```unison
|
||||
``` unison
|
||||
-- reserved operator
|
||||
a ! b = 1
|
||||
```
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
When an error is encountered in a `unison:hide:all` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
a : Nat
|
||||
a =
|
||||
b = 24
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
When an error is encountered in a `unison:hide:all` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
x =
|
||||
y = 24
|
||||
```
|
||||
|
@ -1,17 +1,17 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
Dangerous scary words!
|
||||
Dangerous scary words\!
|
||||
|
||||
When an expected error is not encountered in a `ucm:hide:all` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```ucm
|
||||
``` ucm
|
||||
scratch/main> history
|
||||
```
|
||||
|
||||
|
||||
|
||||
🛑
|
||||
|
||||
The transcript was expecting an error in the stanza above, but did not encounter one.
|
||||
|
@ -1,17 +1,17 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
Dangerous scary words!
|
||||
Dangerous scary words\!
|
||||
|
||||
When an error is encountered in a `ucm:hide:all` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```ucm
|
||||
``` ucm
|
||||
scratch/main> move.namespace foo bar
|
||||
```
|
||||
|
||||
|
||||
|
||||
🛑
|
||||
|
||||
The transcript failed due to an error in the stanza above. The error is:
|
||||
|
@ -1,17 +1,17 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
Dangerous scary words!
|
||||
Dangerous scary words\!
|
||||
|
||||
When an expected error is not encountered in a `ucm:hide` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```ucm
|
||||
``` ucm
|
||||
scratch/main> history
|
||||
```
|
||||
|
||||
|
||||
|
||||
🛑
|
||||
|
||||
The transcript was expecting an error in the stanza above, but did not encounter one.
|
||||
|
@ -1,17 +1,17 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
Dangerous scary words!
|
||||
Dangerous scary words\!
|
||||
|
||||
When an error is encountered in a `ucm:hide` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```ucm
|
||||
``` ucm
|
||||
scratch/main> move.namespace foo bar
|
||||
```
|
||||
|
||||
|
||||
|
||||
🛑
|
||||
|
||||
The transcript failed due to an error in the stanza above. The error is:
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
When an expected error is not encountered in a `unison:hide:all:error` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
myVal = 3
|
||||
```
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
When an error is encountered in a `unison:hide:all` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
g 3
|
||||
```
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
### Transcript parser hidden errors
|
||||
|
||||
When an expected error is not encountered in a `unison:hide:error` block
|
||||
then the transcript parser should print the stanza
|
||||
and surface a helpful message.
|
||||
|
||||
```unison
|
||||
``` unison
|
||||
myVal = 3
|
||||
```
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user