Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class CollectionMonad extends Monad {
- public function __construct(array $value) {
- $this->value = $value;
- }
- public function bind($callback) {
- $newValues = array();
- foreach ($this->value as $value) {
- $newValues[] = $this->callCallback($callback, $value);
- }
- return new CollectionMonad($newValues);
- }
- }
Add Comment
Please, Sign In to add comment