/** * Get a function that expects two other functions and returns the composition * the two. * * @return IValue */ public static function composition() { return V::composition(); }
/** * Tests fourth applicative law: u <*> (v <*> w) = pure (.) <*> u <*> v <*> w * @dataProvider formlets_and_values */ public function testApplicativeComposition($formlet, $fn1, $fn2, $value, $contains_applicable) { if (!$contains_applicable) { $left = F::pure($fn1)->cmb(F::pure($fn2)->cmb($formlet)); $right = F::pure(V::composition())->cmb(F::pure($fn1))->cmb(F::pure($fn2))->cmb($formlet); $this->assertFormletsEqual($left, $right, $value, false); } else { $left = F::pure($fn1)->cmb($formlet->cmb(F::pure($value))); $right = F::pure(V::composition())->cmb(F::pure($fn1))->cmb($formlet)->cmb(F::pure($value)); $this->assertFormletsEqual($left, $right, $value, false); } }