aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--site/pastebin/raku-tuple-type-annotation.org26
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