From 907073bc6903bb07f56e43d7c721c04d3af2e3fb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 29 Dec 2019 21:22:54 -0300 Subject: pastebin: Add raku type snippet --- site/pastebin/raku-tuple-type-annotation.org | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 site/pastebin/raku-tuple-type-annotation.org (limited to 'site/pastebin') 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 -- cgit v1.2.3