src/Attempt.php
protected function run(MonadInterface $prevResult, callable $next = null)
    {
        try {
            $result = call_user_func($this->codeBlock, $prevResult);
            return ($result instanceof MonadInterface) ? $result : Success::unit($result);
        } catch (Exception $error) {
            return Error::unit($error);
        }
    }
protected function run(MonadInterface $prevResult, callable $next = null)
    {
        try {
            $result = call_user_func($this->codeBlock, $prevResult);
            return ($result instanceof MonadInterface) ? $result : Success::unit($result);
        } catch (Exception $error) {
            return Error::unit($error);
        }
    }
protected function run ( MonadInterface $ prevResult , callable $ next = null ) { try { $ result = call_user_func ( $ this -> codeBlock , $ prevResult ) ; return ( $ result instanceof MonadInterface ) ? $ result : Success :: unit ( $ result ) ; } catch ( Exception $ error ) { return Error :: unit ( $ error ) ; } }
Runs the monad's code-block.

@param MonadInterface $prevResult
@param callable $next

@return MonadInterface Either Success or Error in case an exception occured.
Runs the monad s code - block .