Skip to content

Commit 5c4c781

Browse files
committed
Update static typing migration tutorial
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
1 parent 090d9f2 commit 5c4c781

7 files changed

Lines changed: 370 additions & 577 deletions

File tree

docs/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ tutorials/rnaseq-nf
177177
tutorials/data-lineage
178178
tutorials/workflow-outputs
179179
tutorials/static-types
180-
tutorials/records
181180
tutorials/typed-operators
182181
tutorials/metrics
183182
tutorials/flux

docs/process-typed.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Typed processes are a preview feature. The syntax and behavior may change in future releases.
1010
:::
1111

12-
Typed processes use a new syntax for inputs and outputs based on static types.
12+
Typed processes use a new syntax for inputs and outputs that supports static typing.
1313

1414
```nextflow
1515
nextflow.preview.types = true
@@ -38,7 +38,7 @@ To use this feature:
3838

3939
2. Set `nextflow.preview.types = true` in every script that uses typed processes.
4040

41-
See {ref}`syntax-process-typed` for the complete syntax reference and {ref}`migrating-static-types` to migrate existing code to static types.
41+
See {ref}`syntax-process-typed` for the complete syntax reference and {ref}`migrating-static-types` to migrate existing code to static typing.
4242

4343
## Inputs
4444

docs/reference/syntax.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,31 @@ In order for a script to be executable, it must either define an entry workflow
196196

197197
Entry workflow definitions are ignored when a script is included as a module. This way, the same script can be included as a module or executed as a pipeline.
198198

199+
### Workflow (typed)
200+
201+
A typed workflow is a workflow that uses static typing for inputs/outputs and dataflow logic:
202+
203+
```nextflow
204+
nextflow.preview.types = true
205+
206+
workflow greet {
207+
take:
208+
greetings: Channel<String>
209+
210+
main:
211+
messages = greetings.map { v -> "$v world!" }
212+
213+
emit:
214+
messages: Channel<String>
215+
}
216+
```
217+
218+
- Each workflow input in the `take:` section has a name and a type.
219+
220+
- Each named workflow output in the `emit:` section may specify a type.
221+
222+
See {ref}`workflow-typed-page` for more information on the semantics of typed workflows.
223+
199224
(syntax-process)=
200225

201226
### Process
@@ -269,9 +294,11 @@ See {ref}`process-page` for more information on the semantics of each process se
269294

270295
### Process (typed)
271296

272-
A typed process is a process that uses static types for inputs and/or outputs:
297+
A typed process is a process that uses static typing for inputs and outputs:
273298

274299
```nextflow
300+
nextflow.preview.types = true
301+
275302
process greet {
276303
input:
277304
greeting: String
@@ -363,6 +390,8 @@ enum Day {
363390

364391
Enum values in the above example can be accessed as `Day.MONDAY`, `Day.TUESDAY`, and so on.
365392

393+
(syntax-record-type)=
394+
366395
### Record type
367396

368397
A record type declaration consists of a name and a body. The body consists of one or more fields, where each field has a name and a type:

0 commit comments

Comments
 (0)