diff options
author | EuAndreh <eu@euandre.org> | 2019-12-29 21:22:54 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-12-29 21:22:54 -0300 |
commit | 907073bc6903bb07f56e43d7c721c04d3af2e3fb (patch) | |
tree | 174ae8923f34250b31e47906fe6c2cfc8c264d11 /site | |
parent | check-spelling.sh: Print only unique entries of unkown words (diff) | |
download | euandre.org-907073bc6903bb07f56e43d7c721c04d3af2e3fb.tar.gz euandre.org-907073bc6903bb07f56e43d7c721c04d3af2e3fb.tar.xz |
pastebin: Add raku type snippet
Diffstat (limited to '')
-rw-r--r-- | site/pastebin/raku-tuple-type-annotation.org | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/site/pastebin/raku-tuple-type-annotation.org b/site/pastebin/raku-tuple-type-annotation.org new file mode 100644 index 0000000..c2ca83c --- /dev/null +++ b/site/pastebin/raku-tuple-type-annotation.org @@ -0,0 +1,26 @@ +#+TITLE: Raku tuple type annotation +2019-12-29 dimanche 21:11 +#+BEGIN_SRC raku -n +# Single Str return value: this works +sub f1(Str $in --> Str) { + $in; +} + +# Tuple of Str as return value: this works +sub f2(Str $in) { + ($in, $in); +} + +# Tuple of Str as return value with type annotation: this doesn't works +sub f2(Str $in --> (Str, Str)) { + ($in, $in); +} + +#+END_SRC + +Error log is: + +#+BEGIN_SRC text -n +===SORRY!=== Error while compiling /path/to/my/file +Malformed return value +#+END_SRC |