Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the fix-2805 transcript to use return type #5586

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions unison-src/transcripts-using-base/fix-2805.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
When running a main function in `ucm` a numeric argument is replaced by the potential last result of a find command:

``` unison
main : '{IO, Exception} ()
main _ =
printLine ("Hello " ++ Optional.getOrBug "definitely passed an arg" (List.head !getArgs) ++ "!")
main : '{IO, Exception} Text
main _ = "Hello " ++ Optional.getOrBug "definitely passed an arg" (List.head !getArgs) ++ "!"
```

First we run it with no numbered results in the history, so if number expansion is applied, it should end up calling `main` with zero args, whereas without number expansion, we get a single argument, “1”, passed to it.

``` ucm
scratch/main> run main 1

"Hello 1!"
```

Now we set it up so there _are_ numbered results in the history. If number expansion is applied here, we will get an error “`run` can’t accept a numbered argument […]”, and otherwise our expected "1".

``` ucm
scratch/main> find.all isLeft
scratch/main> run main 1

"Hello 1!"
```
11 changes: 5 additions & 6 deletions unison-src/transcripts-using-base/fix-2805.output.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
When running a main function in `ucm` a numeric argument is replaced by the potential last result of a find command:

``` unison
main : '{IO, Exception} ()
main _ =
printLine ("Hello " ++ Optional.getOrBug "definitely passed an arg" (List.head !getArgs) ++ "!")
main : '{IO, Exception} Text
main _ = "Hello " ++ Optional.getOrBug "definitely passed an arg" (List.head !getArgs) ++ "!"
```

``` ucm :added-by-ucm
Expand All @@ -15,15 +14,15 @@ main _ =

⍟ These new definitions are ok to `add`:

main : '{IO, Exception} ()
main : '{IO, Exception} Text
```

First we run it with no numbered results in the history, so if number expansion is applied, it should end up calling `main` with zero args, whereas without number expansion, we get a single argument, “1”, passed to it.

``` ucm
scratch/main> run main 1

()
"Hello 1!"
```

Now we set it up so there *are* numbered results in the history. If number expansion is applied here, we will get an error “`run` can’t accept a numbered argument \[…\]”, and otherwise our expected "1".
Expand All @@ -35,5 +34,5 @@ scratch/main> find.all isLeft

scratch/main> run main 1

()
"Hello 1!"
```
Loading