Skip to content

Commit dffc7a5

Browse files
Monads are Applicative too
1 parent 3ddd7e8 commit dffc7a5

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/Functional/functions.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,20 +398,10 @@ function liftM2(
398398
Monad $ma = null,
399399
Monad $mb = null
400400
) {
401-
return curryN(
402-
3,
403-
function (
404-
callable $transformation,
405-
Monad $ma,
406-
Monad $mb
407-
) {
408-
return $ma->bind(function ($a) use ($mb, $transformation) {
409-
return $mb->map(function ($b) use ($a, $transformation) {
410-
return $transformation($a, $b);
411-
});
412-
});
413-
}
414-
)(...func_get_args());
401+
return call_user_func_array(
402+
liftA2,
403+
func_get_args()
404+
);
415405
}
416406

417407
/**

0 commit comments

Comments
 (0)