Skip to content

Instantly share code, notes, and snippets.

@jonathanstowe
Created September 5, 2021 14:11
Show Gist options
  • Select an option

  • Save jonathanstowe/7af59860823d65e83fd86c934b3e7412 to your computer and use it in GitHub Desktop.

Select an option

Save jonathanstowe/7af59860823d65e83fd86c934b3e7412 to your computer and use it in GitHub Desktop.

Revisions

  1. jonathanstowe created this gist Sep 5, 2021.
    14 changes: 14 additions & 0 deletions react.raku
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    use Cro::HTTP::Client;

    my $c;
    react {
    whenever Cro::HTTP::Client.get("http://cannibal.local") -> $v {
    whenever $v.body-text -> $m {
    $c = $m;
    done;
    }
    }
    }
    say $c;

    # vim: ft=raku
    13 changes: 13 additions & 0 deletions supply.raku
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    use Cro::HTTP::Client;

    my $c = await (supply {
    whenever Cro::HTTP::Client.get("http://cannibal.local") -> $v {
    whenever $v.body-text -> $m {
    emit $m;
    done;
    }
    }
    }).Promise;
    say $c;

    # vim: ft=raku
    6 changes: 6 additions & 0 deletions then.raku
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    use Cro::HTTP::Client;

    my $c = await Cro::HTTP::Client.get("http://cannibal.local").then( { $_.result.body-text }).then({ $_.result.result });
    say $c;

    # vim: ft=raku