Update README master
authorCameron Ball <cameron@moodle.com>
Tue, 8 Jan 2019 07:09:25 +0000 (15:09 +0800)
committerCameron Ball <cameron@moodle.com>
Tue, 8 Jan 2019 07:09:25 +0000 (15:09 +0800)
README.md

index 8d66eca..9901f7b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -62,7 +62,6 @@ Monad is Functor and Applicative. You could say that Monad implements Functor an
 ### List Functor
 ```php
 use Widmogrod\Functional as f;
-use Widmogrod\Primitive\Listt;
 
 $list = f\fromIterable([
    ['id' => 1, 'name' => 'One'],
@@ -87,7 +86,6 @@ of applying function from the left list to a value in the right one.
 
 ```php
 use Widmogrod\Functional as f;
-use Widmogrod\Primitive\Listt;
 
 $listA = f\fromIterable([
     function($a) {
@@ -114,8 +112,8 @@ Extracting from a list of uneven values can be tricky and produce nasty code ful
 By combining List and Maybe Monad, this process becomes simpler and more readable.
 
 ```php
+use Widmogrod\Functional as f;
 use Widmogrod\Monad\Maybe;
-use Widmogrod\Primitive\Listt;
 
 $data = [
     ['id' => 1, 'meta' => ['images' => ['//first.jpg', '//second.jpg']]],
@@ -123,12 +121,14 @@ $data = [
     ['id' => 3],
 ];
 
-// $get :: String a -> Maybe [b] -> Maybe b
+// $get :: String a -> Maybe [b] -> [Maybe b]
 $get = function ($key) {
     return f\bind(function ($array) use ($key) {
-        return isset($array[$key])
-            ? Maybe\just($array[$key])
-            : Maybe\nothing();
+        return f\fromValue(
+            isset($array[$key])
+                ? Maybe\just($array[$key])
+                : Maybe\nothing()
+        );
     });
 };