Tidy up
This commit is contained in:
103 files changed
+3663
-3779
No files matched your search
@@ -4,7 +4,7 @@ You can think of a monad as a container for a data type
|
||||
|
||||
If $M$ is a monad, that means an element of $M$: $M_a$ is some sort of container where $a$ is any datatype
|
||||
|
||||
One of the purposes of the `do` notation is to operate on the whole data structure by specify operations that must apply to each of the elements in the data structure, without having to specify the whole structure.
|
||||
One of the purposes of the `do` notation is to operate on the whole data structure by specifying operations that must apply to each of the elements in the data structure, without having to specify the whole structure.
|
||||
|
||||
$$
|
||||
M_a=\{x_1, x_2, x_3,...\}
|
||||
@@ -41,7 +41,7 @@ pure x
|
||||
|
||||
Monads can have containers within containers
|
||||
|
||||
Assume we have function `makeBlob` that maps every element of $a$ to an element of $M_b$
|
||||
Assume we have a function `makeBlob` that maps every element of $a$ to an element of $M_b$
|
||||
|
||||
```haskell
|
||||
makeBlob :: a -> Mb
|
||||
@@ -85,4 +85,4 @@ getList = do x <- getInt
|
||||
else do
|
||||
xs <- getList
|
||||
return (x:xs)
|
||||
```
|
||||
```
|
||||
Reference in new issue
Block a user