mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
Merge trunk
This commit is contained in:
commit
209ddc0a5a
@ -13,13 +13,12 @@ module Unison.Debug
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Applicative (empty)
|
||||
import Control.Monad (when)
|
||||
import Data.Set (Set)
|
||||
import Data.Set qualified as Set
|
||||
import Data.Text qualified as Text
|
||||
import Debug.Pretty.Simple (pTrace, pTraceM, pTraceShowId, pTraceShowM)
|
||||
import Debug.Pretty.Simple (pTrace, pTraceM)
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
import Text.Pretty.Simple (pShow)
|
||||
import Unison.Prelude
|
||||
import UnliftIO.Environment (lookupEnv)
|
||||
|
||||
data DebugFlag
|
||||
@ -148,7 +147,7 @@ debugPatternCoverageConstraintSolver = PatternCoverageConstraintSolver `Set.memb
|
||||
debug :: (Show a) => DebugFlag -> String -> a -> a
|
||||
debug flag msg a =
|
||||
if shouldDebug flag
|
||||
then pTraceShowId (pTrace (msg <> ":\n") a)
|
||||
then (pTrace (msg <> ":\n" <> into @String (pShow a)) a)
|
||||
else a
|
||||
|
||||
-- | Use for selective debug logging in monadic contexts.
|
||||
@ -159,8 +158,7 @@ debug flag msg a =
|
||||
debugM :: (Show a, Monad m) => DebugFlag -> String -> a -> m ()
|
||||
debugM flag msg a =
|
||||
whenDebug flag do
|
||||
pTraceM (msg <> ":\n")
|
||||
pTraceShowM a
|
||||
traceM (msg <> ":\n" <> into @String (pShow a))
|
||||
|
||||
debugLog :: DebugFlag -> String -> a -> a
|
||||
debugLog flag msg =
|
||||
|
@ -41,11 +41,11 @@ relocateToNameRoot perspective query rootBranch = do
|
||||
-- Since the project root is lower down we need to strip the part of the prefix
|
||||
-- which is now redundant.
|
||||
pure . Right $ (projectRoot, query <&> \n -> fromMaybe n $ Path.unprefixName (Path.Absolute remainder) n)
|
||||
-- The namesRoot is _inside_ of the project containing the query
|
||||
-- The namesRoot is _inside (or equal to)_ the project containing the query
|
||||
(_sharedPrefix, remainder, Path.Empty) -> do
|
||||
-- Since the project is higher up, we need to prefix the query
|
||||
-- with the remainder of the path
|
||||
pure $ Right (projectRoot, query <&> Path.prefixNameIfRel (Path.AbsolutePath' $ Path.Absolute remainder))
|
||||
pure $ Right (projectRoot, query <&> Path.prefixNameIfRel (Path.RelativePath' $ Path.Relative remainder))
|
||||
-- The namesRoot and project root are disjoint, this shouldn't ever happen.
|
||||
(_, _, _) -> pure $ Left (DisjointProjectAndPerspective perspective projectRoot)
|
||||
|
||||
|
@ -5,7 +5,7 @@ Thus, make sure the contents of this file define the contents of the cache
|
||||
(e.g. don't pull `latest`.)
|
||||
|
||||
```ucm
|
||||
.> pull @unison/base/releases/2.5.0 .base
|
||||
.> builtins.mergeio
|
||||
.> undo
|
||||
scratch/main> pull @unison/base/releases/2.5.0 .base
|
||||
scratch/main> builtins.mergeio
|
||||
scratch/main> undo
|
||||
```
|
||||
|
@ -5,12 +5,12 @@ If you want to add or update tests, you can create a branch of that project, and
|
||||
Before merging the PR on Github, we'll merge your branch on Share and restore `runtime_tests_version` to /main or maybe a release.
|
||||
|
||||
```ucm:hide:error
|
||||
.> this is a hack to trigger an error, in order to swallow any error on the next line.
|
||||
.> we delete the project to avoid any merge conflicts or complaints from ucm.
|
||||
.> delete.project runtime-tests
|
||||
scratch/main> this is a hack to trigger an error, in order to swallow any error on the next line.
|
||||
scratch/main> we delete the project to avoid any merge conflicts or complaints from ucm.
|
||||
scratch/main> delete.project runtime-tests
|
||||
```
|
||||
```ucm:hide
|
||||
.> clone ${runtime_tests_version} runtime-tests/selected
|
||||
scratch/main> clone ${runtime_tests_version} runtime-tests/selected
|
||||
```
|
||||
|
||||
```ucm
|
||||
|
@ -5,12 +5,12 @@ If you want to add or update tests, you can create a branch of that project, and
|
||||
Before merging the PR on Github, we'll merge your branch on Share and restore `runtime_tests_version` to /main or maybe a release.
|
||||
|
||||
```ucm:hide:error
|
||||
.> this is a hack to trigger an error, in order to swallow any error on the next line.
|
||||
.> we delete the project to avoid any merge conflicts or complaints from ucm.
|
||||
.> delete.project runtime-tests
|
||||
scratch/main> this is a hack to trigger an error, in order to swallow any error on the next line.
|
||||
scratch/main> we delete the project to avoid any merge conflicts or complaints from ucm.
|
||||
scratch/main> delete.project runtime-tests
|
||||
```
|
||||
```ucm:hide
|
||||
.> clone ${runtime_tests_version} runtime-tests/selected
|
||||
scratch/main> clone ${runtime_tests_version} runtime-tests/selected
|
||||
```
|
||||
|
||||
```ucm
|
||||
@ -31,8 +31,8 @@ foo = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> run.native foo
|
||||
.> run.native foo
|
||||
scratch/main> run.native foo
|
||||
scratch/main> run.native foo
|
||||
```
|
||||
|
||||
This can also only be tested by separately running this test, because
|
||||
|
@ -1,6 +1,6 @@
|
||||
```ucm:hide
|
||||
.> pull unison.public.base.releases.M4d base
|
||||
.> pull runarorama.public.sort.data sort
|
||||
scratch/main> pull unison.public.base.releases.M4d base
|
||||
scratch/main> pull runarorama.public.sort.data sort
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
@ -34,63 +34,63 @@ prepare = do
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
.> run prepare
|
||||
scratch/main> add
|
||||
scratch/main> run prepare
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/each.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/each.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/listmap.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/listmap.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/listfilter.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/listfilter.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/random.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/random.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/simpleloop.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/simpleloop.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/fibonacci.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/fibonacci.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/map.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/map.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/natmap.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/natmap.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/stm.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/stm.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/tmap.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/tmap.u
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> load unison-src/transcripts-manual/benchmarks/array-sort.u
|
||||
.> run main
|
||||
scratch/main> load unison-src/transcripts-manual/benchmarks/array-sort.u
|
||||
scratch/main> run main
|
||||
```
|
@ -3,5 +3,5 @@
|
||||
Note: this makes a network call to share to get completions
|
||||
|
||||
```ucm
|
||||
.> debug.tab-complete pull unison.pub
|
||||
scratch/main> debug.tab-complete pull unison.pub
|
||||
```
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
.> load unison-src/transcripts-using-base/base.u
|
||||
.> add
|
||||
scratch/main> builtins.mergeio
|
||||
scratch/main> load unison-src/transcripts-using-base/base.u
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## Structural find and replace
|
||||
@ -37,19 +37,19 @@ rule2 x = @rewrite signature Optional ==> Optional2
|
||||
Let's rewrite these:
|
||||
|
||||
```ucm
|
||||
.> rewrite rule1
|
||||
.> rewrite eitherToOptional
|
||||
scratch/main> rewrite rule1
|
||||
scratch/main> rewrite eitherToOptional
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> load
|
||||
.> add
|
||||
scratch/main> load
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
After adding to the codebase, here's the rewritten source:
|
||||
|
||||
```ucm
|
||||
.> view ex1 Either.mapRight rule1
|
||||
scratch/main> view ex1 Either.mapRight rule1
|
||||
```
|
||||
|
||||
Another example, showing that we can rewrite to definitions that only exist in the file:
|
||||
@ -75,18 +75,18 @@ blah2 = 456
|
||||
Let's apply the rewrite `woot1to2`:
|
||||
|
||||
```ucm
|
||||
.> rewrite woot1to2
|
||||
scratch/main> rewrite woot1to2
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> load
|
||||
.> add
|
||||
scratch/main> load
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
After adding the rewritten form to the codebase, here's the rewritten `Woot1` to `Woot2`:
|
||||
|
||||
```ucm
|
||||
.> view wootEx
|
||||
scratch/main> view wootEx
|
||||
```
|
||||
|
||||
This example shows that rewrite rules can to refer to term definitions that only exist in the file:
|
||||
@ -111,15 +111,15 @@ sameFileEx =
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> rewrite rule
|
||||
.> load
|
||||
.> add
|
||||
scratch/main> rewrite rule
|
||||
scratch/main> load
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
After adding the rewritten form to the codebase, here's the rewritten definitions:
|
||||
|
||||
```ucm
|
||||
.> view foo1 foo2 sameFileEx
|
||||
scratch/main> view foo1 foo2 sameFileEx
|
||||
```
|
||||
|
||||
## Capture avoidance
|
||||
@ -145,13 +145,13 @@ sameFileEx =
|
||||
In the above example, `bar2` is locally bound by the rule, so when applied, it should not refer to the `bar2` top level binding.
|
||||
|
||||
```ucm
|
||||
.> rewrite rule
|
||||
scratch/main> rewrite rule
|
||||
```
|
||||
|
||||
Instead, it should be an unbound free variable, which doesn't typecheck:
|
||||
|
||||
```ucm:error
|
||||
.> load
|
||||
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:
|
||||
@ -167,13 +167,13 @@ rule a = @rewrite
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> rewrite rule
|
||||
scratch/main> rewrite rule
|
||||
```
|
||||
|
||||
The `a` introduced will be freshened to not capture the `a` in scope, so it remains as an unbound variable and is a type error:
|
||||
|
||||
```ucm:error
|
||||
.> load
|
||||
scratch/main> load
|
||||
```
|
||||
|
||||
## Structural find
|
||||
@ -183,7 +183,7 @@ eitherEx = Left ("hello", "there")
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
@ -192,7 +192,7 @@ findEitherFailure = @rewrite signature a . Either Failure a ==> ()
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> sfind findEitherEx
|
||||
.> sfind findEitherFailure
|
||||
.> find 1-5
|
||||
scratch/main> sfind findEitherEx
|
||||
scratch/main> sfind findEitherFailure
|
||||
scratch/main> find 1-5
|
||||
```
|
||||
|
@ -2,8 +2,8 @@ This transcript executes very slowly, because the compiler has an
|
||||
entire copy of base (and other stuff) within it.
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
.> pull.without-history unison.public.base.trunk base
|
||||
scratch/main> builtins.merge
|
||||
scratch/main> pull.without-history unison.public.base.trunk base
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -55,7 +55,7 @@ multiAddUp = repeat 35 '(printAddUp 3000000)
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> run singleAddUp
|
||||
.> run.native multiAddUp
|
||||
scratch/main> add
|
||||
scratch/main> run singleAddUp
|
||||
scratch/main> run.native multiAddUp
|
||||
```
|
||||
|
@ -1,13 +1,13 @@
|
||||
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.
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
scratch/main> builtins.mergeio
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> copy.namespace builtin a1.lib.builtin
|
||||
.> copy.namespace builtin a2.lib.builtin
|
||||
.> load unison-src/transcripts-round-trip/reparses-with-same-hash.u
|
||||
scratch/main> copy.namespace builtin a1.lib.builtin
|
||||
scratch/main> copy.namespace builtin a2.lib.builtin
|
||||
scratch/main> load unison-src/transcripts-round-trip/reparses-with-same-hash.u
|
||||
.a1> add
|
||||
```
|
||||
|
||||
@ -41,12 +41,12 @@ So we can see the pretty-printed output:
|
||||
This diff should be empty if the two namespaces are equivalent. If it's nonempty, the diff will show us the hashes that differ.
|
||||
|
||||
```ucm:error
|
||||
.> diff.namespace a1 a2
|
||||
scratch/main> diff.namespace a1 a2
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> undo
|
||||
.> undo
|
||||
scratch/main> undo
|
||||
scratch/main> undo
|
||||
```
|
||||
|
||||
Now check that definitions in 'reparses.u' at least parse on round trip:
|
||||
@ -72,7 +72,7 @@ x = ()
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> move.namespace a3 a3_old
|
||||
scratch/main> move.namespace a3 a3_old
|
||||
.a3> copy.namespace .builtin lib.builtin
|
||||
.a3> load
|
||||
.a3> add
|
||||
@ -83,7 +83,7 @@ x = ()
|
||||
These are currently all expected to have different hashes on round trip.
|
||||
|
||||
```ucm
|
||||
.> diff.namespace a3 a3_old
|
||||
scratch/main> diff.namespace a3 a3_old
|
||||
```
|
||||
|
||||
## Other regression tests not covered by above
|
||||
@ -93,8 +93,8 @@ These are currently all expected to have different hashes on round trip.
|
||||
Regression test for https://github.com/unisonweb/unison/pull/3548
|
||||
|
||||
```ucm:hide
|
||||
.> alias.term ##Nat.+ plus
|
||||
.> edit plus
|
||||
.> load
|
||||
.> undo
|
||||
scratch/main> alias.term ##Nat.+ plus
|
||||
scratch/main> edit plus
|
||||
scratch/main> load
|
||||
scratch/main> undo
|
||||
```
|
||||
|
@ -10,9 +10,9 @@ transcripts which contain less boilerplate.
|
||||
## Usage
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
.> load unison-src/transcripts-using-base/base.u
|
||||
.> add
|
||||
scratch/main> builtins.mergeio
|
||||
scratch/main> load unison-src/transcripts-using-base/base.u
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
The test shows that `hex (fromHex str) == str` as expected.
|
||||
@ -24,7 +24,7 @@ test> hex.tests.ex1 = checks let
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> test
|
||||
scratch/main> test
|
||||
```
|
||||
|
||||
Lets do some basic testing of our test harness to make sure its
|
||||
@ -50,6 +50,6 @@ testAutoClean _ =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test testAutoClean
|
||||
scratch/main> add
|
||||
scratch/main> io.test testAutoClean
|
||||
```
|
||||
|
@ -53,13 +53,13 @@ testAutoClean _ =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
testAutoClean : '{IO} [Result]
|
||||
|
||||
.> io.test testAutoClean
|
||||
scratch/main> io.test testAutoClean
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
This transcript is intended to make visible accidental changes to the hashing algorithm.
|
||||
|
||||
```ucm
|
||||
.> find.verbose
|
||||
scratch/main> find.verbose
|
||||
```
|
||||
|
@ -1,7 +1,7 @@
|
||||
This transcript is intended to make visible accidental changes to the hashing algorithm.
|
||||
|
||||
```ucm
|
||||
.> find.verbose
|
||||
scratch/main> find.verbose
|
||||
|
||||
1. -- #sgesq8035ut22q779pl1g4gqsg8c81894jjonmrq1bjltphkath225up841hk8dku59tnnc4laj9nggbofamgei4klof0ldc20uj2oo
|
||||
<| : (i ->{g} o) -> i ->{g} o
|
||||
|
@ -54,6 +54,6 @@ testABunchOfNats _ =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test testABunchOfNats
|
||||
scratch/main> add
|
||||
scratch/main> io.test testABunchOfNats
|
||||
```
|
||||
|
@ -76,7 +76,7 @@ testABunchOfNats _ =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -91,7 +91,7 @@ testABunchOfNats _ =
|
||||
testNat : Nat -> '{IO, Stream Result} ()
|
||||
testRoundTrip : Nat -> EncDec ->{IO, Stream Result} ()
|
||||
|
||||
.> io.test testABunchOfNats
|
||||
scratch/main> io.test testABunchOfNats
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -153,7 +153,7 @@ swapped name link =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -236,9 +236,9 @@ we gain the ability to capture output in a transcript, it can be modified
|
||||
to actual show that the serialization works.
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test tests
|
||||
.> io.test badLoad
|
||||
scratch/main> add
|
||||
scratch/main> io.test tests
|
||||
scratch/main> io.test badLoad
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -278,8 +278,8 @@ codeTests =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test codeTests
|
||||
scratch/main> add
|
||||
scratch/main> io.test codeTests
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -309,6 +309,6 @@ vtests _ =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test vtests
|
||||
scratch/main> add
|
||||
scratch/main> io.test vtests
|
||||
```
|
||||
|
@ -200,7 +200,7 @@ swapped name link =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -344,7 +344,7 @@ we gain the ability to capture output in a transcript, it can be modified
|
||||
to actual show that the serialization works.
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -360,7 +360,7 @@ to actual show that the serialization works.
|
||||
tests : '{IO} [Result]
|
||||
zapper : Three Nat Nat Nat -> Request {Zap} r -> r
|
||||
|
||||
.> io.test tests
|
||||
scratch/main> io.test tests
|
||||
|
||||
New test results:
|
||||
|
||||
@ -382,7 +382,7 @@ to actual show that the serialization works.
|
||||
|
||||
Tip: Use view tests to view the source of a test.
|
||||
|
||||
.> io.test badLoad
|
||||
scratch/main> io.test badLoad
|
||||
|
||||
New test results:
|
||||
|
||||
@ -443,13 +443,13 @@ codeTests =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
codeTests : '{IO} [Result]
|
||||
|
||||
.> io.test codeTests
|
||||
scratch/main> io.test codeTests
|
||||
|
||||
New test results:
|
||||
|
||||
@ -530,14 +530,14 @@ vtests _ =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
validateTest : Link.Term ->{IO} Result
|
||||
vtests : '{IO} [Result]
|
||||
|
||||
.> io.test vtests
|
||||
scratch/main> io.test vtests
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -33,9 +33,9 @@ Notice that an anonymous documentation block `{{ ... }}` before a definition `Im
|
||||
You can preview what docs will look like when rendered to the console using the `display` or `docs` commands:
|
||||
|
||||
```ucm
|
||||
.> display d1
|
||||
.> docs ImportantConstant
|
||||
.> docs DayOfWeek
|
||||
scratch/main> display d1
|
||||
scratch/main> docs ImportantConstant
|
||||
scratch/main> docs DayOfWeek
|
||||
```
|
||||
|
||||
The `docs ImportantConstant` command will look for `ImportantConstant.doc` in the file or codebase. You can do this instead of explicitly linking docs to definitions.
|
||||
@ -45,11 +45,11 @@ The `docs ImportantConstant` command will look for `ImportantConstant.doc` in th
|
||||
First, we'll load the `syntax.u` file which has examples of all the syntax:
|
||||
|
||||
```ucm
|
||||
.> load ./unison-src/transcripts-using-base/doc.md.files/syntax.u
|
||||
scratch/main> load ./unison-src/transcripts-using-base/doc.md.files/syntax.u
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Now we can review different portions of the guide.
|
||||
@ -57,25 +57,25 @@ we'll show both the pretty-printed source using `view`
|
||||
and the rendered output using `display`:
|
||||
|
||||
```ucm
|
||||
.> view basicFormatting
|
||||
.> display basicFormatting
|
||||
.> view lists
|
||||
.> display lists
|
||||
.> view evaluation
|
||||
.> display evaluation
|
||||
.> view includingSource
|
||||
.> display includingSource
|
||||
.> view nonUnisonCodeBlocks
|
||||
.> display nonUnisonCodeBlocks
|
||||
.> view otherElements
|
||||
.> display otherElements
|
||||
scratch/main> view basicFormatting
|
||||
scratch/main> display basicFormatting
|
||||
scratch/main> view lists
|
||||
scratch/main> display lists
|
||||
scratch/main> view evaluation
|
||||
scratch/main> display evaluation
|
||||
scratch/main> view includingSource
|
||||
scratch/main> display includingSource
|
||||
scratch/main> view nonUnisonCodeBlocks
|
||||
scratch/main> display nonUnisonCodeBlocks
|
||||
scratch/main> view otherElements
|
||||
scratch/main> display otherElements
|
||||
```
|
||||
|
||||
Lastly, it's common to build longer documents including subdocuments via `{{ subdoc }}`. We can stitch together the full syntax guide in this way:
|
||||
|
||||
```ucm
|
||||
.> view doc.guide
|
||||
.> display doc.guide
|
||||
scratch/main> view doc.guide
|
||||
scratch/main> display doc.guide
|
||||
```
|
||||
|
||||
🌻 THE END
|
||||
|
@ -51,15 +51,15 @@ Notice that an anonymous documentation block `{{ ... }}` before a definition `Im
|
||||
You can preview what docs will look like when rendered to the console using the `display` or `docs` commands:
|
||||
|
||||
```ucm
|
||||
.> display d1
|
||||
scratch/main> display d1
|
||||
|
||||
Hello there Alice!
|
||||
|
||||
.> docs ImportantConstant
|
||||
scratch/main> docs ImportantConstant
|
||||
|
||||
An important constant, equal to `42`
|
||||
|
||||
.> docs DayOfWeek
|
||||
scratch/main> docs DayOfWeek
|
||||
|
||||
The 7 days of the week, defined as:
|
||||
|
||||
@ -73,7 +73,7 @@ The `docs ImportantConstant` command will look for `ImportantConstant.doc` in th
|
||||
First, we'll load the `syntax.u` file which has examples of all the syntax:
|
||||
|
||||
```ucm
|
||||
.> load ./unison-src/transcripts-using-base/doc.md.files/syntax.u
|
||||
scratch/main> load ./unison-src/transcripts-using-base/doc.md.files/syntax.u
|
||||
|
||||
Loading changes detected in
|
||||
./unison-src/transcripts-using-base/doc.md.files/syntax.u.
|
||||
@ -100,7 +100,7 @@ we'll show both the pretty-printed source using `view`
|
||||
and the rendered output using `display`:
|
||||
|
||||
```ucm
|
||||
.> view basicFormatting
|
||||
scratch/main> view basicFormatting
|
||||
|
||||
basicFormatting : Doc2
|
||||
basicFormatting =
|
||||
@ -130,7 +130,7 @@ and the rendered output using `display`:
|
||||
__Next up:__ {lists}
|
||||
}}
|
||||
|
||||
.> display basicFormatting
|
||||
scratch/main> display basicFormatting
|
||||
|
||||
# Basic formatting
|
||||
|
||||
@ -155,7 +155,7 @@ and the rendered output using `display`:
|
||||
|
||||
*Next up:* lists
|
||||
|
||||
.> view lists
|
||||
scratch/main> view lists
|
||||
|
||||
lists : Doc2
|
||||
lists =
|
||||
@ -198,7 +198,7 @@ and the rendered output using `display`:
|
||||
3. Get dressed.
|
||||
}}
|
||||
|
||||
.> display lists
|
||||
scratch/main> display lists
|
||||
|
||||
# Lists
|
||||
|
||||
@ -237,7 +237,7 @@ and the rendered output using `display`:
|
||||
2. Take shower.
|
||||
3. Get dressed.
|
||||
|
||||
.> view evaluation
|
||||
scratch/main> view evaluation
|
||||
|
||||
evaluation : Doc2
|
||||
evaluation =
|
||||
@ -272,7 +272,7 @@ and the rendered output using `display`:
|
||||
```
|
||||
}}
|
||||
|
||||
.> display evaluation
|
||||
scratch/main> display evaluation
|
||||
|
||||
# Evaluation
|
||||
|
||||
@ -300,7 +300,7 @@ and the rendered output using `display`:
|
||||
cube : Nat -> Nat
|
||||
cube x = x * x * x
|
||||
|
||||
.> view includingSource
|
||||
scratch/main> view includingSource
|
||||
|
||||
includingSource : Doc2
|
||||
includingSource =
|
||||
@ -341,7 +341,7 @@ and the rendered output using `display`:
|
||||
{{ docExample 1 do x -> sqr x }}.
|
||||
}}
|
||||
|
||||
.> display includingSource
|
||||
scratch/main> display includingSource
|
||||
|
||||
# Including Unison source code
|
||||
|
||||
@ -387,7 +387,7 @@ and the rendered output using `display`:
|
||||
application, you can put it in double backticks, like
|
||||
so: `sqr x`. This is equivalent to `sqr x`.
|
||||
|
||||
.> view nonUnisonCodeBlocks
|
||||
scratch/main> view nonUnisonCodeBlocks
|
||||
|
||||
nonUnisonCodeBlocks : Doc2
|
||||
nonUnisonCodeBlocks =
|
||||
@ -420,7 +420,7 @@ and the rendered output using `display`:
|
||||
```
|
||||
}}
|
||||
|
||||
.> display nonUnisonCodeBlocks
|
||||
scratch/main> display nonUnisonCodeBlocks
|
||||
|
||||
# Non-Unison code blocks
|
||||
|
||||
@ -449,7 +449,7 @@ and the rendered output using `display`:
|
||||
xs.foldLeft(Nil : List[A])((acc,a) => a +: acc)
|
||||
```
|
||||
|
||||
.> view otherElements
|
||||
scratch/main> view otherElements
|
||||
|
||||
otherElements : Doc2
|
||||
otherElements =
|
||||
@ -506,7 +506,7 @@ and the rendered output using `display`:
|
||||
] }}
|
||||
}}
|
||||
|
||||
.> display otherElements
|
||||
scratch/main> display otherElements
|
||||
|
||||
There are also asides, callouts, tables, tooltips, and more.
|
||||
These don't currently have special syntax; just use the
|
||||
@ -549,7 +549,7 @@ and the rendered output using `display`:
|
||||
Lastly, it's common to build longer documents including subdocuments via `{{ subdoc }}`. We can stitch together the full syntax guide in this way:
|
||||
|
||||
```ucm
|
||||
.> view doc.guide
|
||||
scratch/main> view doc.guide
|
||||
|
||||
doc.guide : Doc2
|
||||
doc.guide =
|
||||
@ -569,7 +569,7 @@ Lastly, it's common to build longer documents including subdocuments via `{{ sub
|
||||
{{ otherElements }}
|
||||
}}
|
||||
|
||||
.> display doc.guide
|
||||
scratch/main> display doc.guide
|
||||
|
||||
# Unison computable documentation
|
||||
|
||||
|
@ -19,13 +19,13 @@ test2 = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```ucm:error
|
||||
.> io.test test1
|
||||
scratch/main> io.test test1
|
||||
```
|
||||
|
||||
```ucm:error
|
||||
.> io.test test2
|
||||
scratch/main> io.test test2
|
||||
```
|
||||
|
@ -33,7 +33,7 @@ test2 = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -42,7 +42,7 @@ test2 = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> io.test test1
|
||||
scratch/main> io.test test1
|
||||
|
||||
💔💥
|
||||
|
||||
@ -58,7 +58,7 @@ test2 = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> io.test test2
|
||||
scratch/main> io.test test2
|
||||
|
||||
💔💥
|
||||
|
||||
|
@ -10,5 +10,5 @@ timingApp2 _ =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> run timingApp2
|
||||
scratch/main> run timingApp2
|
||||
```
|
||||
|
@ -23,7 +23,7 @@ timingApp2 _ =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> run timingApp2
|
||||
scratch/main> run timingApp2
|
||||
|
||||
()
|
||||
|
||||
|
@ -6,7 +6,7 @@ meh = 9
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> find meh
|
||||
.> docs 1
|
||||
scratch/main> add
|
||||
scratch/main> find meh
|
||||
scratch/main> docs 1
|
||||
```
|
||||
|
@ -20,20 +20,20 @@ meh = 9
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
meh : Nat
|
||||
meh.doc : Doc2
|
||||
|
||||
.> find meh
|
||||
scratch/main> find meh
|
||||
|
||||
1. meh : Nat
|
||||
2. meh.doc : Doc2
|
||||
|
||||
|
||||
.> docs 1
|
||||
scratch/main> docs 1
|
||||
|
||||
A simple doc.
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
Unison has cryptographic builtins for hashing and computing [HMACs](https://en.wikipedia.org/wiki/HMAC) (hash-based message authentication codes). This transcript shows their usage and has some test cases.
|
||||
|
||||
```ucm
|
||||
.> ls builtin.Bytes
|
||||
scratch/main> ls builtin.Bytes
|
||||
```
|
||||
Notice the `fromBase16` and `toBase16` functions. Here's some convenience functions for converting `Bytes` to and from base-16 `Text`.
|
||||
|
||||
@ -43,7 +43,7 @@ ex5 = crypto.hmac Sha2_256 mysecret f |> hex
|
||||
And here's the full API:
|
||||
|
||||
```ucm
|
||||
.> find-in builtin.crypto
|
||||
scratch/main> find-in builtin.crypto
|
||||
```
|
||||
|
||||
Note that the universal versions of `hash` and `hmac` are currently unimplemented and will bomb at runtime:
|
||||
@ -189,11 +189,11 @@ test> crypto.hash.numTests =
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> test
|
||||
scratch/main> test
|
||||
```
|
||||
|
||||
## HMAC tests
|
||||
@ -251,9 +251,9 @@ test> md5.tests.ex3 =
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> test
|
||||
scratch/main> test
|
||||
```
|
||||
|
@ -3,7 +3,7 @@
|
||||
Unison has cryptographic builtins for hashing and computing [HMACs](https://en.wikipedia.org/wiki/HMAC) (hash-based message authentication codes). This transcript shows their usage and has some test cases.
|
||||
|
||||
```ucm
|
||||
.> ls builtin.Bytes
|
||||
scratch/main> ls builtin.Bytes
|
||||
|
||||
1. ++ (Bytes -> Bytes -> Bytes)
|
||||
2. at (Nat -> Bytes -> Optional Nat)
|
||||
@ -120,7 +120,7 @@ ex5 = crypto.hmac Sha2_256 mysecret f |> hex
|
||||
And here's the full API:
|
||||
|
||||
```ucm
|
||||
.> find-in builtin.crypto
|
||||
scratch/main> find-in builtin.crypto
|
||||
|
||||
1. type CryptoFailure
|
||||
2. Ed25519.sign.impl : Bytes
|
||||
@ -312,7 +312,7 @@ test> crypto.hash.numTests =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> test
|
||||
scratch/main> test
|
||||
|
||||
Cached test results (`help testcache` to learn more)
|
||||
|
||||
@ -475,7 +475,7 @@ test> md5.tests.ex3 =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> test
|
||||
scratch/main> test
|
||||
|
||||
Cached test results (`help testcache` to learn more)
|
||||
|
||||
|
@ -51,7 +51,7 @@ testMvars _ =
|
||||
runTest test
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test testMvars
|
||||
scratch/main> add
|
||||
scratch/main> io.test testMvars
|
||||
```
|
||||
|
||||
|
@ -66,14 +66,14 @@ testMvars _ =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
eitherCk : (a ->{g} Boolean) -> Either e a ->{g} Boolean
|
||||
testMvars : '{IO} [Result]
|
||||
|
||||
.> io.test testMvars
|
||||
scratch/main> io.test testMvars
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -33,6 +33,6 @@ test = 'let
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test test
|
||||
scratch/main> add
|
||||
scratch/main> io.test test
|
||||
```
|
||||
|
@ -49,7 +49,7 @@ test = 'let
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -59,7 +59,7 @@ test = 'let
|
||||
-> Optional Float
|
||||
->{Stream Result} ()
|
||||
|
||||
.> io.test test
|
||||
scratch/main> io.test test
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -10,7 +10,7 @@ socketAccept = compose reraise socketAccept.impl
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
# Tests for network related builtins
|
||||
@ -93,8 +93,8 @@ testDefaultPort _ =
|
||||
runTest test
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test testDefaultPort
|
||||
scratch/main> add
|
||||
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.
|
||||
@ -149,6 +149,6 @@ testTcpConnect = 'let
|
||||
```
|
||||
```ucm
|
||||
|
||||
.> add
|
||||
.> io.test testTcpConnect
|
||||
scratch/main> add
|
||||
scratch/main> io.test testTcpConnect
|
||||
```
|
||||
|
@ -107,7 +107,7 @@ testDefaultPort _ =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -115,7 +115,7 @@ testDefaultPort _ =
|
||||
testDefaultPort : '{IO} [Result]
|
||||
testExplicitHost : '{IO} [Result]
|
||||
|
||||
.> io.test testDefaultPort
|
||||
scratch/main> io.test testDefaultPort
|
||||
|
||||
New test results:
|
||||
|
||||
@ -194,7 +194,7 @@ testTcpConnect = 'let
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -202,7 +202,7 @@ testTcpConnect = 'let
|
||||
serverThread : MVar Nat -> Text -> '{IO} ()
|
||||
testTcpConnect : '{IO} [Result]
|
||||
|
||||
.> io.test testTcpConnect
|
||||
scratch/main> io.test testTcpConnect
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -56,6 +56,6 @@ serialTests = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test serialTests
|
||||
scratch/main> add
|
||||
scratch/main> io.test serialTests
|
||||
```
|
||||
|
@ -74,7 +74,7 @@ serialTests = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -85,7 +85,7 @@ serialTests = do
|
||||
serialTests : '{IO, Exception} [Result]
|
||||
shuffle : Nat -> [a] -> [a]
|
||||
|
||||
.> io.test serialTests
|
||||
scratch/main> io.test serialTests
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -19,8 +19,8 @@ casTest = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test casTest
|
||||
scratch/main> add
|
||||
scratch/main> io.test casTest
|
||||
```
|
||||
|
||||
Promise is a simple one-shot awaitable condition.
|
||||
@ -54,9 +54,9 @@ promiseConcurrentTest = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test promiseSequentialTest
|
||||
.> io.test promiseConcurrentTest
|
||||
scratch/main> add
|
||||
scratch/main> io.test promiseSequentialTest
|
||||
scratch/main> io.test promiseConcurrentTest
|
||||
```
|
||||
|
||||
CAS can be used to write an atomic update function.
|
||||
@ -70,7 +70,7 @@ atomicUpdate ref f =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Promise can be used to write an operation that spawns N concurrent
|
||||
@ -91,7 +91,7 @@ spawnN n fa =
|
||||
map Promise.read (go n [])
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
We can use these primitives to write a more interesting example, where
|
||||
@ -123,6 +123,6 @@ fullTest = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test fullTest
|
||||
scratch/main> add
|
||||
scratch/main> io.test fullTest
|
||||
```
|
||||
|
@ -32,13 +32,13 @@ casTest = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
casTest : '{IO} [Result]
|
||||
|
||||
.> io.test casTest
|
||||
scratch/main> io.test casTest
|
||||
|
||||
New test results:
|
||||
|
||||
@ -95,14 +95,14 @@ promiseConcurrentTest = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
promiseConcurrentTest : '{IO} [Result]
|
||||
promiseSequentialTest : '{IO} [Result]
|
||||
|
||||
.> io.test promiseSequentialTest
|
||||
scratch/main> io.test promiseSequentialTest
|
||||
|
||||
New test results:
|
||||
|
||||
@ -114,7 +114,7 @@ promiseConcurrentTest = do
|
||||
Tip: Use view promiseSequentialTest to view the source of a
|
||||
test.
|
||||
|
||||
.> io.test promiseConcurrentTest
|
||||
scratch/main> io.test promiseConcurrentTest
|
||||
|
||||
New test results:
|
||||
|
||||
@ -150,7 +150,7 @@ atomicUpdate ref f =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -189,7 +189,7 @@ spawnN n fa =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -238,13 +238,13 @@ fullTest = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
fullTest : '{IO} [Result]
|
||||
|
||||
.> io.test fullTest
|
||||
scratch/main> io.test fullTest
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -68,6 +68,6 @@ mkTestCase = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> run mkTestCase
|
||||
scratch/main> add
|
||||
scratch/main> run mkTestCase
|
||||
```
|
||||
|
@ -95,7 +95,7 @@ mkTestCase = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -115,7 +115,7 @@ mkTestCase = do
|
||||
tree2 : Tree Nat
|
||||
tree3 : Tree Text
|
||||
|
||||
.> run mkTestCase
|
||||
scratch/main> run mkTestCase
|
||||
|
||||
()
|
||||
|
||||
|
@ -16,6 +16,6 @@ mkTestCase = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> run mkTestCase
|
||||
scratch/main> add
|
||||
scratch/main> run mkTestCase
|
||||
```
|
||||
|
@ -33,7 +33,7 @@ mkTestCase = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -43,7 +43,7 @@ mkTestCase = do
|
||||
l3 : [Char]
|
||||
mkTestCase : '{IO, Exception} ()
|
||||
|
||||
.> run mkTestCase
|
||||
scratch/main> run mkTestCase
|
||||
|
||||
()
|
||||
|
||||
|
@ -30,6 +30,6 @@ mkTestCase = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> run mkTestCase
|
||||
scratch/main> add
|
||||
scratch/main> run mkTestCase
|
||||
```
|
||||
|
@ -49,7 +49,7 @@ mkTestCase = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -61,7 +61,7 @@ mkTestCase = do
|
||||
prod : [Nat] -> Nat
|
||||
products : ([Nat], [Nat], [Nat]) -> Text
|
||||
|
||||
.> run mkTestCase
|
||||
scratch/main> run mkTestCase
|
||||
|
||||
()
|
||||
|
||||
|
@ -44,6 +44,6 @@ mkTestCase = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> run mkTestCase
|
||||
scratch/main> add
|
||||
scratch/main> run mkTestCase
|
||||
```
|
||||
|
@ -68,7 +68,7 @@ mkTestCase = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -84,7 +84,7 @@ mkTestCase = do
|
||||
reset : '{DC r} r -> r
|
||||
suspSum : [Nat] -> Delayed Nat
|
||||
|
||||
.> run mkTestCase
|
||||
scratch/main> run mkTestCase
|
||||
|
||||
()
|
||||
|
||||
|
@ -14,6 +14,6 @@ mkTestCase = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> run mkTestCase
|
||||
scratch/main> add
|
||||
scratch/main> run mkTestCase
|
||||
```
|
||||
|
@ -28,7 +28,7 @@ mkTestCase = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -36,7 +36,7 @@ mkTestCase = do
|
||||
mutual0 : Nat -> Text
|
||||
mutual1 : Nat -> Text
|
||||
|
||||
.> run mkTestCase
|
||||
scratch/main> run mkTestCase
|
||||
|
||||
()
|
||||
|
||||
|
@ -28,7 +28,7 @@ body k out v =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Test case.
|
||||
@ -67,6 +67,6 @@ tests = '(map spawn nats)
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test tests
|
||||
scratch/main> add
|
||||
scratch/main> io.test tests
|
||||
```
|
||||
|
@ -44,7 +44,7 @@ body k out v =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -106,7 +106,7 @@ tests = '(map spawn nats)
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -115,7 +115,7 @@ tests = '(map spawn nats)
|
||||
spawn : Nat ->{IO} Result
|
||||
tests : '{IO} [Result]
|
||||
|
||||
.> io.test tests
|
||||
scratch/main> io.test tests
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -9,7 +9,7 @@ x = 999
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Now, we update that definition and define a test-watch which depends on it.
|
||||
@ -22,7 +22,7 @@ test> mytest = checks [x + 1 == 1001]
|
||||
We expect this 'add' to fail because the test is blocked by the update to `x`.
|
||||
|
||||
```ucm:error
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
---
|
||||
@ -35,5 +35,5 @@ test> useY = checks [y + 1 == 43]
|
||||
This should correctly identify `y` as a dependency and add that too.
|
||||
|
||||
```ucm
|
||||
.> add useY
|
||||
scratch/main> add useY
|
||||
```
|
||||
|
@ -43,7 +43,7 @@ test> mytest = checks [x + 1 == 1001]
|
||||
We expect this 'add' to fail because the test is blocked by the update to `x`.
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
x These definitions failed:
|
||||
|
||||
@ -85,7 +85,7 @@ test> useY = checks [y + 1 == 43]
|
||||
This should correctly identify `y` as a dependency and add that too.
|
||||
|
||||
```ucm
|
||||
.> add useY
|
||||
scratch/main> add useY
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
|
@ -19,8 +19,8 @@ testBasicFork = 'let
|
||||
See if we can get another thread to stuff a value into a MVar
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
.> io.test testBasicFork
|
||||
scratch/main> add
|
||||
scratch/main> io.test testBasicFork
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -48,8 +48,8 @@ testBasicMultiThreadMVar = 'let
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test testBasicMultiThreadMVar
|
||||
scratch/main> add
|
||||
scratch/main> io.test testBasicMultiThreadMVar
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -91,6 +91,6 @@ testTwoThreads = 'let
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test testTwoThreads
|
||||
scratch/main> add
|
||||
scratch/main> io.test testTwoThreads
|
||||
```
|
||||
|
@ -71,14 +71,14 @@ testBasicMultiThreadMVar = 'let
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
testBasicMultiThreadMVar : '{IO} [Result]
|
||||
thread1 : Nat -> MVar Nat -> '{IO} ()
|
||||
|
||||
.> io.test testBasicMultiThreadMVar
|
||||
scratch/main> io.test testBasicMultiThreadMVar
|
||||
|
||||
New test results:
|
||||
|
||||
@ -145,7 +145,7 @@ testTwoThreads = 'let
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -154,7 +154,7 @@ testTwoThreads = 'let
|
||||
(also named thread1)
|
||||
testTwoThreads : '{IO} [Result]
|
||||
|
||||
.> io.test testTwoThreads
|
||||
scratch/main> io.test testTwoThreads
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -12,7 +12,7 @@ not_a_cert = "-----BEGIN SCHERMIFICATE-----\n-----END SCHERMIFICATE-----"
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
# Using an alternative certificate store
|
||||
@ -32,8 +32,8 @@ what_should_work _ = this_should_work ++ this_should_not_work
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test what_should_work
|
||||
scratch/main> add
|
||||
scratch/main> io.test what_should_work
|
||||
```
|
||||
|
||||
Test handshaking a client/server a local TCP connection using our
|
||||
@ -191,8 +191,8 @@ testCNReject _ =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test testConnectSelfSigned
|
||||
.> io.test testCAReject
|
||||
.> io.test testCNReject
|
||||
scratch/main> add
|
||||
scratch/main> io.test testConnectSelfSigned
|
||||
scratch/main> io.test testCAReject
|
||||
scratch/main> io.test testCNReject
|
||||
```
|
||||
|
@ -43,7 +43,7 @@ what_should_work _ = this_should_work ++ this_should_not_work
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -51,7 +51,7 @@ what_should_work _ = this_should_work ++ this_should_not_work
|
||||
this_should_work : [Result]
|
||||
what_should_work : ∀ _. _ -> [Result]
|
||||
|
||||
.> io.test what_should_work
|
||||
scratch/main> io.test what_should_work
|
||||
|
||||
New test results:
|
||||
|
||||
@ -238,7 +238,7 @@ testCNReject _ =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -251,7 +251,7 @@ testCNReject _ =
|
||||
-> '{IO, Exception} Text
|
||||
testConnectSelfSigned : '{IO} [Result]
|
||||
|
||||
.> io.test testConnectSelfSigned
|
||||
scratch/main> io.test testConnectSelfSigned
|
||||
|
||||
New test results:
|
||||
|
||||
@ -262,7 +262,7 @@ testCNReject _ =
|
||||
Tip: Use view testConnectSelfSigned to view the source of a
|
||||
test.
|
||||
|
||||
.> io.test testCAReject
|
||||
scratch/main> io.test testCAReject
|
||||
|
||||
New test results:
|
||||
|
||||
@ -272,7 +272,7 @@ testCNReject _ =
|
||||
|
||||
Tip: Use view testCAReject to view the source of a test.
|
||||
|
||||
.> io.test testCNReject
|
||||
scratch/main> io.test testCNReject
|
||||
|
||||
New test results:
|
||||
|
||||
|
@ -3,7 +3,7 @@ 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.
|
||||
|
||||
```ucm
|
||||
.> find Utf8
|
||||
scratch/main> find Utf8
|
||||
```
|
||||
|
||||
ascii characters are encoded as single bytes (in the range 0-127).
|
||||
|
@ -3,7 +3,7 @@ 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.
|
||||
|
||||
```ucm
|
||||
.> find Utf8
|
||||
scratch/main> find Utf8
|
||||
|
||||
1. builtin.Text.toUtf8 : Text -> Bytes
|
||||
2. Text.fromUtf8 : Bytes ->{Exception} Text
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge
|
||||
```
|
||||
|
||||
Some random ability stuff to ensure things work.
|
||||
@ -23,5 +23,5 @@ ha = cases
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
@ -32,7 +32,7 @@ ha = cases
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
|
@ -15,6 +15,6 @@ term2 _ = ()
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> names term1
|
||||
scratch/main> add
|
||||
scratch/main> names term1
|
||||
```
|
||||
|
@ -31,7 +31,7 @@ term2 _ = ()
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -40,7 +40,7 @@ term2 _ = ()
|
||||
term1 : '{Bar, Foo} ()
|
||||
term2 : '{Bar, Foo} ()
|
||||
|
||||
.> names term1
|
||||
scratch/main> names term1
|
||||
|
||||
Term
|
||||
Hash: #8hum58rlih
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Basic usage
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -20,26 +20,26 @@ is2even = '(even 2)
|
||||
it errors if there isn't a previous run
|
||||
|
||||
```ucm:error
|
||||
.> add.run foo
|
||||
scratch/main> add.run foo
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> run is2even
|
||||
scratch/main> run is2even
|
||||
```
|
||||
|
||||
it errors if the desired result name conflicts with a name in the
|
||||
unison file
|
||||
```ucm:error
|
||||
.> add.run is2even
|
||||
scratch/main> add.run is2even
|
||||
```
|
||||
|
||||
otherwise, the result is successfully persisted
|
||||
```ucm
|
||||
.> add.run foo.bar.baz
|
||||
scratch/main> add.run foo.bar.baz
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> view foo.bar.baz
|
||||
scratch/main> view foo.bar.baz
|
||||
```
|
||||
|
||||
## It resolves references within the unison file
|
||||
@ -56,8 +56,8 @@ main _ = y
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> run main
|
||||
.> add.run result
|
||||
scratch/main> run main
|
||||
scratch/main> add.run result
|
||||
```
|
||||
|
||||
## It resolves references within the codebase
|
||||
@ -68,7 +68,7 @@ inc x = x + 1
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add inc
|
||||
scratch/main> add inc
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -77,9 +77,9 @@ main _ x = inc x
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> run main
|
||||
.> add.run natfoo
|
||||
.> view natfoo
|
||||
scratch/main> run main
|
||||
scratch/main> add.run natfoo
|
||||
scratch/main> view natfoo
|
||||
```
|
||||
|
||||
## It captures scratch file dependencies at run time
|
||||
@ -91,7 +91,7 @@ main = 'y
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> run main
|
||||
scratch/main> run main
|
||||
```
|
||||
|
||||
|
||||
@ -101,8 +101,8 @@ x = 50
|
||||
|
||||
this saves 2 to xres, rather than 100
|
||||
```ucm
|
||||
.> add.run xres
|
||||
.> view xres
|
||||
scratch/main> add.run xres
|
||||
scratch/main> view xres
|
||||
```
|
||||
|
||||
## It fails with a message if add cannot complete cleanly
|
||||
@ -112,8 +112,8 @@ main = '5
|
||||
```
|
||||
|
||||
```ucm:error
|
||||
.> run main
|
||||
.> add.run xres
|
||||
scratch/main> run main
|
||||
scratch/main> add.run xres
|
||||
```
|
||||
|
||||
## It works with absolute names
|
||||
|
@ -31,7 +31,7 @@ is2even = '(even 2)
|
||||
it errors if there isn't a previous run
|
||||
|
||||
```ucm
|
||||
.> add.run foo
|
||||
scratch/main> add.run foo
|
||||
|
||||
⚠️
|
||||
|
||||
@ -40,7 +40,7 @@ it errors if there isn't a previous run
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> run is2even
|
||||
scratch/main> run is2even
|
||||
|
||||
true
|
||||
|
||||
@ -48,7 +48,7 @@ it errors if there isn't a previous run
|
||||
it errors if the desired result name conflicts with a name in the
|
||||
unison file
|
||||
```ucm
|
||||
.> add.run is2even
|
||||
scratch/main> add.run is2even
|
||||
|
||||
⚠️
|
||||
|
||||
@ -58,7 +58,7 @@ unison file
|
||||
```
|
||||
otherwise, the result is successfully persisted
|
||||
```ucm
|
||||
.> add.run foo.bar.baz
|
||||
scratch/main> add.run foo.bar.baz
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -66,7 +66,7 @@ otherwise, the result is successfully persisted
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> view foo.bar.baz
|
||||
scratch/main> view foo.bar.baz
|
||||
|
||||
foo.bar.baz : Boolean
|
||||
foo.bar.baz = true
|
||||
@ -101,11 +101,11 @@ main _ = y
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> run main
|
||||
scratch/main> run main
|
||||
|
||||
a b -> a Nat.+ b Nat.+ z 10
|
||||
|
||||
.> add.run result
|
||||
scratch/main> add.run result
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -134,7 +134,7 @@ inc x = x + 1
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add inc
|
||||
scratch/main> add inc
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -160,17 +160,17 @@ main _ x = inc x
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> run main
|
||||
scratch/main> run main
|
||||
|
||||
inc
|
||||
|
||||
.> add.run natfoo
|
||||
scratch/main> add.run natfoo
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
natfoo : Nat -> Nat
|
||||
|
||||
.> view natfoo
|
||||
scratch/main> view natfoo
|
||||
|
||||
natfoo : Nat -> Nat
|
||||
natfoo = inc
|
||||
@ -200,7 +200,7 @@ main = 'y
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> run main
|
||||
scratch/main> run main
|
||||
|
||||
2
|
||||
|
||||
@ -224,13 +224,13 @@ x = 50
|
||||
```
|
||||
this saves 2 to xres, rather than 100
|
||||
```ucm
|
||||
.> add.run xres
|
||||
scratch/main> add.run xres
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
xres : Nat
|
||||
|
||||
.> view xres
|
||||
scratch/main> view xres
|
||||
|
||||
xres : Nat
|
||||
xres = 2
|
||||
@ -256,11 +256,11 @@ main = '5
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> run main
|
||||
scratch/main> run main
|
||||
|
||||
5
|
||||
|
||||
.> add.run xres
|
||||
scratch/main> add.run xres
|
||||
|
||||
x These definitions failed:
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
scratch/main> builtins.mergeio
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
@ -10,6 +10,6 @@ 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!
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> view foo
|
||||
scratch/main> add
|
||||
scratch/main> view foo
|
||||
```
|
||||
|
@ -6,13 +6,13 @@ 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!
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
foo : [Result]
|
||||
|
||||
.> view foo
|
||||
scratch/main> view foo
|
||||
|
||||
foo : [Result]
|
||||
foo : [Result]
|
||||
|
@ -3,7 +3,7 @@
|
||||
Let's set up some definitions to start:
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -17,7 +17,7 @@ structural type Y = Two Nat Nat
|
||||
Expected: `x` and `y`, `X`, and `Y` exist as above. UCM tells you this.
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Let's add an alias for `1` and `One`:
|
||||
@ -32,7 +32,7 @@ Expected: `z` is now `1`. UCM tells you that this definition is also called `x`.
|
||||
Also, `Z` is an alias for `X`.
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Let's update something that has an alias (to a value that doesn't have a name already):
|
||||
@ -45,7 +45,7 @@ structural type X = Three Nat Nat Nat
|
||||
Expected: `x` is now `3` and `X` has constructor `Three`. UCM tells you the old definitions were also called `z` and `Z` and these names have also been updated.
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
scratch/main> update
|
||||
```
|
||||
|
||||
Update it to something that already exists with a different name:
|
||||
@ -58,6 +58,6 @@ structural type X = Two Nat Nat
|
||||
Expected: `x` is now `2` and `X` is `Two`. UCM says the old definition was also named `z/Z`, and was also updated. And it says the new definition is also named `y/Y`.
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
scratch/main> update
|
||||
```
|
||||
|
||||
|
@ -29,7 +29,7 @@ structural type Y = Two Nat Nat
|
||||
Expected: `x` and `y`, `X`, and `Y` exist as above. UCM tells you this.
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -67,7 +67,7 @@ Expected: `z` is now `1`. UCM tells you that this definition is also called `x`.
|
||||
Also, `Z` is an alias for `X`.
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -104,7 +104,7 @@ structural type X = Three Nat Nat Nat
|
||||
Expected: `x` is now `3` and `X` has constructor `Three`. UCM tells you the old definitions were also called `z` and `Z` and these names have also been updated.
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
scratch/main> update
|
||||
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
@ -143,7 +143,7 @@ structural type X = Two Nat Nat
|
||||
Expected: `x` is now `2` and `X` is `Two`. UCM says the old definition was also named `z/Z`, and was also updated. And it says the new definition is also named `y/Y`.
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
scratch/main> update
|
||||
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
@ -1,5 +1,5 @@
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge lib.builtins
|
||||
```
|
||||
```unison:hide:all
|
||||
List.adjacentPairs : [a] -> [(a, a)]
|
||||
@ -95,14 +95,14 @@ List.takeWhile p xs =
|
||||
go xs []
|
||||
```
|
||||
```ucm:hide
|
||||
.stuff> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
.> help alias.many
|
||||
scratch/main> help alias.many
|
||||
|
||||
alias.many (or copy)
|
||||
`alias.many <relative1> [relative2...] <namespace>` creates aliases `relative1`, `relative2`, ...
|
||||
@ -113,8 +113,8 @@ The names that will be used in the target namespace are the names you specify, r
|
||||
Let's try it!
|
||||
|
||||
```ucm
|
||||
.> alias.many stuff.List.adjacentPairs stuff.List.all stuff.List.any stuff.List.chunk stuff.List.chunksOf stuff.List.dropWhile stuff.List.first stuff.List.init stuff.List.intersperse stuff.List.isEmpty stuff.List.last stuff.List.replicate stuff.List.splitAt stuff.List.tail stuff.List.takeWhile .mylib
|
||||
.> find-in mylib
|
||||
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
|
||||
scratch/main> find-in mylib
|
||||
```
|
||||
|
||||
Thanks, `alias.many`!
|
||||
|
@ -1,8 +1,8 @@
|
||||
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:
|
||||
|
||||
```
|
||||
.> help alias.many
|
||||
```scratch
|
||||
/main> help alias.many
|
||||
|
||||
alias.many (or copy)
|
||||
`alias.many <relative1> [relative2...] <namespace>` creates aliases `relative1`, `relative2`, ...
|
||||
@ -14,55 +14,51 @@ The names that will be used in the target namespace are the names you specify, r
|
||||
Let's try it!
|
||||
|
||||
```ucm
|
||||
.> alias.many stuff.List.adjacentPairs stuff.List.all stuff.List.any stuff.List.chunk stuff.List.chunksOf stuff.List.dropWhile stuff.List.first stuff.List.init stuff.List.intersperse stuff.List.isEmpty stuff.List.last stuff.List.replicate stuff.List.splitAt stuff.List.tail stuff.List.takeWhile .mylib
|
||||
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
|
||||
|
||||
Here's what changed in .mylib :
|
||||
Here's what changed in mylib :
|
||||
|
||||
Added definitions:
|
||||
|
||||
1. stuff.List.adjacentPairs : [a] -> [(a, a)]
|
||||
2. stuff.List.all : (a ->{g} Boolean)
|
||||
-> [a]
|
||||
->{g} Boolean
|
||||
3. stuff.List.any : (a ->{g} Boolean)
|
||||
-> [a]
|
||||
->{g} Boolean
|
||||
4. stuff.List.chunk : Nat -> [a] -> [[a]]
|
||||
5. stuff.List.chunksOf : Nat -> [a] -> [[a]]
|
||||
6. stuff.List.dropWhile : (a ->{g} Boolean)
|
||||
-> [a]
|
||||
->{g} [a]
|
||||
7. stuff.List.first : [a] -> Optional a
|
||||
8. stuff.List.init : [a] -> Optional [a]
|
||||
9. stuff.List.intersperse : a -> [a] -> [a]
|
||||
10. stuff.List.isEmpty : [a] -> Boolean
|
||||
11. stuff.List.last : [a] -> Optional a
|
||||
12. stuff.List.replicate : Nat -> a -> [a]
|
||||
13. stuff.List.splitAt : Nat -> [a] -> ([a], [a])
|
||||
14. stuff.List.tail : [a] -> Optional [a]
|
||||
15. stuff.List.takeWhile : (a ->{𝕖} Boolean)
|
||||
-> [a]
|
||||
->{𝕖} [a]
|
||||
1. List.adjacentPairs : [a] -> [(a, a)]
|
||||
2. List.all : (a ->{g} Boolean)
|
||||
-> [a]
|
||||
->{g} Boolean
|
||||
3. List.any : (a ->{g} Boolean)
|
||||
-> [a]
|
||||
->{g} Boolean
|
||||
4. List.chunk : Nat -> [a] -> [[a]]
|
||||
5. List.chunksOf : Nat -> [a] -> [[a]]
|
||||
6. List.dropWhile : (a ->{g} Boolean) -> [a] ->{g} [a]
|
||||
7. List.first : [a] -> Optional a
|
||||
8. List.init : [a] -> Optional [a]
|
||||
9. List.intersperse : a -> [a] -> [a]
|
||||
10. List.isEmpty : [a] -> Boolean
|
||||
11. List.last : [a] -> Optional a
|
||||
12. List.replicate : Nat -> a -> [a]
|
||||
13. List.splitAt : Nat -> [a] -> ([a], [a])
|
||||
14. List.tail : [a] -> Optional [a]
|
||||
15. List.takeWhile : (a ->{𝕖} Boolean) -> [a] ->{𝕖} [a]
|
||||
|
||||
Tip: You can use `undo` or `reflog` to undo this change.
|
||||
|
||||
.> find-in mylib
|
||||
scratch/main> find-in mylib
|
||||
|
||||
1. stuff.List.adjacentPairs : [a] -> [(a, a)]
|
||||
2. stuff.List.all : (a ->{g} Boolean) -> [a] ->{g} Boolean
|
||||
3. stuff.List.any : (a ->{g} Boolean) -> [a] ->{g} Boolean
|
||||
4. stuff.List.chunk : Nat -> [a] -> [[a]]
|
||||
5. stuff.List.chunksOf : Nat -> [a] -> [[a]]
|
||||
6. stuff.List.dropWhile : (a ->{g} Boolean) -> [a] ->{g} [a]
|
||||
7. stuff.List.first : [a] -> Optional a
|
||||
8. stuff.List.init : [a] -> Optional [a]
|
||||
9. stuff.List.intersperse : a -> [a] -> [a]
|
||||
10. stuff.List.isEmpty : [a] -> Boolean
|
||||
11. stuff.List.last : [a] -> Optional a
|
||||
12. stuff.List.replicate : Nat -> a -> [a]
|
||||
13. stuff.List.splitAt : Nat -> [a] -> ([a], [a])
|
||||
14. stuff.List.tail : [a] -> Optional [a]
|
||||
15. stuff.List.takeWhile : (a ->{𝕖} Boolean) -> [a] ->{𝕖} [a]
|
||||
1. List.adjacentPairs : [a] -> [(a, a)]
|
||||
2. List.all : (a ->{g} Boolean) -> [a] ->{g} Boolean
|
||||
3. List.any : (a ->{g} Boolean) -> [a] ->{g} Boolean
|
||||
4. List.chunk : Nat -> [a] -> [[a]]
|
||||
5. List.chunksOf : Nat -> [a] -> [[a]]
|
||||
6. List.dropWhile : (a ->{g} Boolean) -> [a] ->{g} [a]
|
||||
7. List.first : [a] -> Optional a
|
||||
8. List.init : [a] -> Optional [a]
|
||||
9. List.intersperse : a -> [a] -> [a]
|
||||
10. List.isEmpty : [a] -> Boolean
|
||||
11. List.last : [a] -> Optional a
|
||||
12. List.replicate : Nat -> a -> [a]
|
||||
13. List.splitAt : Nat -> [a] -> ([a], [a])
|
||||
14. List.tail : [a] -> Optional [a]
|
||||
15. List.takeWhile : (a ->{𝕖} Boolean) -> [a] ->{𝕖} [a]
|
||||
|
||||
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge
|
||||
```
|
||||
|
||||
This tests a variable related bug in the ANF compiler.
|
||||
@ -29,6 +29,6 @@ foo _ =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
|
@ -45,7 +45,7 @@ foo _ =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
# Unit tests for Any.unsafeExtract
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
.> load unison-src/transcripts-using-base/base.u
|
||||
.> add
|
||||
scratch/main> builtins.mergeio
|
||||
scratch/main> load unison-src/transcripts-using-base/base.u
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
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.
|
||||
@ -19,5 +19,5 @@ test> Any.unsafeExtract.works =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
@ -32,7 +32,7 @@ test> Any.unsafeExtract.works =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Doc rendering
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
scratch/main> builtins.mergeio
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
@ -82,11 +82,11 @@ term = 42
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> display term.doc
|
||||
scratch/main> display term.doc
|
||||
```
|
||||
|
||||
```api
|
||||
|
@ -78,7 +78,7 @@ term = 42
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> display term.doc
|
||||
scratch/main> display term.doc
|
||||
|
||||
# Heading
|
||||
|
||||
@ -149,795 +149,10 @@ term = 42
|
||||
```api
|
||||
GET /api/non-project-code/getDefinition?names=term
|
||||
{
|
||||
"missingDefinitions": [],
|
||||
"termDefinitions": {
|
||||
"#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8": {
|
||||
"bestTermName": "term",
|
||||
"defnTermTag": "Plain",
|
||||
"signature": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
}
|
||||
],
|
||||
"termDefinition": {
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "term",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "TypeAscriptionColon"
|
||||
},
|
||||
"segment": " :"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": "\n"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "term",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "BindingEquals"
|
||||
},
|
||||
"segment": " ="
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "NumericLiteral"
|
||||
},
|
||||
"segment": "42"
|
||||
}
|
||||
],
|
||||
"tag": "UserObject"
|
||||
},
|
||||
"termDocs": [
|
||||
[
|
||||
"doc",
|
||||
"#kjfaflbrgl89j2uq4ruubejakm6s02cp3m61ufu7rv7tkbd4nmkvcn1fciue53v0msir9t7ds111ab9er8qfa06gsa9ddfrdfgc99mo",
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Heading",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
[
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Heading",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "2",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
[
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Term",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Link:",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#k5gpql9cbdfau6lf1aja24joc3sfctvjor8esu8bemn0in3l148otb0t3vebgqrt6qml302h62bbfeftg65gec1v8ouin5m6v2969d8",
|
||||
"tag": "TermReference"
|
||||
},
|
||||
"segment": "otherTerm"
|
||||
}
|
||||
],
|
||||
"tag": "Link"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Type",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Link:",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Maybe"
|
||||
}
|
||||
],
|
||||
"tag": "Link"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Term",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "source:",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
"#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
|
||||
{
|
||||
"contents": [
|
||||
[
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
|
||||
"tag": "TermReference"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "TypeAscriptionColon"
|
||||
},
|
||||
"segment": ": "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "term",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "TypeAscriptionColon"
|
||||
},
|
||||
"segment": " :"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": "\n"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "term",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "BindingEquals"
|
||||
},
|
||||
"segment": " ="
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "NumericLiteral"
|
||||
},
|
||||
"segment": "42"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "UserObject"
|
||||
}
|
||||
],
|
||||
"tag": "Term"
|
||||
}
|
||||
],
|
||||
"tag": "Source"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Term",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "signature:",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
[
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
|
||||
"tag": "TermReference"
|
||||
},
|
||||
"segment": "term"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "TypeAscriptionColon"
|
||||
},
|
||||
"segment": ": "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "TypeReference"
|
||||
},
|
||||
"segment": "Nat"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "Signature"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "List",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "item",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
],
|
||||
"tag": "BulletedList"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
1,
|
||||
[
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Numbered",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "list",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "item",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "NumberedList"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": ">",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Block",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "quote",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Code",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "block",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Inline",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "code:",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "NumericLiteral"
|
||||
},
|
||||
"segment": "1"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat.+",
|
||||
"tag": "TermReference"
|
||||
},
|
||||
"segment": "Nat.+"
|
||||
},
|
||||
{
|
||||
"annotation": null,
|
||||
"segment": " "
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"tag": "NumericLiteral"
|
||||
},
|
||||
"segment": "2"
|
||||
}
|
||||
],
|
||||
"tag": "Example"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": "\"doesn't typecheck\" + 1",
|
||||
"tag": "Word"
|
||||
},
|
||||
"tag": "Code"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Link",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"contents": "https://unison-lang.org",
|
||||
"tag": "Word"
|
||||
},
|
||||
"tag": "Group"
|
||||
}
|
||||
],
|
||||
"tag": "NamedLink"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "![Image](https://share-next.unison-lang.org/static/unison-logo-circle.png)",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Bold",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
"tag": "Bold"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Italic",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
"tag": "Bold"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Strikethrough",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
"tag": "Strikethrough"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Horizontal",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "rule",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "---",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Table",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Header",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "1",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Header",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "2",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "--------",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "--------",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Cell",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "1",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Cell",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "2",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Cell",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "3",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "Cell",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "4",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "|",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Video",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
[
|
||||
{
|
||||
"mediaSourceMimeType": null,
|
||||
"mediaSourceUrl": "test.mp4"
|
||||
}
|
||||
],
|
||||
{
|
||||
"poster": "test.png"
|
||||
}
|
||||
],
|
||||
"tag": "Video"
|
||||
},
|
||||
"tag": "Special"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Transclusion/evaluation:",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "This",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "doc",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "should",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "be",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "embedded.",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"contents": "message",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
],
|
||||
"tag": "UntitledSection"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "Section"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tag": "Section"
|
||||
}
|
||||
]
|
||||
],
|
||||
"termNames": [
|
||||
"term"
|
||||
]
|
||||
}
|
||||
},
|
||||
"missingDefinitions": [
|
||||
"term"
|
||||
],
|
||||
"termDefinitions": {},
|
||||
"typeDefinitions": {}
|
||||
}
|
||||
```
|
@ -8,19 +8,19 @@ joey.yaml.zz = 45
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```api
|
||||
-- Namespace segment prefix search
|
||||
GET /api/non-project-code/find?query=http
|
||||
GET /api/projects/scratch/branches/main/find?query=http
|
||||
|
||||
-- Namespace segment suffix search
|
||||
GET /api/non-project-code/find?query=Server
|
||||
GET /api/projects/scratch/branches/main/find?query=Server
|
||||
|
||||
-- Substring search
|
||||
GET /api/non-project-code/find?query=lesys
|
||||
GET /api/projects/scratch/branches/main/find?query=lesys
|
||||
|
||||
-- Cross-segment search
|
||||
GET /api/non-project-code/find?query=joey.http
|
||||
GET /api/projects/scratch/branches/main/find?query=joey.http
|
||||
```
|
||||
|
@ -24,7 +24,7 @@ joey.yaml.zz = 45
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -36,7 +36,7 @@ joey.yaml.zz = 45
|
||||
```
|
||||
```api
|
||||
-- Namespace segment prefix search
|
||||
GET /api/non-project-code/find?query=http
|
||||
GET /api/projects/scratch/branches/main/find?query=http
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -122,7 +122,7 @@ GET /api/non-project-code/find?query=http
|
||||
]
|
||||
]
|
||||
-- Namespace segment suffix search
|
||||
GET /api/non-project-code/find?query=Server
|
||||
GET /api/projects/scratch/branches/main/find?query=Server
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -167,7 +167,7 @@ GET /api/non-project-code/find?query=Server
|
||||
]
|
||||
]
|
||||
-- Substring search
|
||||
GET /api/non-project-code/find?query=lesys
|
||||
GET /api/projects/scratch/branches/main/find?query=lesys
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -212,7 +212,7 @@ GET /api/non-project-code/find?query=lesys
|
||||
]
|
||||
]
|
||||
-- Cross-segment search
|
||||
GET /api/non-project-code/find?query=joey.http
|
||||
GET /api/projects/scratch/branches/main/find?query=joey.http
|
||||
[
|
||||
[
|
||||
{
|
||||
|
@ -1,54 +1,50 @@
|
||||
# Get Definitions Test
|
||||
|
||||
```ucm:hide
|
||||
.nested> builtins.mergeio
|
||||
scratch/main> builtins.mergeio lib.builtins
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
{{ Documentation }}
|
||||
names.x = 42
|
||||
nested.names.x.doc = {{ Documentation }}
|
||||
nested.names.x = 42
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.nested> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```api
|
||||
-- Should NOT find names by suffix
|
||||
GET /api/non-project-code/getDefinition?names=x
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=x
|
||||
|
||||
-- Term names should strip relativeTo prefix.
|
||||
GET /api/non-project-code/getDefinition?names=names.x&relativeTo=nested
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=names.x&relativeTo=nested
|
||||
|
||||
-- Should find definitions by hash, names should be relative
|
||||
GET /api/non-project-code/getDefinition?names=%23qkhkl0n238&relativeTo=nested
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.doctest> builtins.mergeio
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=%23qkhkl0n238&relativeTo=nested
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
thing.doc = {{ The correct docs for the thing }}
|
||||
thing = "A thing"
|
||||
thingalias.doc = {{ Docs for the alias, should not be displayed }}
|
||||
thingalias = "A thing"
|
||||
otherstuff.thing.doc = {{ A doc for a different term with the same name, should not be displayed }}
|
||||
otherstuff.thing = "A different thing"
|
||||
doctest.thing.doc = {{ The correct docs for the thing }}
|
||||
doctest.thing = "A thing"
|
||||
doctest.thingalias.doc = {{ Docs for the alias, should not be displayed }}
|
||||
doctest.thingalias = "A thing"
|
||||
doctest.otherstuff.thing.doc = {{ A doc for a different term with the same name, should not be displayed }}
|
||||
doctest.otherstuff.thing = "A different thing"
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.doctest> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Only docs for the term we request should be returned, even if there are other term docs with the same suffix.
|
||||
|
||||
```api
|
||||
GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=thing&relativeTo=doctest
|
||||
```
|
||||
|
||||
If we request a doc, the api should return the source, but also the rendered doc should appear in the 'termDocs' list.
|
||||
|
||||
```api
|
||||
GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=thing.doc&relativeTo=doctest
|
||||
```
|
||||
|
@ -1,13 +1,13 @@
|
||||
# Get Definitions Test
|
||||
|
||||
```unison
|
||||
{{ Documentation }}
|
||||
names.x = 42
|
||||
nested.names.x.doc = {{ Documentation }}
|
||||
nested.names.x = 42
|
||||
```
|
||||
|
||||
```api
|
||||
-- Should NOT find names by suffix
|
||||
GET /api/non-project-code/getDefinition?names=x
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=x
|
||||
{
|
||||
"missingDefinitions": [
|
||||
"x"
|
||||
@ -16,7 +16,7 @@ GET /api/non-project-code/getDefinition?names=x
|
||||
"typeDefinitions": {}
|
||||
}
|
||||
-- Term names should strip relativeTo prefix.
|
||||
GET /api/non-project-code/getDefinition?names=names.x&relativeTo=nested
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=names.x&relativeTo=nested
|
||||
{
|
||||
"missingDefinitions": [],
|
||||
"termDefinitions": {
|
||||
@ -104,14 +104,14 @@ GET /api/non-project-code/getDefinition?names=names.x&relativeTo=nested
|
||||
]
|
||||
],
|
||||
"termNames": [
|
||||
"names.x"
|
||||
"nested.names.x"
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeDefinitions": {}
|
||||
}
|
||||
-- Should find definitions by hash, names should be relative
|
||||
GET /api/non-project-code/getDefinition?names=%23qkhkl0n238&relativeTo=nested
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=%23qkhkl0n238&relativeTo=nested
|
||||
{
|
||||
"missingDefinitions": [],
|
||||
"termDefinitions": {
|
||||
@ -199,30 +199,30 @@ GET /api/non-project-code/getDefinition?names=%23qkhkl0n238&relativeTo=nested
|
||||
]
|
||||
],
|
||||
"termNames": [
|
||||
"names.x"
|
||||
"nested.names.x"
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeDefinitions": {}
|
||||
}
|
||||
``````unison
|
||||
thing.doc = {{ The correct docs for the thing }}
|
||||
thing = "A thing"
|
||||
thingalias.doc = {{ Docs for the alias, should not be displayed }}
|
||||
thingalias = "A thing"
|
||||
otherstuff.thing.doc = {{ A doc for a different term with the same name, should not be displayed }}
|
||||
otherstuff.thing = "A different thing"
|
||||
doctest.thing.doc = {{ The correct docs for the thing }}
|
||||
doctest.thing = "A thing"
|
||||
doctest.thingalias.doc = {{ Docs for the alias, should not be displayed }}
|
||||
doctest.thingalias = "A thing"
|
||||
doctest.otherstuff.thing.doc = {{ A doc for a different term with the same name, should not be displayed }}
|
||||
doctest.otherstuff.thing = "A different thing"
|
||||
```
|
||||
|
||||
Only docs for the term we request should be returned, even if there are other term docs with the same suffix.
|
||||
|
||||
```api
|
||||
GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=thing&relativeTo=doctest
|
||||
{
|
||||
"missingDefinitions": [],
|
||||
"termDefinitions": {
|
||||
"#jksc1s5kud95ro5ivngossullt2oavsd41s3u48bch67jf3gknru5j6hmjslonkd5sdqs8mr8k4rrnef8fodngbg4sm7u6au564ekjg": {
|
||||
"bestTermName": "thing",
|
||||
"bestTermName": "doctest.thing",
|
||||
"defnTermTag": "Plain",
|
||||
"signature": [
|
||||
{
|
||||
@ -237,10 +237,10 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "thing",
|
||||
"contents": "doctest.thing",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "thing"
|
||||
"segment": "doctest.thing"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
@ -265,10 +265,10 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "thing",
|
||||
"contents": "doctest.thing",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "thing"
|
||||
"segment": "doctest.thing"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
@ -291,7 +291,7 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
|
||||
},
|
||||
"termDocs": [
|
||||
[
|
||||
"thing.doc",
|
||||
"doctest.thing.doc",
|
||||
"#t9qfdoiuskj4n9go8cftj1r83s43s3o7sppafm5vr0bq5feieb7ap0cie5ed2qsf9g3ig448vffhnajinq81pnnkila1jp2epa7f26o",
|
||||
{
|
||||
"contents": [
|
||||
@ -325,8 +325,8 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
|
||||
]
|
||||
],
|
||||
"termNames": [
|
||||
"thing",
|
||||
"thingalias"
|
||||
"doctest.thing",
|
||||
"doctest.thingalias"
|
||||
]
|
||||
}
|
||||
},
|
||||
@ -335,12 +335,12 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
|
||||
```If we request a doc, the api should return the source, but also the rendered doc should appear in the 'termDocs' list.
|
||||
|
||||
```api
|
||||
GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
|
||||
GET /api/projects/scratch/branches/main/getDefinition?names=thing.doc&relativeTo=doctest
|
||||
{
|
||||
"missingDefinitions": [],
|
||||
"termDefinitions": {
|
||||
"#t9qfdoiuskj4n9go8cftj1r83s43s3o7sppafm5vr0bq5feieb7ap0cie5ed2qsf9g3ig448vffhnajinq81pnnkila1jp2epa7f26o": {
|
||||
"bestTermName": "thing.doc",
|
||||
"bestTermName": "doctest.thing.doc",
|
||||
"defnTermTag": "Doc",
|
||||
"signature": [
|
||||
{
|
||||
@ -355,10 +355,10 @@ GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
|
||||
"contents": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "thing.doc",
|
||||
"contents": "doctest.thing.doc",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "thing.doc"
|
||||
"segment": "doctest.thing.doc"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
@ -383,10 +383,10 @@ GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "thing.doc",
|
||||
"contents": "doctest.thing.doc",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "thing.doc"
|
||||
"segment": "doctest.thing.doc"
|
||||
},
|
||||
{
|
||||
"annotation": {
|
||||
@ -467,7 +467,7 @@ GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
|
||||
},
|
||||
"termDocs": [
|
||||
[
|
||||
"thing.doc",
|
||||
"doctest.thing.doc",
|
||||
"#t9qfdoiuskj4n9go8cftj1r83s43s3o7sppafm5vr0bq5feieb7ap0cie5ed2qsf9g3ig448vffhnajinq81pnnkila1jp2epa7f26o",
|
||||
{
|
||||
"contents": [
|
||||
@ -501,7 +501,7 @@ GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
|
||||
]
|
||||
],
|
||||
"termNames": [
|
||||
"thing.doc"
|
||||
"doctest.thing.doc"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -1,9 +1,9 @@
|
||||
# List Projects And Branches Test
|
||||
|
||||
```ucm:hide
|
||||
.> project.create-empty project-one
|
||||
.> project.create-empty project-two
|
||||
.> project.create-empty project-three
|
||||
scratch/main> project.create-empty project-one
|
||||
scratch/main> project.create-empty project-two
|
||||
scratch/main> project.create-empty project-three
|
||||
project-one/main> branch branch-one
|
||||
project-one/main> branch branch-two
|
||||
project-one/main> branch branch-three
|
||||
|
@ -12,6 +12,9 @@ GET /api/projects
|
||||
},
|
||||
{
|
||||
"projectName": "project-two"
|
||||
},
|
||||
{
|
||||
"projectName": "scratch"
|
||||
}
|
||||
]
|
||||
-- Should list projects starting with project-t
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Namespace Details Test
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
scratch/main> builtins.mergeio
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -14,7 +14,7 @@ Here's a *README*!
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```api
|
||||
|
@ -25,7 +25,7 @@ Here's a *README*!
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -39,43 +39,7 @@ Here's a *README*!
|
||||
GET /api/non-project-code/namespaces/nested.names
|
||||
{
|
||||
"fqn": "nested.names",
|
||||
"hash": "#6tnmlu9knsce0u2991u6fvcmf4v44fdf0aiqtmnq7mjj0gi5sephg3lf12iv3odr5rc7vlgq75ciborrd3625c701bdmdomia2gcm3o",
|
||||
"readme": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": "Here's",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": "a",
|
||||
"tag": "Word"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": {
|
||||
"contents": [
|
||||
{
|
||||
"contents": "README",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
},
|
||||
"tag": "Bold"
|
||||
},
|
||||
{
|
||||
"contents": "!",
|
||||
"tag": "Word"
|
||||
}
|
||||
],
|
||||
"tag": "Join"
|
||||
},
|
||||
"tag": "Group"
|
||||
}
|
||||
],
|
||||
"tag": "Paragraph"
|
||||
}
|
||||
"hash": "#sg60bvjo91fsoo7pkh9gejbn0qgc95vra87ap6l5d35ri0lkaudl7bs12d71sf3fh6p23teemuor7mk1i9n567m50ibakcghjec5ajg",
|
||||
"readme": null
|
||||
}
|
||||
```
|
@ -1,7 +1,7 @@
|
||||
# Namespace list api
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
scratch/main> builtins.mergeio
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -12,7 +12,7 @@ nested.names.readme = {{ I'm a readme! }}
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```api
|
||||
|
@ -23,7 +23,7 @@ nested.names.readme = {{ I'm a readme! }}
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -35,100 +35,14 @@ nested.names.readme = {{ I'm a readme! }}
|
||||
```api
|
||||
GET /api/non-project-code/list?namespace=nested.names
|
||||
{
|
||||
"namespaceListingChildren": [
|
||||
{
|
||||
"contents": {
|
||||
"termHash": "#ddmmatmmiqsts2ku0i02kntd0s7rvcui4nn1cusio8thp9oqhbtilvcnhen52ibv43kr5q83f5er5q9h56s807k17tnelnrac7cch8o",
|
||||
"termName": "readme",
|
||||
"termTag": "Doc",
|
||||
"termType": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#ej86si0ur1",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "#ej86si0ur1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tag": "TermObject"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"termHash": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
|
||||
"termName": "x",
|
||||
"termTag": "Plain",
|
||||
"termType": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "##Nat"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tag": "TermObject"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"namespaceHash": "#n1egracfeljprftoktbjcase2hs4f4p8idbhs5ujipl42agld1810hrq9t7p7ped16aagni2cm1fjcjhho770jh80ipthhmg0cnsur0",
|
||||
"namespaceName": "x",
|
||||
"namespaceSize": 1
|
||||
},
|
||||
"tag": "Subnamespace"
|
||||
}
|
||||
],
|
||||
"namespaceListingChildren": [],
|
||||
"namespaceListingFQN": "nested.names",
|
||||
"namespaceListingHash": "#oms19b4f9s3c8tb5skeb8jii95ij35n3hdg038pu6rv5b0fikqe4gd7lnu6a1i6aq5tdh2opdo4s0sfrupvk6vfkr9lf0n752gbl8o0"
|
||||
"namespaceListingHash": "#sg60bvjo91fsoo7pkh9gejbn0qgc95vra87ap6l5d35ri0lkaudl7bs12d71sf3fh6p23teemuor7mk1i9n567m50ibakcghjec5ajg"
|
||||
}
|
||||
GET /api/non-project-code/list?namespace=names&relativeTo=nested
|
||||
{
|
||||
"namespaceListingChildren": [
|
||||
{
|
||||
"contents": {
|
||||
"termHash": "#ddmmatmmiqsts2ku0i02kntd0s7rvcui4nn1cusio8thp9oqhbtilvcnhen52ibv43kr5q83f5er5q9h56s807k17tnelnrac7cch8o",
|
||||
"termName": "readme",
|
||||
"termTag": "Doc",
|
||||
"termType": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "#ej86si0ur1",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "#ej86si0ur1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tag": "TermObject"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"termHash": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
|
||||
"termName": "x",
|
||||
"termTag": "Plain",
|
||||
"termType": [
|
||||
{
|
||||
"annotation": {
|
||||
"contents": "##Nat",
|
||||
"tag": "HashQualifier"
|
||||
},
|
||||
"segment": "##Nat"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tag": "TermObject"
|
||||
},
|
||||
{
|
||||
"contents": {
|
||||
"namespaceHash": "#n1egracfeljprftoktbjcase2hs4f4p8idbhs5ujipl42agld1810hrq9t7p7ped16aagni2cm1fjcjhho770jh80ipthhmg0cnsur0",
|
||||
"namespaceName": "x",
|
||||
"namespaceSize": 1
|
||||
},
|
||||
"tag": "Subnamespace"
|
||||
}
|
||||
],
|
||||
"namespaceListingChildren": [],
|
||||
"namespaceListingFQN": "nested.names",
|
||||
"namespaceListingHash": "#oms19b4f9s3c8tb5skeb8jii95ij35n3hdg038pu6rv5b0fikqe4gd7lnu6a1i6aq5tdh2opdo4s0sfrupvk6vfkr9lf0n752gbl8o0"
|
||||
"namespaceListingHash": "#sg60bvjo91fsoo7pkh9gejbn0qgc95vra87ap6l5d35ri0lkaudl7bs12d71sf3fh6p23teemuor7mk1i9n567m50ibakcghjec5ajg"
|
||||
}
|
||||
```
|
@ -1,7 +1,7 @@
|
||||
# Definition Summary APIs
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
scratch/main> builtins.mergeio
|
||||
```
|
||||
|
||||
|
||||
@ -25,9 +25,9 @@ structural ability Stream s where
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
.> alias.type ##Nat Nat
|
||||
.> alias.term ##IO.putBytes.impl.v3 putBytesImpl
|
||||
scratch/main> add
|
||||
scratch/main> alias.type ##Nat Nat
|
||||
scratch/main> alias.term ##IO.putBytes.impl.v3 putBytesImpl
|
||||
```
|
||||
|
||||
## Term Summary APIs
|
||||
|
@ -3,7 +3,7 @@
|
||||
Should block an `add` if it requires an update on an in-file dependency.
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -11,7 +11,7 @@ x = 1
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Update `x`, and add a new `y` which depends on the update
|
||||
@ -24,5 +24,5 @@ y = x + 1
|
||||
Try to add only the new `y`. This should fail because it requires an update to `x`, but we only ran an 'add'.
|
||||
|
||||
```ucm:error
|
||||
.> add y
|
||||
scratch/main> add y
|
||||
```
|
||||
|
@ -20,7 +20,7 @@ x = 1
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -55,7 +55,7 @@ y = x + 1
|
||||
Try to add only the new `y`. This should fail because it requires an update to `x`, but we only ran an 'add'.
|
||||
|
||||
```ucm
|
||||
.> add y
|
||||
scratch/main> add y
|
||||
|
||||
x These definitions failed:
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
## Blocks and scoping
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge
|
||||
```
|
||||
|
||||
### Names introduced by a block shadow names introduced in outer scopes
|
||||
|
@ -1,7 +1,7 @@
|
||||
Regression test for https://github.com/unisonweb/unison/pull/2819
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -12,7 +12,7 @@ hangExample =
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> view hangExample
|
||||
scratch/main> add
|
||||
scratch/main> view hangExample
|
||||
```
|
||||
|
||||
|
@ -21,13 +21,13 @@ hangExample =
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
hangExample : Boolean
|
||||
|
||||
.> view hangExample
|
||||
scratch/main> view hangExample
|
||||
|
||||
hangExample : Boolean
|
||||
hangExample =
|
||||
|
@ -1,25 +1,25 @@
|
||||
The `branch` command creates a new branch.
|
||||
|
||||
```ucm:hide
|
||||
.> project.create-empty foo
|
||||
.> project.create-empty bar
|
||||
scratch/main> project.create-empty foo
|
||||
scratch/main> project.create-empty bar
|
||||
```
|
||||
|
||||
First, we'll just create a loose code namespace with a term in it for later.
|
||||
First, we'll create a term to include in the branches.
|
||||
|
||||
```unison:hide
|
||||
someterm = 18
|
||||
```
|
||||
|
||||
```ucm
|
||||
.some.loose.code.lib> builtins.merge
|
||||
.some.loose.code> add
|
||||
scratch/main> builtins.merge lib.builtins
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Now, the `branch` demo:
|
||||
|
||||
`branch` can create a branch from a different branch in the same project, from a different branch in a different
|
||||
project, or from loose code. It can also create an empty branch.
|
||||
project. It can also create an empty branch.
|
||||
|
||||
```ucm
|
||||
foo/main> branch topic1
|
||||
@ -33,22 +33,17 @@ foo/main> branch /main /topic8
|
||||
foo/main> branch /main foo/topic9
|
||||
foo/main> branch foo/main topic10
|
||||
foo/main> branch foo/main /topic11
|
||||
.> branch foo/main foo/topic12
|
||||
scratch/main> branch foo/main foo/topic12
|
||||
|
||||
foo/main> branch bar/topic
|
||||
bar/main> branch foo/main topic2
|
||||
bar/main> branch foo/main /topic3
|
||||
.> branch foo/main bar/topic4
|
||||
|
||||
.some.loose.code> branch foo/topic13
|
||||
foo/main> branch .some.loose.code topic14
|
||||
foo/main> branch .some.loose.code /topic15
|
||||
.> branch .some.loose.code foo/topic16
|
||||
scratch/main> branch foo/main bar/topic4
|
||||
|
||||
foo/main> branch.empty empty1
|
||||
foo/main> branch.empty /empty2
|
||||
foo/main> branch.empty foo/empty3
|
||||
.> branch.empty foo/empty4
|
||||
scratch/main> branch.empty foo/empty4
|
||||
```
|
||||
|
||||
The `branch` command can create branches named `releases/drafts/*` (because why not).
|
||||
|
@ -1,19 +1,17 @@
|
||||
The `branch` command creates a new branch.
|
||||
|
||||
First, we'll just create a loose code namespace with a term in it for later.
|
||||
First, we'll create a term to include in the branches.
|
||||
|
||||
```unison
|
||||
someterm = 18
|
||||
```
|
||||
|
||||
```ucm
|
||||
☝️ The namespace .some.loose.code.lib is empty.
|
||||
|
||||
.some.loose.code.lib> builtins.merge
|
||||
scratch/main> builtins.merge lib.builtins
|
||||
|
||||
Done.
|
||||
|
||||
.some.loose.code> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
@ -23,7 +21,7 @@ someterm = 18
|
||||
Now, the `branch` demo:
|
||||
|
||||
`branch` can create a branch from a different branch in the same project, from a different branch in a different
|
||||
project, or from loose code. It can also create an empty branch.
|
||||
project. It can also create an empty branch.
|
||||
|
||||
```ucm
|
||||
foo/main> branch topic1
|
||||
@ -103,7 +101,7 @@ foo/main> branch foo/main /topic11
|
||||
Tip: To merge your work back into the main branch, first
|
||||
`switch /main` then `merge /topic11`.
|
||||
|
||||
.> branch foo/main foo/topic12
|
||||
scratch/main> branch foo/main foo/topic12
|
||||
|
||||
Done. I've created the topic12 branch based off of main.
|
||||
|
||||
@ -122,30 +120,10 @@ bar/main> branch foo/main /topic3
|
||||
|
||||
Done. I've created the bar/topic3 branch based off foo/main.
|
||||
|
||||
.> branch foo/main bar/topic4
|
||||
scratch/main> branch foo/main bar/topic4
|
||||
|
||||
Done. I've created the bar/topic4 branch based off foo/main.
|
||||
|
||||
.some.loose.code> branch foo/topic13
|
||||
|
||||
Done. I've created the foo/topic13 branch from the namespace
|
||||
.some.loose.code.
|
||||
|
||||
foo/main> branch .some.loose.code topic14
|
||||
|
||||
Done. I've created the foo/topic14 branch from the namespace
|
||||
.some.loose.code.
|
||||
|
||||
foo/main> branch .some.loose.code /topic15
|
||||
|
||||
Done. I've created the foo/topic15 branch from the namespace
|
||||
.some.loose.code.
|
||||
|
||||
.> branch .some.loose.code foo/topic16
|
||||
|
||||
Done. I've created the foo/topic16 branch from the namespace
|
||||
.some.loose.code.
|
||||
|
||||
foo/main> branch.empty empty1
|
||||
|
||||
Done. I've created an empty branch foo/empty1.
|
||||
@ -164,7 +142,7 @@ foo/main> branch.empty foo/empty3
|
||||
|
||||
Tip: Use `merge /somebranch` to initialize this branch.
|
||||
|
||||
.> branch.empty foo/empty4
|
||||
scratch/main> branch.empty foo/empty4
|
||||
|
||||
Done. I've created an empty branch foo/empty4.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
.> project.create-empty p0
|
||||
.> project.create-empty p1
|
||||
scratch/main> builtins.merge
|
||||
scratch/main> project.create-empty p0
|
||||
scratch/main> project.create-empty p1
|
||||
```
|
||||
|
||||
```unison
|
||||
|
@ -1,5 +1,5 @@
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
scratch/main> builtins.merge
|
||||
```
|
||||
|
||||
```unison
|
||||
|
@ -1,6 +1,6 @@
|
||||
The `builtins.merge` command adds the known builtins to a `builtin` subnamespace within the current namespace.
|
||||
The `builtins.merge` command adds the known builtins to the specified subnamespace within the current namespace.
|
||||
|
||||
```ucm
|
||||
.tmp> builtins.merge
|
||||
.tmp> ls builtin
|
||||
scratch/main> builtins.merge builtins
|
||||
scratch/main> ls builtins
|
||||
```
|
||||
|
@ -1,13 +1,11 @@
|
||||
The `builtins.merge` command adds the known builtins to a `builtin` subnamespace within the current namespace.
|
||||
The `builtins.merge` command adds the known builtins to the specified subnamespace within the current namespace.
|
||||
|
||||
```ucm
|
||||
☝️ The namespace .tmp is empty.
|
||||
|
||||
.tmp> builtins.merge
|
||||
scratch/main> builtins.merge builtins
|
||||
|
||||
Done.
|
||||
|
||||
.tmp> ls builtin
|
||||
scratch/main> ls builtins
|
||||
|
||||
1. Any (builtin type)
|
||||
2. Any/ (2 terms)
|
||||
|
@ -1,12 +1,12 @@
|
||||
# Unit tests for builtin functions
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
.> load unison-src/transcripts-using-base/base.u
|
||||
.> add
|
||||
scratch/main> builtins.mergeio
|
||||
scratch/main> load unison-src/transcripts-using-base/base.u
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
This transcript defines unit tests for builtin functions. There's a single `.> test` execution at the end that will fail the transcript with a nice report if any of the tests fail.
|
||||
This transcript defines unit tests for builtin functions. There's a single `scratch/main> test` execution at the end that will fail the transcript with a nice report if any of the tests fail.
|
||||
|
||||
## `Int` functions
|
||||
|
||||
@ -88,7 +88,7 @@ test> Int.tests.conversions =
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## `Nat` functions
|
||||
@ -163,7 +163,7 @@ test> Nat.tests.conversions =
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## `Boolean` functions
|
||||
@ -190,7 +190,7 @@ test> Boolean.tests.notTable =
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## `Text` functions
|
||||
@ -288,7 +288,7 @@ test> Text.tests.indexOfEmoji =
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## `Bytes` functions
|
||||
@ -352,7 +352,7 @@ test> Bytes.tests.indexOf =
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## `List` comparison
|
||||
@ -371,7 +371,7 @@ test> checks [
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
Other list functions
|
||||
@ -392,7 +392,7 @@ test> Any.test2 = checks [(not (Any "hi" == Any 42))]
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## Sandboxing functions
|
||||
@ -419,7 +419,7 @@ openFile]
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -436,8 +436,8 @@ openFilesIO = do
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test openFilesIO
|
||||
scratch/main> add
|
||||
scratch/main> io.test openFilesIO
|
||||
```
|
||||
|
||||
## Universal hash functions
|
||||
@ -450,7 +450,7 @@ test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Unive
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> add
|
||||
scratch/main> add
|
||||
```
|
||||
|
||||
## Run the tests
|
||||
@ -458,5 +458,5 @@ test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Unive
|
||||
Now that all the tests have been added to the codebase, let's view the test report. This will fail the transcript (with a nice message) if any of the tests are failing.
|
||||
|
||||
```ucm
|
||||
.> test
|
||||
scratch/main> test
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Unit tests for builtin functions
|
||||
|
||||
This transcript defines unit tests for builtin functions. There's a single `.> test` execution at the end that will fail the transcript with a nice report if any of the tests fail.
|
||||
This transcript defines unit tests for builtin functions. There's a single `scratch/main> test` execution at the end that will fail the transcript with a nice report if any of the tests fail.
|
||||
|
||||
## `Int` functions
|
||||
|
||||
@ -480,13 +480,13 @@ openFilesIO = do
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
openFilesIO : '{IO} [Result]
|
||||
|
||||
.> io.test openFilesIO
|
||||
scratch/main> io.test openFilesIO
|
||||
|
||||
New test results:
|
||||
|
||||
@ -535,7 +535,7 @@ test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Unive
|
||||
Now that all the tests have been added to the codebase, let's view the test report. This will fail the transcript (with a nice message) if any of the tests are failing.
|
||||
|
||||
```ucm
|
||||
.> test
|
||||
scratch/main> test
|
||||
|
||||
Cached test results (`help testcache` to learn more)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user