You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For people who wish they didn't have to programme in JavaScript. [documentation](docs/README.md)
7
6
8
-
9
7
## Introduction
10
8
11
9
Monet is a library designed to bring great power to your JavaScript programming. It is a tool bag that assists Functional Programming by providing a rich set of Monads and other useful functions.
@@ -25,18 +23,20 @@ Download the [zip][gitZip] or [tar][gitTar] ball.
25
23
## Installation
26
24
27
25
Simply download and add to your html pages or we also support [bower] and [npm]. You can also include `monet-pimp.js` which contains extra functions on the `Object.prototype` for creating monads.
@@ -57,9 +57,11 @@ The `Maybe` type is the most common way of representing *nothingness* (or the `n
57
57
`Maybe` is effectively abstract and has two concrete subtypes: `Some` (also `Just`) and `None` (also `Nothing`).
58
58
59
59
### [Either](docs/EITHER.md)
60
+
60
61
Either (or the disjunct union) is a type that can either hold a value of type `A` or a value of type `B` but never at the same time. Typically it is used to represent computations that can fail with an error. Think of it as a better way to handle exceptions. We think of an `Either` as having two sides, the success is held on the right and the failure on the left. This is a right biased either which means that `map` and `flatMap` (`bind`) will operate on the right side of the either.
61
62
62
63
### [Validation](docs/VALIDATION.md)
64
+
63
65
Validation is not quite a monad as it [doesn't quite follow the monad rules](http://stackoverflow.com/questions/12211776/why-isnt-validation-a-monad-scalaz7), even though it has the monad methods. It that can hold either a success value or a failure value (i.e. an error message or some other failure object) and has methods for accumulating errors. We will represent a Validation like this: `Validation[E,A]` where `E` represents the error type and `A` represents the success type.
64
66
65
67
### [Immutable lists](docs/LIST.md)
@@ -72,6 +74,7 @@ Much like the immutable list, a Non Empty List can never be empty. It implements
72
74
and a guaranteed (total) tail.
73
75
74
76
### [IO](docs/IO.md)
77
+
75
78
The `IO` monad is for isolating effects to maintain referential transparency in your software. Essentially you create a description of your effects of which is performed as the last action in your programme. The IO is lazy and will not be evaluated until the `perform` (*alias* `run`) method is called.
76
79
77
80
### [Reader](docs/READER.md)
@@ -82,6 +85,7 @@ teeth into the `Reader` monad such as [these great talks](http://functionaltalks
82
85
The `Reader` monad provides a way to "weave" your configuration throughout your programme.
83
86
84
87
### [Free](docs/FREE.md)
88
+
85
89
The `Free` monad is a monad that is able to separate instructions from their interpreter. There are many applications for this monad, and one of them is for implementing Trampolines, (which is a way to make recursion constant stack for languages that don't support tail call elimination, like JavaScript!).
86
90
87
91
Please see [Ken Scambler](http://twitter.com/KenScambler)'s [excellent talk](http://www.slideshare.net/kenbot/running-free-with-the-monads) and [example project](https://github.com/kenbot/free) to get an in-depth understanding of this very useful monad.
@@ -90,7 +94,6 @@ Please see [Ken Scambler](http://twitter.com/KenScambler)'s [excellent talk](htt
90
94
91
95
Written and maintained by Chris Myers [@cwmyers](https://twitter.com/cwmyers) and Jakub Strojewski [@ulfryk](https://twitter.com/ulfryk). Follow Monet.js at [@monetjs](http://twitter.com/monetjs).
0 commit comments