Skip to content

Commit 17eaa58

Browse files
authored
Merge pull request #228 from 573/patch-1
Update content.adoc
2 parents 38c1960 + 616c30a commit 17eaa58

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

doc/content.adoc

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ over a *nothing* instance:
157157
.Example using fmap over *nothing*.
158158
[source, clojure]
159159
----
160-
(m/fmap inc (nothing))
160+
(require '[cats.monad.maybe :as maybe])
161+
(require '[cats.core :as m])
162+
163+
(m/fmap inc (maybe/nothing))
161164
;; => #<Nothing>
162165
----
163166

@@ -237,9 +240,9 @@ Let's convert this factory to use the Maybe type:
237240
(defn make-greeter
238241
[^String lang]
239242
(condp = lang
240-
"es" (just (fn [name] (str "Hola " name)))
241-
"en" (just (fn [name] (str "Hello " name)))
242-
(nothing)))
243+
"es" (maybe/just (fn [name] (str "Hola " name)))
244+
"en" (maybe/just (fn [name] (str "Hello " name)))
245+
(maybe/nothing)))
243246
----
244247

245248
As you can see, this version of the factory differs only slightly from the
@@ -248,13 +251,13 @@ can apply the returned greeter to any value without a defensive nil check:
248251

249252
[source, clojure]
250253
----
251-
(fapply (make-greeter "es") (just "Alex"))
254+
(m/fapply (make-greeter "es") (maybe/just "Alex"))
252255
;; => #<Just "Hola Alex">
253256
254-
(fapply (make-greeter "en") (just "Alex"))
257+
(m/fapply (make-greeter "en") (maybe/just "Alex"))
255258
;; => #<Just "Hello Alex">
256259
257-
(fapply (make-greeter "it") (just "Alex"))
260+
(m/fapply (make-greeter "it") (maybe/just "Alex"))
258261
;; => #<Nothing>
259262
----
260263

@@ -267,7 +270,7 @@ Examples:
267270
----
268271
(require '[cats.monad.maybe :as maybe])
269272
270-
(pure maybe/context 5)
273+
(m/pure maybe/context 5)
271274
;; => #<Just 5>
272275
----
273276

@@ -286,7 +289,7 @@ data structure. Let's look at a little example using `foldl`:
286289

287290
[source, clojure]
288291
----
289-
(foldl (fn [acc v] (+ acc v)) 0 [1 2 3 4 5])
292+
(m/foldl (fn [acc v] (+ acc v)) 0 [1 2 3 4 5])
290293
;; => 15
291294
----
292295

@@ -302,7 +305,7 @@ And the same operation can be done using `foldr`:
302305

303306
[source, clojure]
304307
----
305-
(foldr (fn [v wc] (+ v wc)) 0 [1 2 3 4 5])
308+
(m/foldr (fn [v wc] (+ v wc)) 0 [1 2 3 4 5])
306309
;; => 15
307310
----
308311

0 commit comments

Comments
 (0)