Skip to content
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