Add a doc test case for evaluating cases

This commit is contained in:
Dan Doel 2022-01-21 12:48:48 -05:00
parent ae9a7c80be
commit 7d56385db1
3 changed files with 87 additions and 0 deletions

View File

@ -73,6 +73,14 @@ id x = x
id (sqr 10)
```
also:
```
match 1 with
1 -> "hi"
_ -> "goodbye"
```
To include a typechecked snippet of code without evaluating it, you can do:
@typecheck ```

View File

@ -257,6 +257,14 @@ and the rendered output using `display`:
id (sqr 10)
```
also:
```
match 1 with
1 -> "hi"
_ -> "goodbye"
```
To include a typechecked snippet of code without
evaluating it, you can do:
@ -281,6 +289,14 @@ and the rendered output using `display`:
100
also:
match 1 with
1 -> "hi"
_ -> "goodbye"
"hi"
To include a typechecked snippet of code without evaluating
it, you can do:
@ -626,6 +642,14 @@ Lastly, it's common to build longer documents including subdocuments via `{{ sub
100
also:
match 1 with
1 -> "hi"
_ -> "goodbye"
"hi"
To include a typechecked snippet of code without
evaluating it, you can do:

View File

@ -77,6 +77,14 @@ We can display the guide before and after adding it to the codebase:
100
also:
match 1 with
1 -> "hi"
_ -> "goodbye"
"hi"
To include a typechecked snippet of code without
evaluating it, you can do:
@ -278,6 +286,14 @@ We can display the guide before and after adding it to the codebase:
100
also:
match 1 with
1 -> "hi"
_ -> "goodbye"
"hi"
To include a typechecked snippet of code without
evaluating it, you can do:
@ -485,6 +501,14 @@ rendered = Pretty.get (docFormatConsole doc.guide)
100
also:
match 1 with
1 -> "hi"
_ -> "goodbye"
"hi"
To include a typechecked snippet of code without
evaluating it, you can do:
@ -679,6 +703,14 @@ rendered = Pretty.get (docFormatConsole doc.guide)
100
also:
match 1 with
1 -> "hi"
_ -> "goodbye"
"hi"
To include a typechecked snippet of code without
evaluating it, you can do:
@ -1795,6 +1827,29 @@ rendered = Pretty.get (docFormatConsole doc.guide)
!Indent
(!Lit (Right (Plain " ")))
(!Lit (Right (Plain " ")))
(!Annotated.Group
(!Wrap
(!Lit (Right (Plain "also:"))))),
!Lit (Right (Plain "\n")),
!Lit (Right (Plain "\n")),
!Indent
(!Lit (Right (Plain " ")))
(!Lit (Right (Plain " ")))
(!Annotated.Group
(!Lit
(Left
(Eval
(Term.Term
(Any
(_ ->
(match 1 with
1 -> "hi"
_ -> "goodbye")))))))),
!Lit (Right (Plain "\n")),
!Lit (Right (Plain "\n")),
!Indent
(!Lit (Right (Plain " ")))
(!Lit (Right (Plain " ")))
(!Annotated.Group
(!Wrap
(!Annotated.Append