value ) ); } /** * @param callable $fn * * @return mixed|null */ public function filter( $fn = null ) { $fn = $fn ?: Fns::identity(); return $fn( $this->value ) ? $this->value : null; } /** * @return mixed */ public function join() { if ( ! $this->value instanceof Wrapper ) { return $this->value; } return $this->value->join(); } /** * @param mixed $value * * @return Wrapper */ public function ap( $value ) { return self::of( call_user_func( $this->value, $value ) ); // $this->value should be callable and curried } /** * @return mixed */ public function get() { return $this->value; } }