Skip to content

Commit 5bc5c45

Browse files
committed
Fixes example w/o slurpy
1 parent 05b4225 commit 5bc5c45

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

examples/functional/monads.pl renamed to examples/functional/monads.p6

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#!/usr/bin/env perl6
2+
3+
use v6;
4+
15
# Definition:
26
# Haskell: IO a
37
# Perl 6: { a }
@@ -8,9 +12,8 @@
812
# (>>=) :: (Monad m) => m a -> (a -> m b) -> m b
913
sub mbind(
1014
Code $ma, # m a
11-
Code $f, # (a -> m b)
12-
# This should be "Code $f returns Code", but Pugs doesn't
13-
# grok that yet.
15+
Code $f # (a -> m b)
16+
--> Code
1417
) {
1518
return {
1619
my $a = $ma(); # Run m a, yielding a
@@ -96,7 +99,8 @@ ()
9699
# results :: IO [String]
97100
my $results = sequence(@actions);
98101

99-
my $echo_prefixed = mbind($results, -> *@results {
102+
my $echo_prefixed = mbind($results, -> @results {
103+
say @results;
100104
mapM(-> Str $x { putStrLn($x) }, @results);
101105
});
102106
$echo_prefixed();

0 commit comments

Comments
 (0)