/** * creates a new generator that passes the result of this generator * to the callable $k which should return a new generator. * * @param callable $k * @return Generator */ public function bind(callable $k) { return $this->bindGen(function (RoseTree $rose) use($k) { $gen = new self(function ($rng, $size) use($rose, $k) { return $rose->fmap($k)->fmap(FP::method('call', $rng, $size)); }); return $gen->fmapGen(FP::method('join')); }); }