Skip to content

Commit 0fb3e86

Browse files
Remove do/ado notation explanation in Monad and Applicative
1 parent bf1a5b4 commit 0fb3e86

File tree

2 files changed

+0
-76
lines changed

2 files changed

+0
-76
lines changed

src/Control/Applicative.purs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,6 @@ import Data.Unit (Unit, unit)
2929
-- | - Composition: `pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`
3030
-- | - Homomorphism: `(pure f) <*> (pure x) = pure (f x)`
3131
-- | - Interchange: `u <*> (pure y) = (pure (_ $ y)) <*> u`
32-
-- |
33-
-- | ### Ado Notation
34-
-- |
35-
-- | When using a type that has an instance for `Applicative`, one can use
36-
-- | "ado notation." In short, this code...
37-
-- | ```
38-
-- | foo =
39-
-- | functionThatTakes4Args <$> boxedA
40-
-- | <*> boxedB
41-
-- | <*> boxedUnit
42-
-- | <*> boxedC
43-
-- | where
44-
-- | functionThatTakes4Args a b _ c =
45-
-- | let x = a * a + b
46-
-- | in x + c
47-
-- | ```
48-
-- |
49-
-- | ... can be converted into into "ado notation:"
50-
-- | ```
51-
-- | foo = ado
52-
-- | a <- boxedA
53-
-- | b <- boxedB
54-
-- | boxedUnit
55-
-- | c <- boxedC
56-
-- | let x = a * a + b
57-
-- | in x + c
58-
-- | ```
59-
-- |
60-
-- | Note: if one wants to use "ado notation" but redefine what the in-scope
61-
-- | definitions are for `map`, `apply`, and `pure` in a given context, one can
62-
-- | use "qualified ado notation." This is an intermediate/advanced language
63-
-- | feature not explained here.
6432
class Apply f <= Applicative f where
6533
pure :: forall a. a -> f a
6634

src/Control/Monad.purs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,50 +28,6 @@ import Data.Unit (Unit)
2828
-- | - Left Identity: `pure x >>= f = f x`
2929
-- | - Right Identity: `x >>= pure = x`
3030
-- | - Applicative Superclass: `apply = ap`
31-
-- |
32-
-- | ### Do Notation
33-
-- |
34-
-- | When using a type that has an instance for `Monad`, one can use
35-
-- | "do notation." In short, this code...
36-
-- | ```
37-
-- | foo =
38-
-- | bind boxedA (\a ->
39-
-- | let b = a + 4
40-
-- | in bind boxedC (\c ->
41-
-- | bind boxedUnit (\_ ->
42-
-- | pure (a * b - c)
43-
-- | )
44-
-- | )
45-
-- | )
46-
-- | ```
47-
-- |
48-
-- | ... can be converted into this code...
49-
-- | ```
50-
-- | foo =
51-
-- | boxedA >>= (\a ->
52-
-- | let b = a + 4
53-
-- | in boxedC >>= (\c ->
54-
-- | boxedUnit >>= (\_ ->
55-
-- | pure (a * b - c)
56-
-- | )
57-
-- | )
58-
-- | )
59-
-- | ```
60-
-- |
61-
-- | ...which can be converted once more into "do notation:"
62-
-- | ```
63-
-- | foo = do
64-
-- | a <- boxedA
65-
-- | let b = a + 4
66-
-- | c <- boxedC
67-
-- | boxedUnit
68-
-- | pure (a * b - c)
69-
-- | ```
70-
-- |
71-
-- | Note: if one wants to use "do notation" but redefine what the in-scope
72-
-- | definitions are for `bind` and `pure` in a given context, one can use
73-
-- | "qualified do notation." This is an intermediate/advanced language feature
74-
-- | not explained here.
7531
class (Applicative m, Bind m) <= Monad m
7632

7733
instance monadFn :: Monad ((->) r)

0 commit comments

Comments
 (0)