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