Merge remote-tracking branch 'origin/trunk' into topic/jit-cont

This commit is contained in:
Dan Doel 2024-06-27 16:21:25 -04:00
commit 8a04bf4f87
416 changed files with 2673 additions and 2901 deletions

View File

@ -13,13 +13,12 @@ module Unison.Debug
)
where
import Control.Applicative (empty)
import Control.Monad (when)
import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text qualified as Text
import Debug.Pretty.Simple (pTrace, pTraceM, pTraceShowId, pTraceShowM)
import Debug.Pretty.Simple (pTrace, pTraceM)
import System.IO.Unsafe (unsafePerformIO)
import Text.Pretty.Simple (pShow)
import Unison.Prelude
import UnliftIO.Environment (lookupEnv)
data DebugFlag
@ -148,7 +147,7 @@ debugPatternCoverageConstraintSolver = PatternCoverageConstraintSolver `Set.memb
debug :: (Show a) => DebugFlag -> String -> a -> a
debug flag msg a =
if shouldDebug flag
then pTraceShowId (pTrace (msg <> ":\n") a)
then (pTrace (msg <> ":\n" <> into @String (pShow a)) a)
else a
-- | Use for selective debug logging in monadic contexts.
@ -159,8 +158,7 @@ debug flag msg a =
debugM :: (Show a, Monad m) => DebugFlag -> String -> a -> m ()
debugM flag msg a =
whenDebug flag do
pTraceM (msg <> ":\n")
pTraceShowM a
traceM (msg <> ":\n" <> into @String (pShow a))
debugLog :: DebugFlag -> String -> a -> a
debugLog flag msg =

View File

@ -492,7 +492,7 @@ loop e = do
description <- inputDescription input
Cli.stepAt description (BranchUtil.makeAddTermName (first Path.unabsolute dest) srcTerm)
Cli.respond Success
AliasTypeI src' dest' -> do
AliasTypeI force src' dest' -> do
src <- traverseOf _Right Cli.resolveSplit' src'
srcTypes <-
either
@ -510,7 +510,7 @@ loop e = do
pure (DeleteNameAmbiguous hqLength name Set.empty srcTypes)
dest <- Cli.resolveSplit' dest'
destTypes <- Cli.getTypesAt (HQ'.NameOnly <$> dest)
when (not (Set.null destTypes)) do
when (not force && not (Set.null destTypes)) do
Cli.returnEarly (TypeAlreadyExists dest' destTypes)
description <- inputDescription input
Cli.stepAt description (BranchUtil.makeAddTypeName (first Path.unabsolute dest) srcType)
@ -978,11 +978,11 @@ inputDescription input =
AliasTermI force src0 dest0 -> do
src <- hhqs' src0
dest <- ps' dest0
pure ((if force then "alias.term.force " else "alias.term ") <> src <> " " <> dest)
AliasTypeI src0 dest0 -> do
pure ((if force then "debug.alias.term.force " else "alias.term ") <> src <> " " <> dest)
AliasTypeI force src0 dest0 -> do
src <- hhqs' src0
dest <- ps' dest0
pure ("alias.type " <> src <> " " <> dest)
pure ((if force then "debug.alias.type.force " else "alias.term ") <> src <> " " <> dest)
AliasManyI srcs0 dest0 -> do
srcs <- traverse hqs srcs0
dest <- p' dest0

View File

@ -14,7 +14,6 @@ import Data.Map qualified as Map
import Data.Set qualified as Set
import Data.Set.NonEmpty (NESet)
import Data.Set.NonEmpty qualified as NESet
import Data.Tuple qualified as Tuple
import Unison.ABT qualified as ABT
import Unison.Builtin.Decls qualified as DD
import Unison.Cli.Monad (Cli)
@ -69,21 +68,24 @@ handleTest TestInput {includeLibNamespace, path, showFailures, showSuccesses} =
Map.fromList <$> Cli.runTransaction do
Set.toList testRefs & wither \case
rid -> fmap (rid,) <$> Codebase.getWatch codebase WK.TestWatch rid
let (oks, fails) = passFails cachedTests
passFails :: (Ord r) => Map r (Term v a) -> ([(r, Text)], [(r, Text)])
passFails = Tuple.swap . partitionEithers . concat . map p . Map.toList
let (fails, oks) = passFails cachedTests
passFails :: (Ord r) => Map r (Term v a) -> (Map r [Text], Map r [Text])
passFails =
Map.foldrWithKey
(\r v (f, o) -> bimap (\ts -> if null ts then f else Map.insert r ts f) (\ts -> if null ts then o else Map.insert r ts o) . partitionEithers $ p v)
(Map.empty, Map.empty)
where
p :: (r, Term v a) -> [Either (r, Text) (r, Text)]
p (r, tm) = case tm of
Term.List' ts -> mapMaybe (q r) (toList ts)
p :: Term v a -> [Either Text Text]
p = \case
Term.List' ts -> mapMaybe q $ toList ts
_ -> []
q r = \case
q = \case
Term.App' (Term.Constructor' (ConstructorReference ref cid)) (Term.Text' msg) ->
if
| ref == DD.testResultRef ->
if
| cid == DD.okConstructorId -> Just (Right (r, msg))
| cid == DD.failConstructorId -> Just (Left (r, msg))
| cid == DD.okConstructorId -> Just (Right msg)
| cid == DD.failConstructorId -> Just (Left msg)
| otherwise -> Nothing
| otherwise -> Nothing
_ -> Nothing
@ -123,7 +125,7 @@ handleTest TestInput {includeLibNamespace, path, showFailures, showSuccesses} =
pure [(r, tm')]
let m = Map.fromList computedTests
(mOks, mFails) = passFails m
(mFails, mOks) = passFails m
Cli.respondNumbered $ TestResults Output.NewlyComputed fqnPPE showSuccesses showFailures mOks mFails
handleIOTest :: HQ.HashQualified Name -> Cli ()
@ -135,10 +137,14 @@ handleIOTest main = do
let isIOTest typ = Foldable.any (Typechecker.isSubtype typ) $ Runtime.ioTestTypes runtime
refs <- resolveHQNames names (Set.singleton main)
(fails, oks) <-
refs & foldMapM \(ref, typ) -> do
when (not $ isIOTest typ) do
Cli.returnEarly (BadMainFunction "io.test" main typ suffixifiedPPE (Foldable.toList $ Runtime.ioTestTypes runtime))
runIOTest suffixifiedPPE ref
Foldable.foldrM
( \(ref, typ) (f, o) -> do
when (not $ isIOTest typ) $
Cli.returnEarly (BadMainFunction "io.test" main typ suffixifiedPPE (Foldable.toList $ Runtime.ioTestTypes runtime))
bimap (\ts -> if null ts then f else Map.insert ref ts f) (\ts -> if null ts then o else Map.insert ref ts o) <$> runIOTest suffixifiedPPE ref
)
(Map.empty, Map.empty)
refs
Cli.respondNumbered $ TestResults Output.NewlyComputed suffixifiedPPE True True oks fails
findTermsOfTypes :: Codebase.Codebase m Symbol Ann -> Bool -> Path -> NESet (Type.Type Symbol Ann) -> Cli (Set TermReferenceId)
@ -163,15 +169,20 @@ handleAllIOTests = do
let suffixifiedPPE = PPED.suffixifiedPPE pped
ioTestRefs <- findTermsOfTypes codebase False Path.empty (Runtime.ioTestTypes runtime)
case NESet.nonEmptySet ioTestRefs of
Nothing -> Cli.respondNumbered $ TestResults Output.NewlyComputed suffixifiedPPE True True [] []
Nothing -> Cli.respondNumbered $ TestResults Output.NewlyComputed suffixifiedPPE True True Map.empty Map.empty
Just neTestRefs -> do
let total = NESet.size neTestRefs
(fails, oks) <-
toList neTestRefs & zip [1 :: Int ..] & foldMapM \(n, r) -> do
Cli.respond $ TestIncrementalOutputStart suffixifiedPPE (n, total) r
(fails, oks) <- runIOTest suffixifiedPPE r
Cli.respond $ TestIncrementalOutputEnd suffixifiedPPE (n, total) r (null fails)
pure (fails, oks)
toList neTestRefs
& zip [1 :: Int ..]
& Foldable.foldrM
( \(n, r) (f, o) -> do
Cli.respond $ TestIncrementalOutputStart suffixifiedPPE (n, total) r
(fails, oks) <- runIOTest suffixifiedPPE r
Cli.respond $ TestIncrementalOutputEnd suffixifiedPPE (n, total) r (null fails)
pure (if null fails then f else Map.insert r fails f, if null oks then o else Map.insert r oks o)
)
(Map.empty, Map.empty)
Cli.respondNumbered $ TestResults Output.NewlyComputed suffixifiedPPE True True oks fails
resolveHQNames :: Names -> Set (HQ.HashQualified Name) -> Cli (Set (Reference.Id, Type.Type Symbol Ann))
@ -197,19 +208,16 @@ resolveHQNames parseNames hqNames =
typ <- MaybeT (Codebase.getTypeOfReferent codebase (Referent.fromTermReferenceId ref))
pure (ref, typ)
runIOTest :: PPE.PrettyPrintEnv -> Reference.Id -> Cli ([(Reference.Id, Text)], [(Reference.Id, Text)])
runIOTest :: PPE.PrettyPrintEnv -> Reference.Id -> Cli ([Text], [Text])
runIOTest ppe ref = do
let a = ABT.annotation tm
tm = DD.forceTerm a a (Term.refId a ref)
-- Don't cache IO tests
tm' <- RuntimeUtils.evalUnisonTerm False ppe False tm
pure $ partitionTestResults [(ref, tm')]
pure $ partitionTestResults tm'
partitionTestResults ::
[(Reference.Id, Term Symbol Ann)] ->
([(Reference.Id, Text {- fails -})], [(Reference.Id, Text {- oks -})])
partitionTestResults results = fold $ do
(ref, tm) <- results
partitionTestResults :: Term Symbol Ann -> ([Text {- fails -}], [Text {- oks -}])
partitionTestResults tm = fold $ do
element <- case tm of
Term.List' ts -> toList ts
_ -> empty
@ -217,8 +225,8 @@ partitionTestResults results = fold $ do
Term.App' (Term.Constructor' (ConstructorReference conRef cid)) (Term.Text' msg) -> do
guard (conRef == DD.testResultRef)
if
| cid == DD.okConstructorId -> pure (mempty, [(ref, msg)])
| cid == DD.failConstructorId -> pure ([(ref, msg)], mempty)
| cid == DD.okConstructorId -> pure (mempty, [msg])
| cid == DD.failConstructorId -> pure ([msg], mempty)
| otherwise -> empty
_ -> empty

View File

@ -133,7 +133,7 @@ data Input
-- > names #sdflkjsdfhsdf
NamesI IsGlobal (HQ.HashQualified Name)
| AliasTermI !Bool HashOrHQSplit' Path.Split' -- bool = force?
| AliasTypeI HashOrHQSplit' Path.Split'
| AliasTypeI !Bool HashOrHQSplit' Path.Split' -- bool = force?
| AliasManyI [Path.HQSplit] Path'
| MoveAllI Path.Path' Path.Path'
| -- Move = Rename; It's an HQSplit' not an HQSplit', meaning the arg has to have a name.

View File

@ -124,8 +124,8 @@ data NumberedOutput
PPE.PrettyPrintEnv
ShowSuccesses
ShowFailures
[(TermReferenceId, Text)] -- oks
[(TermReferenceId, Text)] -- fails
(Map TermReferenceId [Text]) -- oks
(Map TermReferenceId [Text]) -- fails
| Output'Todo !TodoOutput
| -- | CantDeleteDefinitions ppe couldntDelete becauseTheseStillReferenceThem
CantDeleteDefinitions PPE.PrettyPrintEnvDecl (Map LabeledDependency (NESet LabeledDependency))

View File

@ -1392,8 +1392,8 @@ aliasTerm =
_ -> Left . warn $ P.wrap "`alias.term` takes two arguments, like `alias.term oldname newname`."
}
aliasTermForce :: InputPattern
aliasTermForce =
debugAliasTermForce :: InputPattern
debugAliasTermForce =
InputPattern
{ patternName = "debug.alias.term.force",
aliases = [],
@ -1416,9 +1416,24 @@ aliasType =
[("type to alias", Required, exactDefinitionTypeQueryArg), ("alias name", Required, newNameArg)]
"`alias.type Foo Bar` introduces `Bar` with the same definition as `Foo`."
\case
[oldName, newName] -> Input.AliasTypeI <$> handleShortHashOrHQSplit'Arg oldName <*> handleSplit'Arg newName
[oldName, newName] -> Input.AliasTypeI False <$> handleShortHashOrHQSplit'Arg oldName <*> handleSplit'Arg newName
_ -> Left . warn $ P.wrap "`alias.type` takes two arguments, like `alias.type oldname newname`."
debugAliasTypeForce :: InputPattern
debugAliasTypeForce =
InputPattern
{ patternName = "debug.alias.type.force",
aliases = [],
visibility = I.Hidden,
args = [("type to alias", Required, exactDefinitionTypeQueryArg), ("alias name", Required, newNameArg)],
help = "`debug.alias.type.force Foo Bar` introduces `Bar` with the same definition as `Foo`.",
parse = \case
[oldName, newName] -> Input.AliasTypeI True <$> handleShortHashOrHQSplit'Arg oldName <*> handleSplit'Arg newName
_ ->
Left . warn $
P.wrap "`debug.alias.type.force` takes two arguments, like `debug.alias.type.force oldname newname`."
}
aliasMany :: InputPattern
aliasMany =
InputPattern
@ -3299,7 +3314,6 @@ validInputs =
[ add,
aliasMany,
aliasTerm,
aliasTermForce,
aliasType,
api,
authLogin,
@ -3313,6 +3327,8 @@ validInputs =
clone,
compileScheme,
createAuthor,
debugAliasTermForce,
debugAliasTypeForce,
debugClearWatchCache,
debugDoctor,
debugDumpNamespace,

View File

@ -308,8 +308,8 @@ notifyNumbered = \case
)
(showDiffNamespace ShowNumbers ppe (absPathToBranchId bAbs) (absPathToBranchId bAbs) diff)
TestResults stats ppe _showSuccess _showFailures oksUnsorted failsUnsorted ->
let oks = Name.sortByText (HQ.toText . fst) [(name r, msg) | (r, msg) <- oksUnsorted]
fails = Name.sortByText (HQ.toText . fst) [(name r, msg) | (r, msg) <- failsUnsorted]
let oks = Name.sortByText (HQ.toText . fst) [(name r, msgs) | (r, msgs) <- Map.toList oksUnsorted]
fails = Name.sortByText (HQ.toText . fst) [(name r, msgs) | (r, msgs) <- Map.toList failsUnsorted]
name r = PPE.termName ppe (Referent.fromTermReferenceId r)
in ( case stats of
CachedTests 0 _ -> P.callout "😶" $ "No tests to run."
@ -2535,8 +2535,8 @@ displayRendered outputLoc pp =
displayTestResults ::
Bool -> -- whether to show the tip
[(HQ.HashQualified Name, Text)] ->
[(HQ.HashQualified Name, Text)] ->
[(HQ.HashQualified Name, [Text])] ->
[(HQ.HashQualified Name, [Text])] ->
Pretty
displayTestResults showTip oks fails =
let name = P.text . HQ.toText
@ -2545,11 +2545,11 @@ displayTestResults showTip oks fails =
then mempty
else
P.indentN 2 $
P.numberedColumn2ListFrom 0 [(P.green "" <> name r, " " <> P.green (P.text msg)) | (r, msg) <- oks]
P.numberedColumn2ListFrom 0 [(name r, P.lines $ P.green . ("" <>) . P.text <$> msgs) | (r, msgs) <- oks]
okSummary =
if null oks
then mempty
else "" <> P.bold (P.num (length oks)) <> P.green " test(s) passing"
else "" <> P.bold (P.num (sum $ fmap (length . snd) oks)) <> P.green " test(s) passing"
failMsg =
if null fails
then mempty
@ -2557,11 +2557,11 @@ displayTestResults showTip oks fails =
P.indentN 2 $
P.numberedColumn2ListFrom
(length oks)
[(P.red "" <> name r, " " <> P.red (P.text msg)) | (r, msg) <- fails]
[(name r, P.lines $ P.red . ("" <>) . P.text <$> msgs) | (r, msgs) <- fails]
failSummary =
if null fails
then mempty
else "🚫 " <> P.bold (P.num (length fails)) <> P.red " test(s) failing"
else "🚫 " <> P.bold (P.num (sum $ fmap (length . snd) fails)) <> P.red " test(s) failing"
tipMsg =
if not showTip || (null oks && null fails)
then mempty

View File

@ -41,11 +41,11 @@ relocateToNameRoot perspective query rootBranch = do
-- Since the project root is lower down we need to strip the part of the prefix
-- which is now redundant.
pure . Right $ (projectRoot, query <&> \n -> fromMaybe n $ Path.unprefixName (Path.Absolute remainder) n)
-- The namesRoot is _inside_ of the project containing the query
-- The namesRoot is _inside (or equal to)_ the project containing the query
(_sharedPrefix, remainder, Path.Empty) -> do
-- Since the project is higher up, we need to prefix the query
-- with the remainder of the path
pure $ Right (projectRoot, query <&> Path.prefixNameIfRel (Path.AbsolutePath' $ Path.Absolute remainder))
pure $ Right (projectRoot, query <&> Path.prefixNameIfRel (Path.RelativePath' $ Path.Relative remainder))
-- The namesRoot and project root are disjoint, this shouldn't ever happen.
(_, _, _) -> pure $ Left (DisjointProjectAndPerspective perspective projectRoot)

View File

@ -5,7 +5,7 @@ Thus, make sure the contents of this file define the contents of the cache
(e.g. don't pull `latest`.)
```ucm
.> pull @unison/base/releases/2.5.0 .base
.> builtins.mergeio
.> undo
scratch/main> pull @unison/base/releases/2.5.0 .base
scratch/main> builtins.mergeio
scratch/main> undo
```

View File

@ -5,12 +5,12 @@ If you want to add or update tests, you can create a branch of that project, and
Before merging the PR on Github, we'll merge your branch on Share and restore `runtime_tests_version` to /main or maybe a release.
```ucm:hide:error
.> this is a hack to trigger an error, in order to swallow any error on the next line.
.> we delete the project to avoid any merge conflicts or complaints from ucm.
.> delete.project runtime-tests
scratch/main> this is a hack to trigger an error, in order to swallow any error on the next line.
scratch/main> we delete the project to avoid any merge conflicts or complaints from ucm.
scratch/main> delete.project runtime-tests
```
```ucm:hide
.> clone ${runtime_tests_version} runtime-tests/selected
scratch/main> clone ${runtime_tests_version} runtime-tests/selected
```
```ucm

View File

@ -5,12 +5,12 @@ If you want to add or update tests, you can create a branch of that project, and
Before merging the PR on Github, we'll merge your branch on Share and restore `runtime_tests_version` to /main or maybe a release.
```ucm:hide:error
.> this is a hack to trigger an error, in order to swallow any error on the next line.
.> we delete the project to avoid any merge conflicts or complaints from ucm.
.> delete.project runtime-tests
scratch/main> this is a hack to trigger an error, in order to swallow any error on the next line.
scratch/main> we delete the project to avoid any merge conflicts or complaints from ucm.
scratch/main> delete.project runtime-tests
```
```ucm:hide
.> clone ${runtime_tests_version} runtime-tests/selected
scratch/main> clone ${runtime_tests_version} runtime-tests/selected
```
```ucm
@ -31,8 +31,8 @@ foo = do
```
```ucm
.> run.native foo
.> run.native foo
scratch/main> run.native foo
scratch/main> run.native foo
```
This can also only be tested by separately running this test, because

View File

@ -1,6 +1,6 @@
```ucm:hide
.> pull unison.public.base.releases.M4d base
.> pull runarorama.public.sort.data sort
scratch/main> pull unison.public.base.releases.M4d base
scratch/main> pull runarorama.public.sort.data sort
```
```unison:hide
@ -34,63 +34,63 @@ prepare = do
```
```ucm:hide
.> add
.> run prepare
scratch/main> add
scratch/main> run prepare
```
## Benchmarks
```ucm
.> load unison-src/transcripts-manual/benchmarks/each.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/each.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/listmap.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/listmap.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/listfilter.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/listfilter.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/random.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/random.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/simpleloop.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/simpleloop.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/fibonacci.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/fibonacci.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/map.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/map.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/natmap.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/natmap.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/stm.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/stm.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/tmap.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/tmap.u
scratch/main> run main
```
```ucm
.> load unison-src/transcripts-manual/benchmarks/array-sort.u
.> run main
scratch/main> load unison-src/transcripts-manual/benchmarks/array-sort.u
scratch/main> run main
```

View File

@ -1,6 +1,5 @@
```ucm
.> project.create test-html-docs
test-html-docs/main> builtins.merge
test-html-docs/main> builtins.mergeio lib.builtins
```
```unison

View File

@ -1,26 +1,5 @@
```ucm
.> project.create test-html-docs
🎉 I've created the project test-html-docs.
I'll now fetch the latest version of the base Unison
library...
Downloaded 14053 entities.
🎨 Type `ui` to explore this project's code in your browser.
🔭 Discover libraries at https://share.unison-lang.org
📖 Use `help-topic projects` to learn more about projects.
Write your first Unison code with UCM:
1. Open scratch.u.
2. Write some Unison code and save the file.
3. In UCM, type `add` to save it to your new project.
🎉 🥳 Happy coding!
test-html-docs/main> builtins.merge
test-html-docs/main> builtins.mergeio lib.builtins
Done.
@ -47,13 +26,11 @@ some.outside = 3
⍟ These new definitions are ok to `add`:
some.ns.direct : Nat
some.ns.direct.doc : Doc
some.ns.direct.doc : Doc2
some.ns.pretty.deeply.nested : Nat
(also named lib.base.data.Map.internal.ratio)
some.ns.pretty.deeply.nested.doc : Doc
some.ns.pretty.deeply.nested.doc : Doc2
some.outside : Nat
(also named lib.base.data.Map.internal.delta)
some.outside.doc : Doc
some.outside.doc : Doc2
```
```ucm
@ -62,13 +39,11 @@ test-html-docs/main> add
⍟ I've added these definitions:
some.ns.direct : Nat
some.ns.direct.doc : Doc
some.ns.direct.doc : Doc2
some.ns.pretty.deeply.nested : Nat
(also named lib.base.data.Map.internal.ratio)
some.ns.pretty.deeply.nested.doc : Doc
some.ns.pretty.deeply.nested.doc : Doc2
some.outside : Nat
(also named lib.base.data.Map.internal.delta)
some.outside.doc : Doc
some.outside.doc : Doc2
test-html-docs/main> docs.to-html some.ns unison-src/transcripts-manual/docs.to-html

View File

@ -3,5 +3,5 @@
Note: this makes a network call to share to get completions
```ucm
.> debug.tab-complete pull unison.pub
scratch/main> debug.tab-complete pull unison.pub
```

View File

@ -1,8 +1,8 @@
```ucm:hide
.> builtins.mergeio
.> load unison-src/transcripts-using-base/base.u
.> add
scratch/main> builtins.mergeio
scratch/main> load unison-src/transcripts-using-base/base.u
scratch/main> add
```
## Structural find and replace
@ -37,19 +37,19 @@ rule2 x = @rewrite signature Optional ==> Optional2
Let's rewrite these:
```ucm
.> rewrite rule1
.> rewrite eitherToOptional
scratch/main> rewrite rule1
scratch/main> rewrite eitherToOptional
```
```ucm:hide
.> load
.> add
scratch/main> load
scratch/main> add
```
After adding to the codebase, here's the rewritten source:
```ucm
.> view ex1 Either.mapRight rule1
scratch/main> view ex1 Either.mapRight rule1
```
Another example, showing that we can rewrite to definitions that only exist in the file:
@ -75,18 +75,18 @@ blah2 = 456
Let's apply the rewrite `woot1to2`:
```ucm
.> rewrite woot1to2
scratch/main> rewrite woot1to2
```
```ucm:hide
.> load
.> add
scratch/main> load
scratch/main> add
```
After adding the rewritten form to the codebase, here's the rewritten `Woot1` to `Woot2`:
```ucm
.> view wootEx
scratch/main> view wootEx
```
This example shows that rewrite rules can to refer to term definitions that only exist in the file:
@ -111,15 +111,15 @@ sameFileEx =
```
```ucm:hide
.> rewrite rule
.> load
.> add
scratch/main> rewrite rule
scratch/main> load
scratch/main> add
```
After adding the rewritten form to the codebase, here's the rewritten definitions:
```ucm
.> view foo1 foo2 sameFileEx
scratch/main> view foo1 foo2 sameFileEx
```
## Capture avoidance
@ -145,13 +145,13 @@ sameFileEx =
In the above example, `bar2` is locally bound by the rule, so when applied, it should not refer to the `bar2` top level binding.
```ucm
.> rewrite rule
scratch/main> rewrite rule
```
Instead, it should be an unbound free variable, which doesn't typecheck:
```ucm:error
.> load
scratch/main> load
```
In this example, the `a` is locally bound by the rule, so it shouldn't capture the `a = 39494` binding which is in scope at the point of the replacement:
@ -167,13 +167,13 @@ rule a = @rewrite
```
```ucm
.> rewrite rule
scratch/main> rewrite rule
```
The `a` introduced will be freshened to not capture the `a` in scope, so it remains as an unbound variable and is a type error:
```ucm:error
.> load
scratch/main> load
```
## Structural find
@ -183,7 +183,7 @@ eitherEx = Left ("hello", "there")
```
```ucm:hide
.> add
scratch/main> add
```
```unison:hide
@ -192,7 +192,7 @@ findEitherFailure = @rewrite signature a . Either Failure a ==> ()
```
```ucm
.> sfind findEitherEx
.> sfind findEitherFailure
.> find 1-5
scratch/main> sfind findEitherEx
scratch/main> sfind findEitherFailure
scratch/main> find 1-5
```

View File

@ -31,7 +31,7 @@ rule2 x = @rewrite signature Optional ==> Optional2
Let's rewrite these:
```ucm
.> rewrite rule1
scratch/main> rewrite rule1
☝️
@ -39,7 +39,7 @@ Let's rewrite these:
The rewritten file has been added to the top of scratch.u
.> rewrite eitherToOptional
scratch/main> rewrite eitherToOptional
☝️
@ -112,7 +112,7 @@ rule2 x = @rewrite signature Optional ==> Optional2
After adding to the codebase, here's the rewritten source:
```ucm
.> view ex1 Either.mapRight rule1
scratch/main> view ex1 Either.mapRight rule1
Either.mapRight : (a ->{g} b) -> Optional a ->{g} Optional b
Either.mapRight f = cases
@ -158,7 +158,7 @@ blah2 = 456
Let's apply the rewrite `woot1to2`:
```ucm
.> rewrite woot1to2
scratch/main> rewrite woot1to2
☝️
@ -194,7 +194,7 @@ blah2 = 456
After adding the rewritten form to the codebase, here's the rewritten `Woot1` to `Woot2`:
```ucm
.> view wootEx
scratch/main> view wootEx
wootEx : Nat ->{Woot2} Nat
wootEx a =
@ -226,7 +226,7 @@ sameFileEx =
After adding the rewritten form to the codebase, here's the rewritten definitions:
```ucm
.> view foo1 foo2 sameFileEx
scratch/main> view foo1 foo2 sameFileEx
foo1 : Nat
foo1 =
@ -267,7 +267,7 @@ sameFileEx =
In the above example, `bar2` is locally bound by the rule, so when applied, it should not refer to the `bar2` top level binding.
```ucm
.> rewrite rule
scratch/main> rewrite rule
☝️
@ -301,7 +301,7 @@ sameFileEx =
Instead, it should be an unbound free variable, which doesn't typecheck:
```ucm
.> load
scratch/main> load
Loading changes detected in scratch.u.
@ -332,7 +332,7 @@ rule a = @rewrite
```
```ucm
.> rewrite rule
scratch/main> rewrite rule
☝️
@ -358,7 +358,7 @@ rule a =
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
.> load
scratch/main> load
Loading changes detected in scratch.u.
@ -388,7 +388,7 @@ findEitherFailure = @rewrite signature a . Either Failure a ==> ()
```
```ucm
.> sfind findEitherEx
scratch/main> sfind findEitherEx
🔎
@ -398,7 +398,7 @@ findEitherFailure = @rewrite signature a . Either Failure a ==> ()
Tip: Try `edit 1` to bring this into your scratch file.
.> sfind findEitherFailure
scratch/main> sfind findEitherFailure
🔎
@ -413,7 +413,7 @@ findEitherFailure = @rewrite signature a . Either Failure a ==> ()
Tip: Try `edit 1` or `edit 1-5` to bring these into your
scratch file.
.> find 1-5
scratch/main> find 1-5
1. Exception.catch : '{g, Exception} a ->{g} Either Failure a
2. Exception.reraise : Either Failure a ->{Exception} a

View File

@ -2,8 +2,8 @@ This transcript executes very slowly, because the compiler has an
entire copy of base (and other stuff) within it.
```ucm:hide
.> builtins.merge
.> pull.without-history unison.public.base.trunk base
scratch/main> builtins.merge
scratch/main> pull.without-history unison.public.base.trunk base
```
```unison
@ -55,7 +55,7 @@ multiAddUp = repeat 35 '(printAddUp 3000000)
```
```ucm
.> add
.> run singleAddUp
.> run.native multiAddUp
scratch/main> add
scratch/main> run singleAddUp
scratch/main> run.native multiAddUp
```

View File

@ -10,9 +10,9 @@ transcripts which contain less boilerplate.
## Usage
```ucm:hide
.> builtins.mergeio
.> load unison-src/transcripts-using-base/base.u
.> add
scratch/main> builtins.mergeio
scratch/main> load unison-src/transcripts-using-base/base.u
scratch/main> add
```
The test shows that `hex (fromHex str) == str` as expected.
@ -24,7 +24,7 @@ test> hex.tests.ex1 = checks let
```
```ucm:hide
.> test
scratch/main> test
```
Lets do some basic testing of our test harness to make sure its
@ -50,6 +50,6 @@ testAutoClean _ =
```
```ucm
.> add
.> io.test testAutoClean
scratch/main> add
scratch/main> io.test testAutoClean
```

View File

@ -53,18 +53,18 @@ testAutoClean _ =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
testAutoClean : '{IO} [Result]
.> io.test testAutoClean
scratch/main> io.test testAutoClean
New test results:
1. testAutoClean our temporary directory should exist
2. testAutoClean our temporary directory should no longer exist
1. testAutoClean our temporary directory should exist
our temporary directory should no longer exist
✅ 2 test(s) passing

View File

@ -1,5 +1,5 @@
This transcript is intended to make visible accidental changes to the hashing algorithm.
```ucm
.> find.verbose
scratch/main> find.verbose
```

View File

@ -1,7 +1,7 @@
This transcript is intended to make visible accidental changes to the hashing algorithm.
```ucm
.> find.verbose
scratch/main> find.verbose
1. -- #sgesq8035ut22q779pl1g4gqsg8c81894jjonmrq1bjltphkath225up841hk8dku59tnnc4laj9nggbofamgei4klof0ldc20uj2oo
<| : (i ->{g} o) -> i ->{g} o

View File

@ -54,6 +54,6 @@ testABunchOfNats _ =
```
```ucm
.> add
.> io.test testABunchOfNats
scratch/main> add
scratch/main> io.test testABunchOfNats
```

View File

@ -76,7 +76,7 @@ testABunchOfNats _ =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -91,78 +91,78 @@ testABunchOfNats _ =
testNat : Nat -> '{IO, Stream Result} ()
testRoundTrip : Nat -> EncDec ->{IO, Stream Result} ()
.> io.test testABunchOfNats
scratch/main> io.test testABunchOfNats
New test results:
1. testABunchOfNats successfully decoded 4294967295 using 64 bit Big Endian
2. ◉ testABunchOfNats consumed all input
3. ◉ testABunchOfNats successfully decoded 4294967295 using 64 bit Little Endian
4. ◉ testABunchOfNats consumed all input
5. ◉ testABunchOfNats successfully decoded 4294967295 using 32 bit Big Endian
6. ◉ testABunchOfNats consumed all input
7. ◉ testABunchOfNats successfully decoded 4294967295 using 32 bit Little Endian
8. ◉ testABunchOfNats consumed all input
9. ◉ testABunchOfNats successfully decoded 1090519040 using 64 bit Big Endian
10. ◉ testABunchOfNats consumed all input
11. ◉ testABunchOfNats successfully decoded 1090519040 using 64 bit Little Endian
12. ◉ testABunchOfNats consumed all input
13. ◉ testABunchOfNats successfully decoded 1090519040 using 32 bit Big Endian
14. ◉ testABunchOfNats consumed all input
15. ◉ testABunchOfNats successfully decoded 1090519040 using 32 bit Little Endian
16. ◉ testABunchOfNats consumed all input
17. ◉ testABunchOfNats successfully decoded 4259840 using 64 bit Big Endian
18. ◉ testABunchOfNats consumed all input
19. ◉ testABunchOfNats successfully decoded 4259840 using 64 bit Little Endian
20. ◉ testABunchOfNats consumed all input
21. ◉ testABunchOfNats successfully decoded 4259840 using 32 bit Big Endian
22. ◉ testABunchOfNats consumed all input
23. ◉ testABunchOfNats successfully decoded 4259840 using 32 bit Little Endian
24. ◉ testABunchOfNats consumed all input
25. ◉ testABunchOfNats successfully decoded 16640 using 64 bit Big Endian
26. ◉ testABunchOfNats consumed all input
27. ◉ testABunchOfNats successfully decoded 16640 using 64 bit Little Endian
28. ◉ testABunchOfNats consumed all input
29. ◉ testABunchOfNats successfully decoded 16640 using 32 bit Big Endian
30. ◉ testABunchOfNats consumed all input
31. ◉ testABunchOfNats successfully decoded 16640 using 32 bit Little Endian
32. ◉ testABunchOfNats consumed all input
33. ◉ testABunchOfNats successfully decoded 16640 using 16 bit Big Endian
34. ◉ testABunchOfNats consumed all input
35. ◉ testABunchOfNats successfully decoded 16640 using 16 bit Little Endian
36. ◉ testABunchOfNats consumed all input
37. ◉ testABunchOfNats successfully decoded 2255827097 using 64 bit Big Endian
38. ◉ testABunchOfNats consumed all input
39. ◉ testABunchOfNats successfully decoded 2255827097 using 64 bit Little Endian
40. ◉ testABunchOfNats consumed all input
41. ◉ testABunchOfNats successfully decoded 2255827097 using 32 bit Big Endian
42. ◉ testABunchOfNats consumed all input
43. ◉ testABunchOfNats successfully decoded 2255827097 using 32 bit Little Endian
44. ◉ testABunchOfNats consumed all input
45. ◉ testABunchOfNats successfully decoded 65 using 64 bit Big Endian
46. ◉ testABunchOfNats consumed all input
47. ◉ testABunchOfNats successfully decoded 65 using 64 bit Little Endian
48. ◉ testABunchOfNats consumed all input
49. ◉ testABunchOfNats successfully decoded 65 using 32 bit Big Endian
50. ◉ testABunchOfNats consumed all input
51. ◉ testABunchOfNats successfully decoded 65 using 32 bit Little Endian
52. ◉ testABunchOfNats consumed all input
53. ◉ testABunchOfNats successfully decoded 65 using 16 bit Big Endian
54. ◉ testABunchOfNats consumed all input
55. ◉ testABunchOfNats successfully decoded 65 using 16 bit Little Endian
56. ◉ testABunchOfNats consumed all input
57. ◉ testABunchOfNats successfully decoded 0 using 64 bit Big Endian
58. ◉ testABunchOfNats consumed all input
59. ◉ testABunchOfNats successfully decoded 0 using 64 bit Little Endian
60. ◉ testABunchOfNats consumed all input
61. ◉ testABunchOfNats successfully decoded 0 using 32 bit Big Endian
62. ◉ testABunchOfNats consumed all input
63. ◉ testABunchOfNats successfully decoded 0 using 32 bit Little Endian
64. ◉ testABunchOfNats consumed all input
65. ◉ testABunchOfNats successfully decoded 0 using 16 bit Big Endian
66. ◉ testABunchOfNats consumed all input
67. ◉ testABunchOfNats successfully decoded 0 using 16 bit Little Endian
68. ◉ testABunchOfNats consumed all input
1. testABunchOfNats successfully decoded 4294967295 using 64 bit Big Endian
consumed all input
successfully decoded 4294967295 using 64 bit Little Endian
consumed all input
successfully decoded 4294967295 using 32 bit Big Endian
consumed all input
successfully decoded 4294967295 using 32 bit Little Endian
consumed all input
successfully decoded 1090519040 using 64 bit Big Endian
consumed all input
successfully decoded 1090519040 using 64 bit Little Endian
consumed all input
successfully decoded 1090519040 using 32 bit Big Endian
consumed all input
successfully decoded 1090519040 using 32 bit Little Endian
consumed all input
successfully decoded 4259840 using 64 bit Big Endian
consumed all input
successfully decoded 4259840 using 64 bit Little Endian
consumed all input
successfully decoded 4259840 using 32 bit Big Endian
consumed all input
successfully decoded 4259840 using 32 bit Little Endian
consumed all input
successfully decoded 16640 using 64 bit Big Endian
consumed all input
successfully decoded 16640 using 64 bit Little Endian
consumed all input
successfully decoded 16640 using 32 bit Big Endian
consumed all input
successfully decoded 16640 using 32 bit Little Endian
consumed all input
successfully decoded 16640 using 16 bit Big Endian
consumed all input
successfully decoded 16640 using 16 bit Little Endian
consumed all input
successfully decoded 2255827097 using 64 bit Big Endian
consumed all input
successfully decoded 2255827097 using 64 bit Little Endian
consumed all input
successfully decoded 2255827097 using 32 bit Big Endian
consumed all input
successfully decoded 2255827097 using 32 bit Little Endian
consumed all input
successfully decoded 65 using 64 bit Big Endian
consumed all input
successfully decoded 65 using 64 bit Little Endian
consumed all input
successfully decoded 65 using 32 bit Big Endian
consumed all input
successfully decoded 65 using 32 bit Little Endian
consumed all input
successfully decoded 65 using 16 bit Big Endian
consumed all input
successfully decoded 65 using 16 bit Little Endian
consumed all input
successfully decoded 0 using 64 bit Big Endian
consumed all input
successfully decoded 0 using 64 bit Little Endian
consumed all input
successfully decoded 0 using 32 bit Big Endian
consumed all input
successfully decoded 0 using 32 bit Little Endian
consumed all input
successfully decoded 0 using 16 bit Big Endian
consumed all input
successfully decoded 0 using 16 bit Little Endian
consumed all input
✅ 68 test(s) passing

View File

@ -153,7 +153,7 @@ swapped name link =
```
```ucm
.> add
scratch/main> add
```
```unison
@ -236,9 +236,9 @@ we gain the ability to capture output in a transcript, it can be modified
to actual show that the serialization works.
```ucm
.> add
.> io.test tests
.> io.test badLoad
scratch/main> add
scratch/main> io.test tests
scratch/main> io.test badLoad
```
```unison
@ -278,8 +278,8 @@ codeTests =
```
```ucm
.> add
.> io.test codeTests
scratch/main> add
scratch/main> io.test codeTests
```
```unison
@ -309,6 +309,6 @@ vtests _ =
```
```ucm
.> add
.> io.test vtests
scratch/main> add
scratch/main> io.test vtests
```

View File

@ -200,7 +200,7 @@ swapped name link =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -344,7 +344,7 @@ we gain the ability to capture output in a transcript, it can be modified
to actual show that the serialization works.
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -360,33 +360,33 @@ to actual show that the serialization works.
tests : '{IO} [Result]
zapper : Three Nat Nat Nat -> Request {Zap} r -> r
.> io.test tests
scratch/main> io.test tests
New test results:
1. tests (ext f) passed
2. ◉ tests (ext h) passed
3. ◉ tests (ident compound) passed
4. ◉ tests (ident fib10) passed
5. ◉ tests (ident effect) passed
6. ◉ tests (ident zero) passed
7. ◉ tests (ident h) passed
8. ◉ tests (ident text) passed
9. ◉ tests (ident int) passed
10. ◉ tests (ident float) passed
11. ◉ tests (ident termlink) passed
12. ◉ tests (ident bool) passed
13. ◉ tests (ident bytes) passed
1. tests (ext f) passed
(ext h) passed
(ident compound) passed
(ident fib10) passed
(ident effect) passed
(ident zero) passed
(ident h) passed
(ident text) passed
(ident int) passed
(ident float) passed
(ident termlink) passed
(ident bool) passed
(ident bytes) passed
✅ 13 test(s) passing
Tip: Use view 1 to view the source of a test.
.> io.test badLoad
scratch/main> io.test badLoad
New test results:
1. badLoad serialized77
1. badLoad serialized77
✅ 1 test(s) passing
@ -443,46 +443,46 @@ codeTests =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
codeTests : '{IO} [Result]
.> io.test codeTests
scratch/main> io.test codeTests
New test results:
1. codeTests (idem f) passed
2. ◉ codeTests (idem h) passed
3. ◉ codeTests (idem rotate) passed
4. ◉ codeTests (idem zapper) passed
5. ◉ codeTests (idem showThree) passed
6. ◉ codeTests (idem concatMap) passed
7. ◉ codeTests (idem big) passed
8. ◉ codeTests (idem extensionality) passed
9. ◉ codeTests (idem identicality) passed
10. ◉ codeTests (verified f) passed
11. ◉ codeTests (verified h) passed
12. ◉ codeTests (verified rotate) passed
13. ◉ codeTests (verified zapper) passed
14. ◉ codeTests (verified showThree) passed
15. ◉ codeTests (verified concatMap) passed
16. ◉ codeTests (verified big) passed
17. ◉ codeTests (verified extensionality) passed
18. ◉ codeTests (verified identicality) passed
19. ◉ codeTests (verified mutual0) passed
20. ◉ codeTests (verified mutual1) passed
21. ◉ codeTests (verified mutual2) passed
22. ◉ codeTests (rejected missing mutual0) passed
23. ◉ codeTests (rejected missing mutual1) passed
24. ◉ codeTests (rejected missing mutual2) passed
25. ◉ codeTests (rejected swapped zapper) passed
26. ◉ codeTests (rejected swapped extensionality) passed
27. ◉ codeTests (rejected swapped identicality) passed
28. ◉ codeTests (rejected swapped mututal0) passed
29. ◉ codeTests (rejected swapped mututal1) passed
30. ◉ codeTests (rejected swapped mututal2) passed
1. codeTests (idem f) passed
(idem h) passed
(idem rotate) passed
(idem zapper) passed
(idem showThree) passed
(idem concatMap) passed
(idem big) passed
(idem extensionality) passed
(idem identicality) passed
(verified f) passed
(verified h) passed
(verified rotate) passed
(verified zapper) passed
(verified showThree) passed
(verified concatMap) passed
(verified big) passed
(verified extensionality) passed
(verified identicality) passed
(verified mutual0) passed
(verified mutual1) passed
(verified mutual2) passed
(rejected missing mutual0) passed
(rejected missing mutual1) passed
(rejected missing mutual2) passed
(rejected swapped zapper) passed
(rejected swapped extensionality) passed
(rejected swapped identicality) passed
(rejected swapped mututal0) passed
(rejected swapped mututal1) passed
(rejected swapped mututal2) passed
✅ 30 test(s) passing
@ -530,25 +530,25 @@ vtests _ =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
validateTest : Link.Term ->{IO} Result
vtests : '{IO} [Result]
.> io.test vtests
scratch/main> io.test vtests
New test results:
1. vtests validated
2. vtests validated
3. vtests validated
4. vtests validated
5. vtests validated
6. vtests validated
7. vtests validated
8. vtests validated
1. vtests validated
validated
validated
validated
validated
validated
validated
validated
✅ 8 test(s) passing

View File

@ -33,9 +33,9 @@ Notice that an anonymous documentation block `{{ ... }}` before a definition `Im
You can preview what docs will look like when rendered to the console using the `display` or `docs` commands:
```ucm
.> display d1
.> docs ImportantConstant
.> docs DayOfWeek
scratch/main> display d1
scratch/main> docs ImportantConstant
scratch/main> docs DayOfWeek
```
The `docs ImportantConstant` command will look for `ImportantConstant.doc` in the file or codebase. You can do this instead of explicitly linking docs to definitions.
@ -45,11 +45,11 @@ The `docs ImportantConstant` command will look for `ImportantConstant.doc` in th
First, we'll load the `syntax.u` file which has examples of all the syntax:
```ucm
.> load ./unison-src/transcripts-using-base/doc.md.files/syntax.u
scratch/main> load ./unison-src/transcripts-using-base/doc.md.files/syntax.u
```
```ucm:hide
.> add
scratch/main> add
```
Now we can review different portions of the guide.
@ -57,25 +57,25 @@ we'll show both the pretty-printed source using `view`
and the rendered output using `display`:
```ucm
.> view basicFormatting
.> display basicFormatting
.> view lists
.> display lists
.> view evaluation
.> display evaluation
.> view includingSource
.> display includingSource
.> view nonUnisonCodeBlocks
.> display nonUnisonCodeBlocks
.> view otherElements
.> display otherElements
scratch/main> view basicFormatting
scratch/main> display basicFormatting
scratch/main> view lists
scratch/main> display lists
scratch/main> view evaluation
scratch/main> display evaluation
scratch/main> view includingSource
scratch/main> display includingSource
scratch/main> view nonUnisonCodeBlocks
scratch/main> display nonUnisonCodeBlocks
scratch/main> view otherElements
scratch/main> display otherElements
```
Lastly, it's common to build longer documents including subdocuments via `{{ subdoc }}`. We can stitch together the full syntax guide in this way:
```ucm
.> view doc.guide
.> display doc.guide
scratch/main> view doc.guide
scratch/main> display doc.guide
```
🌻 THE END

View File

@ -51,15 +51,15 @@ Notice that an anonymous documentation block `{{ ... }}` before a definition `Im
You can preview what docs will look like when rendered to the console using the `display` or `docs` commands:
```ucm
.> display d1
scratch/main> display d1
Hello there Alice!
.> docs ImportantConstant
scratch/main> docs ImportantConstant
An important constant, equal to `42`
.> docs DayOfWeek
scratch/main> docs DayOfWeek
The 7 days of the week, defined as:
@ -73,7 +73,7 @@ The `docs ImportantConstant` command will look for `ImportantConstant.doc` in th
First, we'll load the `syntax.u` file which has examples of all the syntax:
```ucm
.> load ./unison-src/transcripts-using-base/doc.md.files/syntax.u
scratch/main> load ./unison-src/transcripts-using-base/doc.md.files/syntax.u
Loading changes detected in
./unison-src/transcripts-using-base/doc.md.files/syntax.u.
@ -100,7 +100,7 @@ we'll show both the pretty-printed source using `view`
and the rendered output using `display`:
```ucm
.> view basicFormatting
scratch/main> view basicFormatting
basicFormatting : Doc2
basicFormatting =
@ -130,7 +130,7 @@ and the rendered output using `display`:
__Next up:__ {lists}
}}
.> display basicFormatting
scratch/main> display basicFormatting
# Basic formatting
@ -155,7 +155,7 @@ and the rendered output using `display`:
*Next up:* lists
.> view lists
scratch/main> view lists
lists : Doc2
lists =
@ -198,7 +198,7 @@ and the rendered output using `display`:
3. Get dressed.
}}
.> display lists
scratch/main> display lists
# Lists
@ -237,7 +237,7 @@ and the rendered output using `display`:
2. Take shower.
3. Get dressed.
.> view evaluation
scratch/main> view evaluation
evaluation : Doc2
evaluation =
@ -272,7 +272,7 @@ and the rendered output using `display`:
```
}}
.> display evaluation
scratch/main> display evaluation
# Evaluation
@ -300,7 +300,7 @@ and the rendered output using `display`:
cube : Nat -> Nat
cube x = x * x * x
.> view includingSource
scratch/main> view includingSource
includingSource : Doc2
includingSource =
@ -341,7 +341,7 @@ and the rendered output using `display`:
{{ docExample 1 do x -> sqr x }}.
}}
.> display includingSource
scratch/main> display includingSource
# Including Unison source code
@ -387,7 +387,7 @@ and the rendered output using `display`:
application, you can put it in double backticks, like
so: `sqr x`. This is equivalent to `sqr x`.
.> view nonUnisonCodeBlocks
scratch/main> view nonUnisonCodeBlocks
nonUnisonCodeBlocks : Doc2
nonUnisonCodeBlocks =
@ -420,7 +420,7 @@ and the rendered output using `display`:
```
}}
.> display nonUnisonCodeBlocks
scratch/main> display nonUnisonCodeBlocks
# Non-Unison code blocks
@ -449,7 +449,7 @@ and the rendered output using `display`:
xs.foldLeft(Nil : List[A])((acc,a) => a +: acc)
```
.> view otherElements
scratch/main> view otherElements
otherElements : Doc2
otherElements =
@ -506,7 +506,7 @@ and the rendered output using `display`:
] }}
}}
.> display otherElements
scratch/main> display otherElements
There are also asides, callouts, tables, tooltips, and more.
These don't currently have special syntax; just use the
@ -549,7 +549,7 @@ and the rendered output using `display`:
Lastly, it's common to build longer documents including subdocuments via `{{ subdoc }}`. We can stitch together the full syntax guide in this way:
```ucm
.> view doc.guide
scratch/main> view doc.guide
doc.guide : Doc2
doc.guide =
@ -569,7 +569,7 @@ Lastly, it's common to build longer documents including subdocuments via `{{ sub
{{ otherElements }}
}}
.> display doc.guide
scratch/main> display doc.guide
# Unison computable documentation

View File

@ -19,13 +19,13 @@ test2 = do
```
```ucm
.> add
scratch/main> add
```
```ucm:error
.> io.test test1
scratch/main> io.test test1
```
```ucm:error
.> io.test test2
scratch/main> io.test test2
```

View File

@ -33,7 +33,7 @@ test2 = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -42,7 +42,7 @@ test2 = do
```
```ucm
.> io.test test1
scratch/main> io.test test1
💔💥
@ -58,7 +58,7 @@ test2 = do
```
```ucm
.> io.test test2
scratch/main> io.test test2
💔💥

View File

@ -10,5 +10,5 @@ timingApp2 _ =
```
```ucm
.> run timingApp2
scratch/main> run timingApp2
```

View File

@ -23,7 +23,7 @@ timingApp2 _ =
```
```ucm
.> run timingApp2
scratch/main> run timingApp2
()

View File

@ -6,7 +6,7 @@ meh = 9
```
```ucm
.> add
.> find meh
.> docs 1
scratch/main> add
scratch/main> find meh
scratch/main> docs 1
```

View File

@ -20,20 +20,20 @@ meh = 9
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
meh : Nat
meh.doc : Doc2
.> find meh
scratch/main> find meh
1. meh : Nat
2. meh.doc : Doc2
.> docs 1
scratch/main> docs 1
A simple doc.

View File

@ -3,7 +3,7 @@
Unison has cryptographic builtins for hashing and computing [HMACs](https://en.wikipedia.org/wiki/HMAC) (hash-based message authentication codes). This transcript shows their usage and has some test cases.
```ucm
.> ls builtin.Bytes
scratch/main> ls builtin.Bytes
```
Notice the `fromBase16` and `toBase16` functions. Here's some convenience functions for converting `Bytes` to and from base-16 `Text`.
@ -43,7 +43,7 @@ ex5 = crypto.hmac Sha2_256 mysecret f |> hex
And here's the full API:
```ucm
.> find-in builtin.crypto
scratch/main> find-in builtin.crypto
```
Note that the universal versions of `hash` and `hmac` are currently unimplemented and will bomb at runtime:
@ -189,11 +189,11 @@ test> crypto.hash.numTests =
```
```ucm:hide
.> add
scratch/main> add
```
```ucm
.> test
scratch/main> test
```
## HMAC tests
@ -251,9 +251,9 @@ test> md5.tests.ex3 =
```
```ucm:hide
.> add
scratch/main> add
```
```ucm
.> test
scratch/main> test
```

View File

@ -3,7 +3,7 @@
Unison has cryptographic builtins for hashing and computing [HMACs](https://en.wikipedia.org/wiki/HMAC) (hash-based message authentication codes). This transcript shows their usage and has some test cases.
```ucm
.> ls builtin.Bytes
scratch/main> ls builtin.Bytes
1. ++ (Bytes -> Bytes -> Bytes)
2. at (Nat -> Bytes -> Optional Nat)
@ -120,7 +120,7 @@ ex5 = crypto.hmac Sha2_256 mysecret f |> hex
And here's the full API:
```ucm
.> find-in builtin.crypto
scratch/main> find-in builtin.crypto
1. type CryptoFailure
2. Ed25519.sign.impl : Bytes
@ -312,35 +312,35 @@ test> crypto.hash.numTests =
```
```ucm
.> test
scratch/main> test
Cached test results (`help testcache` to learn more)
1. blake2b_512.tests.ex1 Passed
2. blake2b_512.tests.ex2 Passed
3. blake2b_512.tests.ex3 Passed
4. blake2s_256.tests.ex1 Passed
5. crypto.hash.numTests Passed
6. sha1.tests.ex1 Passed
7. sha1.tests.ex2 Passed
8. sha1.tests.ex3 Passed
9. sha1.tests.ex4 Passed
10. sha2_256.tests.ex1 Passed
11. sha2_256.tests.ex2 Passed
12. sha2_256.tests.ex3 Passed
13. sha2_256.tests.ex4 Passed
14. sha2_512.tests.ex1 Passed
15. sha2_512.tests.ex2 Passed
16. sha2_512.tests.ex3 Passed
17. sha2_512.tests.ex4 Passed
18. sha3_256.tests.ex1 Passed
19. sha3_256.tests.ex2 Passed
20. sha3_256.tests.ex3 Passed
21. sha3_256.tests.ex4 Passed
22. sha3_512.tests.ex1 Passed
23. sha3_512.tests.ex2 Passed
24. sha3_512.tests.ex3 Passed
25. sha3_512.tests.ex4 Passed
1. blake2b_512.tests.ex1 Passed
2. blake2b_512.tests.ex2 Passed
3. blake2b_512.tests.ex3 Passed
4. blake2s_256.tests.ex1 Passed
5. crypto.hash.numTests Passed
6. sha1.tests.ex1 Passed
7. sha1.tests.ex2 Passed
8. sha1.tests.ex3 Passed
9. sha1.tests.ex4 Passed
10. sha2_256.tests.ex1 Passed
11. sha2_256.tests.ex2 Passed
12. sha2_256.tests.ex3 Passed
13. sha2_256.tests.ex4 Passed
14. sha2_512.tests.ex1 Passed
15. sha2_512.tests.ex2 Passed
16. sha2_512.tests.ex3 Passed
17. sha2_512.tests.ex4 Passed
18. sha3_256.tests.ex1 Passed
19. sha3_256.tests.ex2 Passed
20. sha3_256.tests.ex3 Passed
21. sha3_256.tests.ex4 Passed
22. sha3_512.tests.ex1 Passed
23. sha3_512.tests.ex2 Passed
24. sha3_512.tests.ex3 Passed
25. sha3_512.tests.ex4 Passed
✅ 25 test(s) passing
@ -474,38 +474,38 @@ test> md5.tests.ex3 =
```
```ucm
.> test
scratch/main> test
Cached test results (`help testcache` to learn more)
1. blake2b_512.tests.ex1 Passed
2. blake2b_512.tests.ex2 Passed
3. blake2b_512.tests.ex3 Passed
4. blake2s_256.tests.ex1 Passed
5. crypto.hash.numTests Passed
6. md5.tests.ex1 Passed
7. md5.tests.ex2 Passed
8. md5.tests.ex3 Passed
9. sha1.tests.ex1 Passed
10. sha1.tests.ex2 Passed
11. sha1.tests.ex3 Passed
12. sha1.tests.ex4 Passed
13. sha2_256.tests.ex1 Passed
14. sha2_256.tests.ex2 Passed
15. sha2_256.tests.ex3 Passed
16. sha2_256.tests.ex4 Passed
17. sha2_512.tests.ex1 Passed
18. sha2_512.tests.ex2 Passed
19. sha2_512.tests.ex3 Passed
20. sha2_512.tests.ex4 Passed
21. sha3_256.tests.ex1 Passed
22. sha3_256.tests.ex2 Passed
23. sha3_256.tests.ex3 Passed
24. sha3_256.tests.ex4 Passed
25. sha3_512.tests.ex1 Passed
26. sha3_512.tests.ex2 Passed
27. sha3_512.tests.ex3 Passed
28. sha3_512.tests.ex4 Passed
1. blake2b_512.tests.ex1 Passed
2. blake2b_512.tests.ex2 Passed
3. blake2b_512.tests.ex3 Passed
4. blake2s_256.tests.ex1 Passed
5. crypto.hash.numTests Passed
6. md5.tests.ex1 Passed
7. md5.tests.ex2 Passed
8. md5.tests.ex3 Passed
9. sha1.tests.ex1 Passed
10. sha1.tests.ex2 Passed
11. sha1.tests.ex3 Passed
12. sha1.tests.ex4 Passed
13. sha2_256.tests.ex1 Passed
14. sha2_256.tests.ex2 Passed
15. sha2_256.tests.ex3 Passed
16. sha2_256.tests.ex4 Passed
17. sha2_512.tests.ex1 Passed
18. sha2_512.tests.ex2 Passed
19. sha2_512.tests.ex3 Passed
20. sha2_512.tests.ex4 Passed
21. sha3_256.tests.ex1 Passed
22. sha3_256.tests.ex2 Passed
23. sha3_256.tests.ex3 Passed
24. sha3_256.tests.ex4 Passed
25. sha3_512.tests.ex1 Passed
26. sha3_512.tests.ex2 Passed
27. sha3_512.tests.ex3 Passed
28. sha3_512.tests.ex4 Passed
✅ 28 test(s) passing

View File

@ -51,7 +51,7 @@ testMvars _ =
runTest test
```
```ucm
.> add
.> io.test testMvars
scratch/main> add
scratch/main> io.test testMvars
```

View File

@ -66,30 +66,30 @@ testMvars _ =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
eitherCk : (a ->{g} Boolean) -> Either e a ->{g} Boolean
testMvars : '{IO} [Result]
.> io.test testMvars
scratch/main> io.test testMvars
New test results:
1. testMvars ma should not be empty
2. ◉ testMvars should read what you sow
3. ◉ testMvars should reap what you sow
4. ◉ testMvars ma should be empty
5. ◉ testMvars swap returns old contents
6. ◉ testMvars swap returns old contents
7. ◉ testMvars tryRead should succeed when not empty
8. ◉ testMvars tryPut should fail when not empty
9. ◉ testMvars tryTake should succeed when not empty
10. ◉ testMvars tryTake should not succeed when empty
11. ◉ testMvars ma2 should be empty
12. ◉ testMvars tryTake should fail when empty
13. ◉ testMvars tryRead should fail when empty
1. testMvars ma should not be empty
should read what you sow
should reap what you sow
ma should be empty
swap returns old contents
swap returns old contents
tryRead should succeed when not empty
tryPut should fail when not empty
tryTake should succeed when not empty
tryTake should not succeed when empty
ma2 should be empty
tryTake should fail when empty
tryRead should fail when empty
✅ 13 test(s) passing

View File

@ -33,6 +33,6 @@ test = 'let
```
```ucm
.> add
.> io.test test
scratch/main> add
scratch/main> io.test test
```

View File

@ -49,7 +49,7 @@ test = 'let
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -59,24 +59,24 @@ test = 'let
-> Optional Float
->{Stream Result} ()
.> io.test test
scratch/main> io.test test
New test results:
1. test expected 0.0 got 0.0
2. ◉ test round trip though float, expected 0 got 0
3. ◉ test expected 0 got 0
4. ◉ test round trip though Int, expected 0 got 0
5. ◉ test skipped
6. ◉ test expected 1 got 1
7. ◉ test round trip though Int, expected 1 got 1
8. ◉ test skipped
9. ◉ test expected -1 got -1
10. ◉ test round trip though Int, expected 18446744073709551615 got 18446744073709551615
11. ◉ test expected 1.0000000000000002 got 1.0000000000000002
12. ◉ test round trip though float, expected 4607182418800017409 got 4607182418800017409
13. ◉ test expected 4607182418800017409 got 4607182418800017409
14. ◉ test round trip though Int, expected 4607182418800017409 got 4607182418800017409
1. test expected 0.0 got 0.0
round trip though float, expected 0 got 0
expected 0 got 0
round trip though Int, expected 0 got 0
skipped
expected 1 got 1
round trip though Int, expected 1 got 1
skipped
expected -1 got -1
round trip though Int, expected 18446744073709551615 got 18446744073709551615
expected 1.0000000000000002 got 1.0000000000000002
round trip though float, expected 4607182418800017409 got 4607182418800017409
expected 4607182418800017409 got 4607182418800017409
round trip though Int, expected 4607182418800017409 got 4607182418800017409
✅ 14 test(s) passing

View File

@ -10,7 +10,7 @@ socketAccept = compose reraise socketAccept.impl
```
```ucm:hide
.> add
scratch/main> add
```
# Tests for network related builtins
@ -93,8 +93,8 @@ testDefaultPort _ =
runTest test
```
```ucm
.> add
.> io.test testDefaultPort
scratch/main> add
scratch/main> io.test testDefaultPort
```
This example demonstrates connecting a TCP client socket to a TCP server socket. A thread is started for both client and server. The server socket asks for any availalbe port (by passing "0" as the port number). The server thread then queries for the actual assigned port number, and puts that into an MVar which the client thread can read. The client thread then reads a string from the server and reports it back to the main thread via a different MVar.
@ -149,6 +149,6 @@ testTcpConnect = 'let
```
```ucm
.> add
.> io.test testTcpConnect
scratch/main> add
scratch/main> io.test testTcpConnect
```

View File

@ -107,7 +107,7 @@ testDefaultPort _ =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -115,13 +115,13 @@ testDefaultPort _ =
testDefaultPort : '{IO} [Result]
testExplicitHost : '{IO} [Result]
.> io.test testDefaultPort
scratch/main> io.test testDefaultPort
New test results:
1. testDefaultPort successfully created socket
2. testDefaultPort port should be > 1024
3. testDefaultPort port should be < 65536
1. testDefaultPort successfully created socket
port should be > 1024
port should be < 65536
✅ 3 test(s) passing
@ -194,7 +194,7 @@ testTcpConnect = 'let
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -202,11 +202,11 @@ testTcpConnect = 'let
serverThread : MVar Nat -> Text -> '{IO} ()
testTcpConnect : '{IO} [Result]
.> io.test testTcpConnect
scratch/main> io.test testTcpConnect
New test results:
1. testTcpConnect should have reaped what we've sown
1. testTcpConnect should have reaped what we've sown
✅ 1 test(s) passing

View File

@ -56,6 +56,6 @@ serialTests = do
```
```ucm
.> add
.> io.test serialTests
scratch/main> add
scratch/main> io.test serialTests
```

View File

@ -74,7 +74,7 @@ serialTests = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -85,15 +85,15 @@ serialTests = do
serialTests : '{IO, Exception} [Result]
shuffle : Nat -> [a] -> [a]
.> io.test serialTests
scratch/main> io.test serialTests
New test results:
1. serialTests case-00
2. serialTests case-01
3. serialTests case-02
4. serialTests case-03
5. serialTests case-04
1. serialTests case-00
case-01
case-02
case-03
case-04
✅ 5 test(s) passing

View File

@ -19,8 +19,8 @@ casTest = do
```
```ucm
.> add
.> io.test casTest
scratch/main> add
scratch/main> io.test casTest
```
Promise is a simple one-shot awaitable condition.
@ -54,9 +54,9 @@ promiseConcurrentTest = do
```
```ucm
.> add
.> io.test promiseSequentialTest
.> io.test promiseConcurrentTest
scratch/main> add
scratch/main> io.test promiseSequentialTest
scratch/main> io.test promiseConcurrentTest
```
CAS can be used to write an atomic update function.
@ -70,7 +70,7 @@ atomicUpdate ref f =
```
```ucm
.> add
scratch/main> add
```
Promise can be used to write an operation that spawns N concurrent
@ -91,7 +91,7 @@ spawnN n fa =
map Promise.read (go n [])
```
```ucm
.> add
scratch/main> add
```
We can use these primitives to write a more interesting example, where
@ -123,6 +123,6 @@ fullTest = do
```
```ucm
.> add
.> io.test fullTest
scratch/main> add
scratch/main> io.test fullTest
```

View File

@ -32,18 +32,18 @@ casTest = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
casTest : '{IO} [Result]
.> io.test casTest
scratch/main> io.test casTest
New test results:
1. casTest CAS is successful is there were no conflicting writes
2. casTest CAS fails when there was an intervening write
1. casTest CAS is successful is there were no conflicting writes
CAS fails when there was an intervening write
✅ 2 test(s) passing
@ -95,29 +95,29 @@ promiseConcurrentTest = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
promiseConcurrentTest : '{IO} [Result]
promiseSequentialTest : '{IO} [Result]
.> io.test promiseSequentialTest
scratch/main> io.test promiseSequentialTest
New test results:
1. promiseSequentialTest Should read a value that's been written
2. promiseSequentialTest Promise can only be written to once
1. promiseSequentialTest Should read a value that's been written
Promise can only be written to once
✅ 2 test(s) passing
Tip: Use view 1 to view the source of a test.
.> io.test promiseConcurrentTest
scratch/main> io.test promiseConcurrentTest
New test results:
1. promiseConcurrentTest Reads awaits for completion of the Promise
1. promiseConcurrentTest Reads awaits for completion of the Promise
✅ 1 test(s) passing
@ -148,7 +148,7 @@ atomicUpdate ref f =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -187,7 +187,7 @@ spawnN n fa =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -236,17 +236,17 @@ fullTest = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
fullTest : '{IO} [Result]
.> io.test fullTest
scratch/main> io.test fullTest
New test results:
1. fullTest The state of the counter is consistent
1. fullTest The state of the counter is consistent
✅ 1 test(s) passing

View File

@ -68,6 +68,6 @@ mkTestCase = do
```
```ucm
.> add
.> run mkTestCase
scratch/main> add
scratch/main> run mkTestCase
```

View File

@ -95,7 +95,7 @@ mkTestCase = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -115,7 +115,7 @@ mkTestCase = do
tree2 : Tree Nat
tree3 : Tree Text
.> run mkTestCase
scratch/main> run mkTestCase
()

View File

@ -16,6 +16,6 @@ mkTestCase = do
```
```ucm
.> add
.> run mkTestCase
scratch/main> add
scratch/main> run mkTestCase
```

View File

@ -33,7 +33,7 @@ mkTestCase = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -43,7 +43,7 @@ mkTestCase = do
l3 : [Char]
mkTestCase : '{IO, Exception} ()
.> run mkTestCase
scratch/main> run mkTestCase
()

View File

@ -30,6 +30,6 @@ mkTestCase = do
```
```ucm
.> add
.> run mkTestCase
scratch/main> add
scratch/main> run mkTestCase
```

View File

@ -49,7 +49,7 @@ mkTestCase = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -61,7 +61,7 @@ mkTestCase = do
prod : [Nat] -> Nat
products : ([Nat], [Nat], [Nat]) -> Text
.> run mkTestCase
scratch/main> run mkTestCase
()

View File

@ -44,6 +44,6 @@ mkTestCase = do
```
```ucm
.> add
.> run mkTestCase
scratch/main> add
scratch/main> run mkTestCase
```

View File

@ -68,7 +68,7 @@ mkTestCase = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -84,7 +84,7 @@ mkTestCase = do
reset : '{DC r} r -> r
suspSum : [Nat] -> Delayed Nat
.> run mkTestCase
scratch/main> run mkTestCase
()

View File

@ -14,6 +14,6 @@ mkTestCase = do
```
```ucm
.> add
.> run mkTestCase
scratch/main> add
scratch/main> run mkTestCase
```

View File

@ -28,7 +28,7 @@ mkTestCase = do
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -36,7 +36,7 @@ mkTestCase = do
mutual0 : Nat -> Text
mutual1 : Nat -> Text
.> run mkTestCase
scratch/main> run mkTestCase
()

View File

@ -28,7 +28,7 @@ body k out v =
```
```ucm
.> add
scratch/main> add
```
Test case.
@ -67,6 +67,6 @@ tests = '(map spawn nats)
```
```ucm
.> add
.> io.test tests
scratch/main> add
scratch/main> io.test tests
```

View File

@ -44,7 +44,7 @@ body k out v =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -106,7 +106,7 @@ tests = '(map spawn nats)
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -115,20 +115,20 @@ tests = '(map spawn nats)
spawn : Nat ->{IO} Result
tests : '{IO} [Result]
.> io.test tests
scratch/main> io.test tests
New test results:
1. tests verified
2. ◉ tests verified
3. ◉ tests verified
4. ◉ tests verified
5. ◉ tests verified
6. ◉ tests verified
7. ◉ tests verified
8. ◉ tests verified
9. ◉ tests verified
10. ◉ tests verified
1. tests verified
verified
verified
verified
verified
verified
verified
verified
verified
verified
✅ 10 test(s) passing

View File

@ -9,7 +9,7 @@ x = 999
```
```ucm:hide
.> add
scratch/main> add
```
Now, we update that definition and define a test-watch which depends on it.
@ -22,7 +22,7 @@ test> mytest = checks [x + 1 == 1001]
We expect this 'add' to fail because the test is blocked by the update to `x`.
```ucm:error
.> add
scratch/main> add
```
---
@ -35,5 +35,5 @@ test> useY = checks [y + 1 == 43]
This should correctly identify `y` as a dependency and add that too.
```ucm
.> add useY
scratch/main> add useY
```

View File

@ -43,7 +43,7 @@ test> mytest = checks [x + 1 == 1001]
We expect this 'add' to fail because the test is blocked by the update to `x`.
```ucm
.> add
scratch/main> add
x These definitions failed:
@ -85,7 +85,7 @@ test> useY = checks [y + 1 == 43]
This should correctly identify `y` as a dependency and add that too.
```ucm
.> add useY
scratch/main> add useY
⍟ I've added these definitions:

View File

@ -19,8 +19,8 @@ testBasicFork = 'let
See if we can get another thread to stuff a value into a MVar
```ucm:hide
.> add
.> io.test testBasicFork
scratch/main> add
scratch/main> io.test testBasicFork
```
```unison
@ -48,8 +48,8 @@ testBasicMultiThreadMVar = 'let
```
```ucm
.> add
.> io.test testBasicMultiThreadMVar
scratch/main> add
scratch/main> io.test testBasicMultiThreadMVar
```
```unison
@ -91,6 +91,6 @@ testTwoThreads = 'let
```
```ucm
.> add
.> io.test testTwoThreads
scratch/main> add
scratch/main> io.test testTwoThreads
```

View File

@ -71,18 +71,18 @@ testBasicMultiThreadMVar = 'let
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
testBasicMultiThreadMVar : '{IO} [Result]
thread1 : Nat -> MVar Nat -> '{IO} ()
.> io.test testBasicMultiThreadMVar
scratch/main> io.test testBasicMultiThreadMVar
New test results:
1. testBasicMultiThreadMVar other thread should have incremented
1. testBasicMultiThreadMVar other thread should have incremented
✅ 1 test(s) passing
@ -144,7 +144,7 @@ testTwoThreads = 'let
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -153,11 +153,11 @@ testTwoThreads = 'let
(also named thread1)
testTwoThreads : '{IO} [Result]
.> io.test testTwoThreads
scratch/main> io.test testTwoThreads
New test results:
1. testTwoThreads
1. testTwoThreads
✅ 1 test(s) passing

View File

@ -12,7 +12,7 @@ not_a_cert = "-----BEGIN SCHERMIFICATE-----\n-----END SCHERMIFICATE-----"
```
```ucm:hide
.> add
scratch/main> add
```
# Using an alternative certificate store
@ -32,8 +32,8 @@ what_should_work _ = this_should_work ++ this_should_not_work
```
```ucm
.> add
.> io.test what_should_work
scratch/main> add
scratch/main> io.test what_should_work
```
Test handshaking a client/server a local TCP connection using our
@ -191,8 +191,8 @@ testCNReject _ =
```
```ucm
.> add
.> io.test testConnectSelfSigned
.> io.test testCAReject
.> io.test testCNReject
scratch/main> add
scratch/main> io.test testConnectSelfSigned
scratch/main> io.test testCAReject
scratch/main> io.test testCNReject
```

View File

@ -43,7 +43,7 @@ what_should_work _ = this_should_work ++ this_should_not_work
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -51,12 +51,12 @@ what_should_work _ = this_should_work ++ this_should_not_work
this_should_work : [Result]
what_should_work : ∀ _. _ -> [Result]
.> io.test what_should_work
scratch/main> io.test what_should_work
New test results:
1. what_should_work succesfully decoded self_signed_pem
2. what_should_work failed
1. what_should_work succesfully decoded self_signed_pem
failed
✅ 2 test(s) passing
@ -238,7 +238,7 @@ testCNReject _ =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -251,31 +251,31 @@ testCNReject _ =
-> '{IO, Exception} Text
testConnectSelfSigned : '{IO} [Result]
.> io.test testConnectSelfSigned
scratch/main> io.test testConnectSelfSigned
New test results:
1. testConnectSelfSigned should have reaped what we've sown
1. testConnectSelfSigned should have reaped what we've sown
✅ 1 test(s) passing
Tip: Use view 1 to view the source of a test.
.> io.test testCAReject
scratch/main> io.test testCAReject
New test results:
1. testCAReject correctly rejected self-signed cert
1. testCAReject correctly rejected self-signed cert
✅ 1 test(s) passing
Tip: Use view 1 to view the source of a test.
.> io.test testCNReject
scratch/main> io.test testCNReject
New test results:
1. testCNReject correctly rejected self-signed cert
1. testCNReject correctly rejected self-signed cert
✅ 1 test(s) passing

View File

@ -3,7 +3,7 @@ Test for new Text -> Bytes conversions explicitly using UTF-8 as the encoding
Unison has function for converting between `Text` and a UTF-8 `Bytes` encoding of the Text.
```ucm
.> find Utf8
scratch/main> find Utf8
```
ascii characters are encoded as single bytes (in the range 0-127).

View File

@ -3,7 +3,7 @@ Test for new Text -> Bytes conversions explicitly using UTF-8 as the encoding
Unison has function for converting between `Text` and a UTF-8 `Bytes` encoding of the Text.
```ucm
.> find Utf8
scratch/main> find Utf8
1. builtin.Text.toUtf8 : Text -> Bytes
2. Text.fromUtf8 : Bytes ->{Exception} Text

View File

@ -1,6 +1,6 @@
```ucm:hide
.> builtins.merge
scratch/main> builtins.merge
```
Some random ability stuff to ensure things work.
@ -23,5 +23,5 @@ ha = cases
```
```ucm
.> add
scratch/main> add
```

View File

@ -32,7 +32,7 @@ ha = cases
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:

View File

@ -15,6 +15,6 @@ term2 _ = ()
```
```ucm
.> add
.> names term1
scratch/main> add
scratch/main> names term1
```

View File

@ -31,7 +31,7 @@ term2 _ = ()
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -40,7 +40,7 @@ term2 _ = ()
term1 : '{Bar, Foo} ()
term2 : '{Bar, Foo} ()
.> names term1
scratch/main> names term1
Term
Hash: #8hum58rlih

View File

@ -3,7 +3,7 @@
## Basic usage
```ucm:hide
.> builtins.merge
scratch/main> builtins.merge
```
```unison
@ -20,26 +20,26 @@ is2even = '(even 2)
it errors if there isn't a previous run
```ucm:error
.> add.run foo
scratch/main> add.run foo
```
```ucm
.> run is2even
scratch/main> run is2even
```
it errors if the desired result name conflicts with a name in the
unison file
```ucm:error
.> add.run is2even
scratch/main> add.run is2even
```
otherwise, the result is successfully persisted
```ucm
.> add.run foo.bar.baz
scratch/main> add.run foo.bar.baz
```
```ucm
.> view foo.bar.baz
scratch/main> view foo.bar.baz
```
## It resolves references within the unison file
@ -56,8 +56,8 @@ main _ = y
```
```ucm
.> run main
.> add.run result
scratch/main> run main
scratch/main> add.run result
```
## It resolves references within the codebase
@ -68,7 +68,7 @@ inc x = x + 1
```
```ucm
.> add inc
scratch/main> add inc
```
```unison
@ -77,9 +77,9 @@ main _ x = inc x
```
```ucm
.> run main
.> add.run natfoo
.> view natfoo
scratch/main> run main
scratch/main> add.run natfoo
scratch/main> view natfoo
```
## It captures scratch file dependencies at run time
@ -91,7 +91,7 @@ main = 'y
```
```ucm
.> run main
scratch/main> run main
```
@ -101,8 +101,8 @@ x = 50
this saves 2 to xres, rather than 100
```ucm
.> add.run xres
.> view xres
scratch/main> add.run xres
scratch/main> view xres
```
## It fails with a message if add cannot complete cleanly
@ -112,8 +112,8 @@ main = '5
```
```ucm:error
.> run main
.> add.run xres
scratch/main> run main
scratch/main> add.run xres
```
## It works with absolute names

View File

@ -31,7 +31,7 @@ is2even = '(even 2)
it errors if there isn't a previous run
```ucm
.> add.run foo
scratch/main> add.run foo
⚠️
@ -40,7 +40,7 @@ it errors if there isn't a previous run
```
```ucm
.> run is2even
scratch/main> run is2even
true
@ -48,7 +48,7 @@ it errors if there isn't a previous run
it errors if the desired result name conflicts with a name in the
unison file
```ucm
.> add.run is2even
scratch/main> add.run is2even
⚠️
@ -58,7 +58,7 @@ unison file
```
otherwise, the result is successfully persisted
```ucm
.> add.run foo.bar.baz
scratch/main> add.run foo.bar.baz
⍟ I've added these definitions:
@ -66,7 +66,7 @@ otherwise, the result is successfully persisted
```
```ucm
.> view foo.bar.baz
scratch/main> view foo.bar.baz
foo.bar.baz : Boolean
foo.bar.baz = true
@ -101,11 +101,11 @@ main _ = y
```
```ucm
.> run main
scratch/main> run main
a b -> a Nat.+ b Nat.+ z 10
.> add.run result
scratch/main> add.run result
⍟ I've added these definitions:
@ -134,7 +134,7 @@ inc x = x + 1
```
```ucm
.> add inc
scratch/main> add inc
⍟ I've added these definitions:
@ -160,17 +160,17 @@ main _ x = inc x
```
```ucm
.> run main
scratch/main> run main
inc
.> add.run natfoo
scratch/main> add.run natfoo
⍟ I've added these definitions:
natfoo : Nat -> Nat
.> view natfoo
scratch/main> view natfoo
natfoo : Nat -> Nat
natfoo = inc
@ -200,7 +200,7 @@ main = 'y
```
```ucm
.> run main
scratch/main> run main
2
@ -224,13 +224,13 @@ x = 50
```
this saves 2 to xres, rather than 100
```ucm
.> add.run xres
scratch/main> add.run xres
⍟ I've added these definitions:
xres : Nat
.> view xres
scratch/main> view xres
xres : Nat
xres = 2
@ -256,11 +256,11 @@ main = '5
```
```ucm
.> run main
scratch/main> run main
5
.> add.run xres
scratch/main> add.run xres
x These definitions failed:

View File

@ -1,5 +1,5 @@
```ucm:hide
.> builtins.mergeio
scratch/main> builtins.mergeio
```
```unison:hide
@ -10,6 +10,6 @@ foo = []
Apparently when we add a test watch, we add a type annotation to it, even if it already has one. We don't want this to happen though!
```ucm
.> add
.> view foo
scratch/main> add
scratch/main> view foo
```

View File

@ -6,13 +6,13 @@ foo = []
Apparently when we add a test watch, we add a type annotation to it, even if it already has one. We don't want this to happen though!
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
foo : [Result]
.> view foo
scratch/main> view foo
foo : [Result]
foo : [Result]

View File

@ -3,7 +3,7 @@
Let's set up some definitions to start:
```ucm:hide
.> builtins.merge
scratch/main> builtins.merge
```
```unison
@ -17,7 +17,7 @@ structural type Y = Two Nat Nat
Expected: `x` and `y`, `X`, and `Y` exist as above. UCM tells you this.
```ucm
.> add
scratch/main> add
```
Let's add an alias for `1` and `One`:
@ -32,7 +32,7 @@ Expected: `z` is now `1`. UCM tells you that this definition is also called `x`.
Also, `Z` is an alias for `X`.
```ucm
.> add
scratch/main> add
```
Let's update something that has an alias (to a value that doesn't have a name already):
@ -45,7 +45,7 @@ structural type X = Three Nat Nat Nat
Expected: `x` is now `3` and `X` has constructor `Three`. UCM tells you the old definitions were also called `z` and `Z` and these names have also been updated.
```ucm
.> update
scratch/main> update
```
Update it to something that already exists with a different name:
@ -58,6 +58,6 @@ structural type X = Two Nat Nat
Expected: `x` is now `2` and `X` is `Two`. UCM says the old definition was also named `z/Z`, and was also updated. And it says the new definition is also named `y/Y`.
```ucm
.> update
scratch/main> update
```

View File

@ -29,7 +29,7 @@ structural type Y = Two Nat Nat
Expected: `x` and `y`, `X`, and `Y` exist as above. UCM tells you this.
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -67,7 +67,7 @@ Expected: `z` is now `1`. UCM tells you that this definition is also called `x`.
Also, `Z` is an alias for `X`.
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -104,7 +104,7 @@ structural type X = Three Nat Nat Nat
Expected: `x` is now `3` and `X` has constructor `Three`. UCM tells you the old definitions were also called `z` and `Z` and these names have also been updated.
```ucm
.> update
scratch/main> update
Okay, I'm searching the branch for code that needs to be
updated...
@ -143,7 +143,7 @@ structural type X = Two Nat Nat
Expected: `x` is now `2` and `X` is `Two`. UCM says the old definition was also named `z/Z`, and was also updated. And it says the new definition is also named `y/Y`.
```ucm
.> update
scratch/main> update
Okay, I'm searching the branch for code that needs to be
updated...

View File

@ -1,5 +1,5 @@
```ucm:hide
.> builtins.merge
scratch/main> builtins.merge lib.builtins
```
```unison:hide:all
List.adjacentPairs : [a] -> [(a, a)]
@ -95,14 +95,14 @@ List.takeWhile p xs =
go xs []
```
```ucm:hide
.stuff> add
scratch/main> add
```
The `alias.many` command can be used to copy definitions from the current namespace into your curated one.
The names that will be used in the target namespace are the names you specify, relative to the current namespace:
```
.> help alias.many
scratch/main> help alias.many
alias.many (or copy)
`alias.many <relative1> [relative2...] <namespace>` creates aliases `relative1`, `relative2`, ...
@ -113,8 +113,8 @@ The names that will be used in the target namespace are the names you specify, r
Let's try it!
```ucm
.> alias.many stuff.List.adjacentPairs stuff.List.all stuff.List.any stuff.List.chunk stuff.List.chunksOf stuff.List.dropWhile stuff.List.first stuff.List.init stuff.List.intersperse stuff.List.isEmpty stuff.List.last stuff.List.replicate stuff.List.splitAt stuff.List.tail stuff.List.takeWhile .mylib
.> find-in mylib
scratch/main> alias.many List.adjacentPairs List.all List.any List.chunk List.chunksOf List.dropWhile List.first List.init List.intersperse List.isEmpty List.last List.replicate List.splitAt List.tail List.takeWhile mylib
scratch/main> find-in mylib
```
Thanks, `alias.many`!

View File

@ -1,8 +1,8 @@
The `alias.many` command can be used to copy definitions from the current namespace into your curated one.
The names that will be used in the target namespace are the names you specify, relative to the current namespace:
```
.> help alias.many
```scratch
/main> help alias.many
alias.many (or copy)
`alias.many <relative1> [relative2...] <namespace>` creates aliases `relative1`, `relative2`, ...
@ -14,55 +14,51 @@ The names that will be used in the target namespace are the names you specify, r
Let's try it!
```ucm
.> alias.many stuff.List.adjacentPairs stuff.List.all stuff.List.any stuff.List.chunk stuff.List.chunksOf stuff.List.dropWhile stuff.List.first stuff.List.init stuff.List.intersperse stuff.List.isEmpty stuff.List.last stuff.List.replicate stuff.List.splitAt stuff.List.tail stuff.List.takeWhile .mylib
scratch/main> alias.many List.adjacentPairs List.all List.any List.chunk List.chunksOf List.dropWhile List.first List.init List.intersperse List.isEmpty List.last List.replicate List.splitAt List.tail List.takeWhile mylib
Here's what changed in .mylib :
Here's what changed in mylib :
Added definitions:
1. stuff.List.adjacentPairs : [a] -> [(a, a)]
2. stuff.List.all : (a ->{g} Boolean)
-> [a]
->{g} Boolean
3. stuff.List.any : (a ->{g} Boolean)
-> [a]
->{g} Boolean
4. stuff.List.chunk : Nat -> [a] -> [[a]]
5. stuff.List.chunksOf : Nat -> [a] -> [[a]]
6. stuff.List.dropWhile : (a ->{g} Boolean)
-> [a]
->{g} [a]
7. stuff.List.first : [a] -> Optional a
8. stuff.List.init : [a] -> Optional [a]
9. stuff.List.intersperse : a -> [a] -> [a]
10. stuff.List.isEmpty : [a] -> Boolean
11. stuff.List.last : [a] -> Optional a
12. stuff.List.replicate : Nat -> a -> [a]
13. stuff.List.splitAt : Nat -> [a] -> ([a], [a])
14. stuff.List.tail : [a] -> Optional [a]
15. stuff.List.takeWhile : (a ->{𝕖} Boolean)
-> [a]
->{𝕖} [a]
1. List.adjacentPairs : [a] -> [(a, a)]
2. List.all : (a ->{g} Boolean)
-> [a]
->{g} Boolean
3. List.any : (a ->{g} Boolean)
-> [a]
->{g} Boolean
4. List.chunk : Nat -> [a] -> [[a]]
5. List.chunksOf : Nat -> [a] -> [[a]]
6. List.dropWhile : (a ->{g} Boolean) -> [a] ->{g} [a]
7. List.first : [a] -> Optional a
8. List.init : [a] -> Optional [a]
9. List.intersperse : a -> [a] -> [a]
10. List.isEmpty : [a] -> Boolean
11. List.last : [a] -> Optional a
12. List.replicate : Nat -> a -> [a]
13. List.splitAt : Nat -> [a] -> ([a], [a])
14. List.tail : [a] -> Optional [a]
15. List.takeWhile : (a ->{𝕖} Boolean) -> [a] ->{𝕖} [a]
Tip: You can use `undo` or `reflog` to undo this change.
.> find-in mylib
scratch/main> find-in mylib
1. stuff.List.adjacentPairs : [a] -> [(a, a)]
2. stuff.List.all : (a ->{g} Boolean) -> [a] ->{g} Boolean
3. stuff.List.any : (a ->{g} Boolean) -> [a] ->{g} Boolean
4. stuff.List.chunk : Nat -> [a] -> [[a]]
5. stuff.List.chunksOf : Nat -> [a] -> [[a]]
6. stuff.List.dropWhile : (a ->{g} Boolean) -> [a] ->{g} [a]
7. stuff.List.first : [a] -> Optional a
8. stuff.List.init : [a] -> Optional [a]
9. stuff.List.intersperse : a -> [a] -> [a]
10. stuff.List.isEmpty : [a] -> Boolean
11. stuff.List.last : [a] -> Optional a
12. stuff.List.replicate : Nat -> a -> [a]
13. stuff.List.splitAt : Nat -> [a] -> ([a], [a])
14. stuff.List.tail : [a] -> Optional [a]
15. stuff.List.takeWhile : (a ->{𝕖} Boolean) -> [a] ->{𝕖} [a]
1. List.adjacentPairs : [a] -> [(a, a)]
2. List.all : (a ->{g} Boolean) -> [a] ->{g} Boolean
3. List.any : (a ->{g} Boolean) -> [a] ->{g} Boolean
4. List.chunk : Nat -> [a] -> [[a]]
5. List.chunksOf : Nat -> [a] -> [[a]]
6. List.dropWhile : (a ->{g} Boolean) -> [a] ->{g} [a]
7. List.first : [a] -> Optional a
8. List.init : [a] -> Optional [a]
9. List.intersperse : a -> [a] -> [a]
10. List.isEmpty : [a] -> Boolean
11. List.last : [a] -> Optional a
12. List.replicate : Nat -> a -> [a]
13. List.splitAt : Nat -> [a] -> ([a], [a])
14. List.tail : [a] -> Optional [a]
15. List.takeWhile : (a ->{𝕖} Boolean) -> [a] ->{𝕖} [a]
```

View File

@ -0,0 +1,28 @@
`alias.type` makes a new name for a type.
```ucm:hide
project/main> builtins.mergeio lib.builtins
```
```ucm
project/main> alias.type lib.builtins.Nat Foo
project/main> ls
```
It won't create a conflicted name, though.
```ucm:error
project/main> alias.type lib.builtins.Int Foo
```
```ucm
project/main> ls
```
You can use `debug.alias.type.force` for that.
```ucm
project/main> debug.alias.type.force lib.builtins.Int Foo
project/main> ls
```

View File

@ -0,0 +1,44 @@
`alias.type` makes a new name for a type.
```ucm
project/main> alias.type lib.builtins.Nat Foo
Done.
project/main> ls
1. Foo (builtin type)
2. lib/ (643 terms, 92 types)
```
It won't create a conflicted name, though.
```ucm
project/main> alias.type lib.builtins.Int Foo
⚠️
A type by that name already exists.
```
```ucm
project/main> ls
1. Foo (builtin type)
2. lib/ (643 terms, 92 types)
```
You can use `debug.alias.type.force` for that.
```ucm
project/main> debug.alias.type.force lib.builtins.Int Foo
Done.
project/main> ls
1. Foo (builtin type)
2. Foo (builtin type)
3. lib/ (643 terms, 92 types)
```

View File

@ -1,6 +1,6 @@
```ucm:hide
.> builtins.merge
scratch/main> builtins.merge
```
This tests a variable related bug in the ANF compiler.
@ -29,6 +29,6 @@ foo _ =
```
```ucm
.> add
scratch/main> add
```

View File

@ -45,7 +45,7 @@ foo _ =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:

View File

@ -1,9 +1,9 @@
# Unit tests for Any.unsafeExtract
```ucm:hide
.> builtins.mergeio
.> load unison-src/transcripts-using-base/base.u
.> add
scratch/main> builtins.mergeio
scratch/main> load unison-src/transcripts-using-base/base.u
scratch/main> add
```
Any.unsafeExtract is a way to extract the value contained in an Any. This is unsafe because it allows the programmer to coerce a value into any type, which would cause undefined behaviour if used to coerce a value to the wrong type.
@ -19,5 +19,5 @@ test> Any.unsafeExtract.works =
```
```ucm
.> add
scratch/main> add
```

View File

@ -32,7 +32,7 @@ test> Any.unsafeExtract.works =
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:

View File

@ -1,7 +1,7 @@
# Doc rendering
```ucm:hide
.> builtins.mergeio
scratch/main> builtins.mergeio
```
```unison:hide
@ -82,13 +82,13 @@ term = 42
```
```ucm:hide
.> add
scratch/main> add
```
```ucm
.> display term.doc
scratch/main> display term.doc
```
```api
GET /api/non-project-code/getDefinition?names=term
GET /api/projects/scratch/branches/main/getDefinition?names=term
```

View File

@ -78,7 +78,7 @@ term = 42
```
```ucm
.> display term.doc
scratch/main> display term.doc
# Heading
@ -147,7 +147,7 @@ term = 42
```
```api
GET /api/non-project-code/getDefinition?names=term
GET /api/projects/scratch/branches/main/getDefinition?names=term
{
"missingDefinitions": [],
"termDefinitions": {

View File

@ -8,19 +8,19 @@ joey.yaml.zz = 45
```
```ucm
.> add
scratch/main> add
```
```api
-- Namespace segment prefix search
GET /api/non-project-code/find?query=http
GET /api/projects/scratch/branches/main/find?query=http
-- Namespace segment suffix search
GET /api/non-project-code/find?query=Server
GET /api/projects/scratch/branches/main/find?query=Server
-- Substring search
GET /api/non-project-code/find?query=lesys
GET /api/projects/scratch/branches/main/find?query=lesys
-- Cross-segment search
GET /api/non-project-code/find?query=joey.http
GET /api/projects/scratch/branches/main/find?query=joey.http
```

View File

@ -24,7 +24,7 @@ joey.yaml.zz = 45
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -36,7 +36,7 @@ joey.yaml.zz = 45
```
```api
-- Namespace segment prefix search
GET /api/non-project-code/find?query=http
GET /api/projects/scratch/branches/main/find?query=http
[
[
{
@ -122,7 +122,7 @@ GET /api/non-project-code/find?query=http
]
]
-- Namespace segment suffix search
GET /api/non-project-code/find?query=Server
GET /api/projects/scratch/branches/main/find?query=Server
[
[
{
@ -167,7 +167,7 @@ GET /api/non-project-code/find?query=Server
]
]
-- Substring search
GET /api/non-project-code/find?query=lesys
GET /api/projects/scratch/branches/main/find?query=lesys
[
[
{
@ -212,7 +212,7 @@ GET /api/non-project-code/find?query=lesys
]
]
-- Cross-segment search
GET /api/non-project-code/find?query=joey.http
GET /api/projects/scratch/branches/main/find?query=joey.http
[
[
{

View File

@ -1,54 +1,50 @@
# Get Definitions Test
```ucm:hide
.nested> builtins.mergeio
scratch/main> builtins.mergeio lib.builtins
```
```unison:hide
{{ Documentation }}
names.x = 42
nested.names.x.doc = {{ Documentation }}
nested.names.x = 42
```
```ucm:hide
.nested> add
scratch/main> add
```
```api
-- Should NOT find names by suffix
GET /api/non-project-code/getDefinition?names=x
GET /api/projects/scratch/branches/main/getDefinition?names=x
-- Term names should strip relativeTo prefix.
GET /api/non-project-code/getDefinition?names=names.x&relativeTo=nested
GET /api/projects/scratch/branches/main/getDefinition?names=names.x&relativeTo=nested
-- Should find definitions by hash, names should be relative
GET /api/non-project-code/getDefinition?names=%23qkhkl0n238&relativeTo=nested
```
```ucm:hide
.doctest> builtins.mergeio
GET /api/projects/scratch/branches/main/getDefinition?names=%23qkhkl0n238&relativeTo=nested
```
```unison:hide
thing.doc = {{ The correct docs for the thing }}
thing = "A thing"
thingalias.doc = {{ Docs for the alias, should not be displayed }}
thingalias = "A thing"
otherstuff.thing.doc = {{ A doc for a different term with the same name, should not be displayed }}
otherstuff.thing = "A different thing"
doctest.thing.doc = {{ The correct docs for the thing }}
doctest.thing = "A thing"
doctest.thingalias.doc = {{ Docs for the alias, should not be displayed }}
doctest.thingalias = "A thing"
doctest.otherstuff.thing.doc = {{ A doc for a different term with the same name, should not be displayed }}
doctest.otherstuff.thing = "A different thing"
```
```ucm:hide
.doctest> add
scratch/main> add
```
Only docs for the term we request should be returned, even if there are other term docs with the same suffix.
```api
GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
GET /api/projects/scratch/branches/main/getDefinition?names=thing&relativeTo=doctest
```
If we request a doc, the api should return the source, but also the rendered doc should appear in the 'termDocs' list.
```api
GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
GET /api/projects/scratch/branches/main/getDefinition?names=thing.doc&relativeTo=doctest
```

View File

@ -1,13 +1,13 @@
# Get Definitions Test
```unison
{{ Documentation }}
names.x = 42
nested.names.x.doc = {{ Documentation }}
nested.names.x = 42
```
```api
-- Should NOT find names by suffix
GET /api/non-project-code/getDefinition?names=x
GET /api/projects/scratch/branches/main/getDefinition?names=x
{
"missingDefinitions": [
"x"
@ -16,7 +16,7 @@ GET /api/non-project-code/getDefinition?names=x
"typeDefinitions": {}
}
-- Term names should strip relativeTo prefix.
GET /api/non-project-code/getDefinition?names=names.x&relativeTo=nested
GET /api/projects/scratch/branches/main/getDefinition?names=names.x&relativeTo=nested
{
"missingDefinitions": [],
"termDefinitions": {
@ -104,14 +104,14 @@ GET /api/non-project-code/getDefinition?names=names.x&relativeTo=nested
]
],
"termNames": [
"names.x"
"nested.names.x"
]
}
},
"typeDefinitions": {}
}
-- Should find definitions by hash, names should be relative
GET /api/non-project-code/getDefinition?names=%23qkhkl0n238&relativeTo=nested
GET /api/projects/scratch/branches/main/getDefinition?names=%23qkhkl0n238&relativeTo=nested
{
"missingDefinitions": [],
"termDefinitions": {
@ -199,30 +199,30 @@ GET /api/non-project-code/getDefinition?names=%23qkhkl0n238&relativeTo=nested
]
],
"termNames": [
"names.x"
"nested.names.x"
]
}
},
"typeDefinitions": {}
}
``````unison
thing.doc = {{ The correct docs for the thing }}
thing = "A thing"
thingalias.doc = {{ Docs for the alias, should not be displayed }}
thingalias = "A thing"
otherstuff.thing.doc = {{ A doc for a different term with the same name, should not be displayed }}
otherstuff.thing = "A different thing"
doctest.thing.doc = {{ The correct docs for the thing }}
doctest.thing = "A thing"
doctest.thingalias.doc = {{ Docs for the alias, should not be displayed }}
doctest.thingalias = "A thing"
doctest.otherstuff.thing.doc = {{ A doc for a different term with the same name, should not be displayed }}
doctest.otherstuff.thing = "A different thing"
```
Only docs for the term we request should be returned, even if there are other term docs with the same suffix.
```api
GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
GET /api/projects/scratch/branches/main/getDefinition?names=thing&relativeTo=doctest
{
"missingDefinitions": [],
"termDefinitions": {
"#jksc1s5kud95ro5ivngossullt2oavsd41s3u48bch67jf3gknru5j6hmjslonkd5sdqs8mr8k4rrnef8fodngbg4sm7u6au564ekjg": {
"bestTermName": "thing",
"bestTermName": "doctest.thing",
"defnTermTag": "Plain",
"signature": [
{
@ -237,10 +237,10 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
"contents": [
{
"annotation": {
"contents": "thing",
"contents": "doctest.thing",
"tag": "HashQualifier"
},
"segment": "thing"
"segment": "doctest.thing"
},
{
"annotation": {
@ -265,10 +265,10 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
},
{
"annotation": {
"contents": "thing",
"contents": "doctest.thing",
"tag": "HashQualifier"
},
"segment": "thing"
"segment": "doctest.thing"
},
{
"annotation": {
@ -291,7 +291,7 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
},
"termDocs": [
[
"thing.doc",
"doctest.thing.doc",
"#t9qfdoiuskj4n9go8cftj1r83s43s3o7sppafm5vr0bq5feieb7ap0cie5ed2qsf9g3ig448vffhnajinq81pnnkila1jp2epa7f26o",
{
"contents": [
@ -325,8 +325,8 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
]
],
"termNames": [
"thing",
"thingalias"
"doctest.thing",
"doctest.thingalias"
]
}
},
@ -335,12 +335,12 @@ GET /api/non-project-code/getDefinition?names=thing&relativeTo=doctest
```If we request a doc, the api should return the source, but also the rendered doc should appear in the 'termDocs' list.
```api
GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
GET /api/projects/scratch/branches/main/getDefinition?names=thing.doc&relativeTo=doctest
{
"missingDefinitions": [],
"termDefinitions": {
"#t9qfdoiuskj4n9go8cftj1r83s43s3o7sppafm5vr0bq5feieb7ap0cie5ed2qsf9g3ig448vffhnajinq81pnnkila1jp2epa7f26o": {
"bestTermName": "thing.doc",
"bestTermName": "doctest.thing.doc",
"defnTermTag": "Doc",
"signature": [
{
@ -355,10 +355,10 @@ GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
"contents": [
{
"annotation": {
"contents": "thing.doc",
"contents": "doctest.thing.doc",
"tag": "HashQualifier"
},
"segment": "thing.doc"
"segment": "doctest.thing.doc"
},
{
"annotation": {
@ -383,10 +383,10 @@ GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
},
{
"annotation": {
"contents": "thing.doc",
"contents": "doctest.thing.doc",
"tag": "HashQualifier"
},
"segment": "thing.doc"
"segment": "doctest.thing.doc"
},
{
"annotation": {
@ -467,7 +467,7 @@ GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
},
"termDocs": [
[
"thing.doc",
"doctest.thing.doc",
"#t9qfdoiuskj4n9go8cftj1r83s43s3o7sppafm5vr0bq5feieb7ap0cie5ed2qsf9g3ig448vffhnajinq81pnnkila1jp2epa7f26o",
{
"contents": [
@ -501,7 +501,7 @@ GET /api/non-project-code/getDefinition?names=thing.doc&relativeTo=doctest
]
],
"termNames": [
"thing.doc"
"doctest.thing.doc"
]
}
},

View File

@ -1,9 +1,9 @@
# List Projects And Branches Test
```ucm:hide
.> project.create-empty project-one
.> project.create-empty project-two
.> project.create-empty project-three
scratch/main> project.create-empty project-one
scratch/main> project.create-empty project-two
scratch/main> project.create-empty project-three
project-one/main> branch branch-one
project-one/main> branch branch-two
project-one/main> branch branch-three

View File

@ -12,6 +12,9 @@ GET /api/projects
},
{
"projectName": "project-two"
},
{
"projectName": "scratch"
}
]
-- Should list projects starting with project-t

View File

@ -1,7 +1,7 @@
# Namespace Details Test
```ucm:hide
.> builtins.mergeio
scratch/main> builtins.mergeio
```
```unison
@ -14,10 +14,10 @@ Here's a *README*!
```
```ucm
.> add
scratch/main> add
```
```api
-- Should find names by suffix
GET /api/non-project-code/namespaces/nested.names
GET /api/projects/scratch/branches/main/namespaces/nested.names
```

View File

@ -25,7 +25,7 @@ Here's a *README*!
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -36,7 +36,7 @@ Here's a *README*!
```
```api
-- Should find names by suffix
GET /api/non-project-code/namespaces/nested.names
GET /api/projects/scratch/branches/main/namespaces/nested.names
{
"fqn": "nested.names",
"hash": "#6tnmlu9knsce0u2991u6fvcmf4v44fdf0aiqtmnq7mjj0gi5sephg3lf12iv3odr5rc7vlgq75ciborrd3625c701bdmdomia2gcm3o",

View File

@ -1,7 +1,7 @@
# Namespace list api
```ucm:hide
.> builtins.mergeio
scratch/main> builtins.mergeio
```
```unison
@ -12,11 +12,11 @@ nested.names.readme = {{ I'm a readme! }}
```
```ucm
.> add
scratch/main> add
```
```api
GET /api/non-project-code/list?namespace=nested.names
GET /api/projects/scratch/branches/main/list?namespace=nested.names
GET /api/non-project-code/list?namespace=names&relativeTo=nested
GET /api/projects/scratch/branches/main/list?namespace=names&relativeTo=nested
```

View File

@ -23,7 +23,7 @@ nested.names.readme = {{ I'm a readme! }}
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -33,7 +33,7 @@ nested.names.readme = {{ I'm a readme! }}
```
```api
GET /api/non-project-code/list?namespace=nested.names
GET /api/projects/scratch/branches/main/list?namespace=nested.names
{
"namespaceListingChildren": [
{
@ -82,7 +82,7 @@ GET /api/non-project-code/list?namespace=nested.names
"namespaceListingFQN": "nested.names",
"namespaceListingHash": "#oms19b4f9s3c8tb5skeb8jii95ij35n3hdg038pu6rv5b0fikqe4gd7lnu6a1i6aq5tdh2opdo4s0sfrupvk6vfkr9lf0n752gbl8o0"
}
GET /api/non-project-code/list?namespace=names&relativeTo=nested
GET /api/projects/scratch/branches/main/list?namespace=names&relativeTo=nested
{
"namespaceListingChildren": [
{

View File

@ -1,7 +1,7 @@
# Definition Summary APIs
```ucm:hide
.> builtins.mergeio
scratch/main> builtins.mergeio
```
@ -25,56 +25,56 @@ structural ability Stream s where
```
```ucm:hide
.> add
.> alias.type ##Nat Nat
.> alias.term ##IO.putBytes.impl.v3 putBytesImpl
scratch/main> add
scratch/main> alias.type ##Nat Nat
scratch/main> alias.term ##IO.putBytes.impl.v3 putBytesImpl
```
## Term Summary APIs
```api
-- term
GET /api/non-project-code/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8/summary?name=nat
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8/summary?name=nat
-- term without name uses hash
GET /api/non-project-code/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8/summary
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8/summary
-- doc
GET /api/non-project-code/definitions/terms/by-hash/@icfnhas71n8q5rm7rmpe51hh7bltsr7rb4lv7qadc4cbsifu1mhonlqj2d7836iar2ptc648q9p4u7hf40ijvld574421b6u8gpu0lo/summary?name=doc
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@icfnhas71n8q5rm7rmpe51hh7bltsr7rb4lv7qadc4cbsifu1mhonlqj2d7836iar2ptc648q9p4u7hf40ijvld574421b6u8gpu0lo/summary?name=doc
-- test
GET /api/non-project-code/definitions/terms/by-hash/@u17p9803hdibisou6rlr1sjbccdossgh7vtkd03ovlvnsl2n91lq94sqhughc62tnrual2jlrfk922sebp4nm22o7m5u9j40emft8r8/summary?name=mytest
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@u17p9803hdibisou6rlr1sjbccdossgh7vtkd03ovlvnsl2n91lq94sqhughc62tnrual2jlrfk922sebp4nm22o7m5u9j40emft8r8/summary?name=mytest
-- function
GET /api/non-project-code/definitions/terms/by-hash/@6ee6j48hk3eovokflkgbmpbfr3oqj4hedqn8ocg3i4i0ko8j7nls7njjirmnh4k2bg8h95seaot798uuloqk62u2ttiqoceulkbmq2o/summary?name=func
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@6ee6j48hk3eovokflkgbmpbfr3oqj4hedqn8ocg3i4i0ko8j7nls7njjirmnh4k2bg8h95seaot798uuloqk62u2ttiqoceulkbmq2o/summary?name=func
-- constructor
GET /api/non-project-code/definitions/terms/by-hash/@altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0@d0/summary?name=Thing.This
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0@d0/summary?name=Thing.This
-- Long type signature
GET /api/non-project-code/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8/summary?name=funcWithLongType
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8/summary?name=funcWithLongType
-- Long type signature with render width
GET /api/non-project-code/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8/summary?renderWidth=20&name=funcWithLongType
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8/summary?renderWidth=20&name=funcWithLongType
-- Builtin Term
GET /api/non-project-code/definitions/terms/by-hash/@@IO.putBytes.impl.v3/summary?name=putBytesImpl
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@@IO.putBytes.impl.v3/summary?name=putBytesImpl
```
## Type Summary APIs
```api
-- data
GET /api/non-project-code/definitions/types/by-hash/@altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0/summary?name=Thing
GET /api/projects/scratch/branches/main/definitions/types/by-hash/@altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0/summary?name=Thing
-- data with type args
GET /api/non-project-code/definitions/types/by-hash/@nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg/summary?name=Maybe
GET /api/projects/scratch/branches/main/definitions/types/by-hash/@nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg/summary?name=Maybe
-- ability
GET /api/non-project-code/definitions/types/by-hash/@rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8/summary?name=Stream
GET /api/projects/scratch/branches/main/definitions/types/by-hash/@rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8/summary?name=Stream
-- builtin type
GET /api/non-project-code/definitions/types/by-hash/@@Nat/summary?name=Nat
GET /api/projects/scratch/branches/main/definitions/types/by-hash/@@Nat/summary?name=Nat
```

View File

@ -23,7 +23,7 @@ structural ability Stream s where
```api
-- term
GET /api/non-project-code/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8/summary?name=nat
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8/summary?name=nat
{
"displayName": "nat",
"hash": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
@ -42,7 +42,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sq
"tag": "Plain"
}
-- term without name uses hash
GET /api/non-project-code/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8/summary
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8/summary
{
"displayName": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
"hash": "#qkhkl0n238s1eqibd1ecb8605sqj1m4hpoaag177cu572otqlaf1u28c8suuuqgljdtthsjtr07rv04np05o6oa27ml9105k7uas0t8",
@ -61,7 +61,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@qkhkl0n238s1eqibd1ecb8605sq
"tag": "Plain"
}
-- doc
GET /api/non-project-code/definitions/terms/by-hash/@icfnhas71n8q5rm7rmpe51hh7bltsr7rb4lv7qadc4cbsifu1mhonlqj2d7836iar2ptc648q9p4u7hf40ijvld574421b6u8gpu0lo/summary?name=doc
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@icfnhas71n8q5rm7rmpe51hh7bltsr7rb4lv7qadc4cbsifu1mhonlqj2d7836iar2ptc648q9p4u7hf40ijvld574421b6u8gpu0lo/summary?name=doc
{
"displayName": "doc",
"hash": "#icfnhas71n8q5rm7rmpe51hh7bltsr7rb4lv7qadc4cbsifu1mhonlqj2d7836iar2ptc648q9p4u7hf40ijvld574421b6u8gpu0lo",
@ -80,7 +80,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@icfnhas71n8q5rm7rmpe51hh7bl
"tag": "Doc"
}
-- test
GET /api/non-project-code/definitions/terms/by-hash/@u17p9803hdibisou6rlr1sjbccdossgh7vtkd03ovlvnsl2n91lq94sqhughc62tnrual2jlrfk922sebp4nm22o7m5u9j40emft8r8/summary?name=mytest
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@u17p9803hdibisou6rlr1sjbccdossgh7vtkd03ovlvnsl2n91lq94sqhughc62tnrual2jlrfk922sebp4nm22o7m5u9j40emft8r8/summary?name=mytest
{
"displayName": "mytest",
"hash": "#u17p9803hdibisou6rlr1sjbccdossgh7vtkd03ovlvnsl2n91lq94sqhughc62tnrual2jlrfk922sebp4nm22o7m5u9j40emft8r8",
@ -111,7 +111,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@u17p9803hdibisou6rlr1sjbccd
"tag": "Test"
}
-- function
GET /api/non-project-code/definitions/terms/by-hash/@6ee6j48hk3eovokflkgbmpbfr3oqj4hedqn8ocg3i4i0ko8j7nls7njjirmnh4k2bg8h95seaot798uuloqk62u2ttiqoceulkbmq2o/summary?name=func
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@6ee6j48hk3eovokflkgbmpbfr3oqj4hedqn8ocg3i4i0ko8j7nls7njjirmnh4k2bg8h95seaot798uuloqk62u2ttiqoceulkbmq2o/summary?name=func
{
"displayName": "func",
"hash": "#6ee6j48hk3eovokflkgbmpbfr3oqj4hedqn8ocg3i4i0ko8j7nls7njjirmnh4k2bg8h95seaot798uuloqk62u2ttiqoceulkbmq2o",
@ -151,7 +151,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@6ee6j48hk3eovokflkgbmpbfr3o
"tag": "Plain"
}
-- constructor
GET /api/non-project-code/definitions/terms/by-hash/@altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0@d0/summary?name=Thing.This
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0@d0/summary?name=Thing.This
{
"displayName": "Thing.This",
"hash": "#altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0#0",
@ -191,7 +191,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@altimqs66j3dh94dpab5pg7j5ad
"tag": "DataConstructor"
}
-- Long type signature
GET /api/non-project-code/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8/summary?name=funcWithLongType
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8/summary?name=funcWithLongType
{
"displayName": "funcWithLongType",
"hash": "#ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8",
@ -378,7 +378,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59tton
"tag": "Plain"
}
-- Long type signature with render width
GET /api/non-project-code/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8/summary?renderWidth=20&name=funcWithLongType
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8/summary?renderWidth=20&name=funcWithLongType
{
"displayName": "funcWithLongType",
"hash": "#ieskgcjjvuegpecq9pbha59ttonke7pf31keeq0jlh31ijkfq00e06fdi36ae90u24pjva6ucqdbedropjgi3g3b75nu76ll5ls8ke8",
@ -565,7 +565,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@ieskgcjjvuegpecq9pbha59tton
"tag": "Plain"
}
-- Builtin Term
GET /api/non-project-code/definitions/terms/by-hash/@@IO.putBytes.impl.v3/summary?name=putBytesImpl
GET /api/projects/scratch/branches/main/definitions/terms/by-hash/@@IO.putBytes.impl.v3/summary?name=putBytesImpl
{
"displayName": "putBytesImpl",
"hash": "##IO.putBytes.impl.v3",
@ -671,7 +671,7 @@ GET /api/non-project-code/definitions/terms/by-hash/@@IO.putBytes.impl.v3/summar
```api
-- data
GET /api/non-project-code/definitions/types/by-hash/@altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0/summary?name=Thing
GET /api/projects/scratch/branches/main/definitions/types/by-hash/@altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0/summary?name=Thing
{
"displayName": "Thing",
"hash": "#altimqs66j3dh94dpab5pg7j5adjrndq61n803j7fg0v0ohdiut6or66bu1fiongpd45s5euiuo8ru47b928aqv8osln1ikdeg05hq0",
@ -710,7 +710,7 @@ GET /api/non-project-code/definitions/types/by-hash/@altimqs66j3dh94dpab5pg7j5ad
"tag": "Data"
}
-- data with type args
GET /api/non-project-code/definitions/types/by-hash/@nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg/summary?name=Maybe
GET /api/projects/scratch/branches/main/definitions/types/by-hash/@nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg/summary?name=Maybe
{
"displayName": "Maybe",
"hash": "#nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg",
@ -759,7 +759,7 @@ GET /api/non-project-code/definitions/types/by-hash/@nirp5os0q69o4e1u9p3t6mmq6l6
"tag": "Data"
}
-- ability
GET /api/non-project-code/definitions/types/by-hash/@rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8/summary?name=Stream
GET /api/projects/scratch/branches/main/definitions/types/by-hash/@rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8/summary?name=Stream
{
"displayName": "Stream",
"hash": "#rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8",
@ -808,7 +808,7 @@ GET /api/non-project-code/definitions/types/by-hash/@rfi1v9429f9qluv533l2iba77aa
"tag": "Ability"
}
-- builtin type
GET /api/non-project-code/definitions/types/by-hash/@@Nat/summary?name=Nat
GET /api/projects/scratch/branches/main/definitions/types/by-hash/@@Nat/summary?name=Nat
{
"displayName": "Nat",
"hash": "##Nat",

View File

@ -3,7 +3,7 @@
Should block an `add` if it requires an update on an in-file dependency.
```ucm:hide
.> builtins.merge
scratch/main> builtins.merge
```
```unison
@ -11,7 +11,7 @@ x = 1
```
```ucm
.> add
scratch/main> add
```
Update `x`, and add a new `y` which depends on the update
@ -24,5 +24,5 @@ y = x + 1
Try to add only the new `y`. This should fail because it requires an update to `x`, but we only ran an 'add'.
```ucm:error
.> add y
scratch/main> add y
```

View File

@ -20,7 +20,7 @@ x = 1
```
```ucm
.> add
scratch/main> add
⍟ I've added these definitions:
@ -55,7 +55,7 @@ y = x + 1
Try to add only the new `y`. This should fail because it requires an update to `x`, but we only ran an 'add'.
```ucm
.> add y
scratch/main> add y
x These definitions failed:

Some files were not shown because too many files have changed in this diff Show More