Skip to content

Commit 2224347

Browse files
Do not use do notation for explaining Array's Bind instance.
1 parent ec6710f commit 2224347

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Control/Bind.purs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ infixr 1 bindFlipped as =<<
6363
instance bindFn :: Bind ((->) r) where
6464
bind m f x = f (m x) x
6565

66-
-- | The `Array` monad's "do notation" works like a nested for loop. Each
67-
-- | `bind`/`elem <- array` adds another level of nesting in the loop:
66+
-- | The `Array` monad works like a nested for loop. Each
67+
-- | `bind`/`>>=` adds another level of nesting in the loop:
6868
-- | ```
6969
-- | foo :: Array Int
7070
-- | foo = do
71-
-- | eachElementInArray1 <- [0, 1]
72-
-- | eachElementInArray2 <- [1, 2]
73-
-- | pure (eachElementInArray1 + eachElementInArray2)
71+
-- | ["a", "b"] >>= \eachElementInArray1 ->
72+
-- | ["c", "d"] >>= \eachElementInArray2
73+
-- | pure (eachElementInArray1 <> eachElementInArray2)
7474
-- |
75-
-- | foo == [(0 + 1), (0 + 2), (1 + 1), (1 + 2)] == [1, 2, 2, 3]
75+
-- | foo == [ ("a" <> "c"), ("a" <> "d"), ("b" <> "c"), ("b" <> "d") == [ "ac", "ad", "bc", "bd"]
7676
-- | ```
7777
instance bindArray :: Bind Array where
7878
bind = arrayBind

0 commit comments

Comments
 (0)