Skip to content

Commit

Permalink
Merge branch 'change-readme'
Browse files Browse the repository at this point in the history
  • Loading branch information
nishimura committed Jul 6, 2016
2 parents 5a4081c + c5f8ab3 commit a2ac318
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Laiz Monad
```php
require 'vendor/autoload.php';

use function Laiz\Func\f;

$f = f(function($a, $b, $c){
return $a + $b + $c;
});
Expand All @@ -35,6 +37,10 @@ var_dump($f(1,2,3));
```php
require 'vendor/autoload.php';

use function Laiz\Func\f;
use function Laiz\Func\Maybe\Just;
use function Laiz\Func\Maybe\Nothing;

$a = Just(3);
$f = f(function($limit, $a){
return $limit > $a ? Just($a) : Nothing();
Expand All @@ -53,6 +59,9 @@ var_dump($a->bind($f4));
```php
require 'vendor/autoload.php';

use function Laiz\Func\Monad\ret;
use function Laiz\Func\Maybe\Just;

$monad = ret("Foo");
var_dump($monad->mappend([]));
// ['Foo']
Expand All @@ -70,6 +79,13 @@ var_dump($monad->mplus(Just("Baz")));
```php
require 'vendor/autoload.php';

use function Laiz\Func\f;
use function Laiz\Func\Functor\fmap;
use function Laiz\Func\Functor\fconst;
use function Laiz\Func\Monoid\mappend;
use function Laiz\Func\MonadZero\guard;
use function Laiz\Func\Maybe\fromMaybe;

// (integer d, Functor s, MonadPlus s) => d -> a -> d -> s a
function calc(...$args){
return f(function($d, $s, $n){
Expand Down

0 comments on commit a2ac318

Please sign in to comment.