Esempio n. 1
0
 /**
  * @dataProvider provideFunctions
  */
 public function test_it_should_curry_if_not_enough_args_passed(callable $func, array $args, $expected)
 {
     $flipped = f\flip($func);
     $x = f\head($args);
     $xs = f\tail($args);
     $curried = $flipped($x);
     $this->assertEquals($expected, call_user_func_array($curried, $xs));
 }
Esempio n. 2
0
/**
 * getArgs :: IO [String]
 *
 * Computation getArgs returns a list of the program's command line arguments (not including the program name).
 *
 * @throws IOError
 *
 * @return M\IO
 */
function getArgs()
{
    return M\IO::of(function () {
        if (!ini_get('register_argc_argv')) {
            throw userError(sprintf('argv is not available, because ini option "register_argc_argv" is disabled'));
        }
        return f\tail($_SERVER['argv']);
    });
}
Esempio n. 3
0
 /**
  * @dataProvider provideData
  */
 public function test_it_should_return_all_elements_exception_of_a_first($list, $expected)
 {
     $this->assertEquals($expected, f\tail($list));
 }