Widmogrod\Monad\Writer::of PHP Method

of() public static method

public static of ( $value, Widmogrod\FantasyLand\Monoid $side = null )
$side Widmogrod\FantasyLand\Monoid
    public static function of($value, FantasyLand\Monoid $side = null)
    {
        return new static($value, is_null($side) ? S::mempty() : $side);
    }

Usage Example

 public function provideData()
 {
     $addOne = function ($x) {
         return Writer::of($x + 1);
     };
     $addTwo = function ($x) {
         return Writer::of($x + 2);
     };
     return ['writer 0' => ['$f' => $addOne, '$g' => $addTwo, '$x' => 10]];
 }
All Usage Examples Of Widmogrod\Monad\Writer::of