git.iko.soy/rowtype-yoga/purescript-lazy-joe
on main help sign in
Minor readme update
commitdf5396fe445a80617d1efcf04ca27c48e32a1736 authorsigma-andex <77549848+sigma-andex@users.noreply.github.com> dateThu 16 Jun 2022, 22:29 (4 years ago) parentd315315
1 file changed+12−8
README.md+12−8
README.md+12−8
@@ -8,10 +8,11 @@ For these days when you got the blues and are just too lazy to write ffi code.
88* [Installation](#installation)
99* [Usage](#usage)
1010 * [Method chaining](#method-chaining)
11− * [Uncurried](#uncurried)
12− * [Varargs](#varargs)
13− * [Scoped](#scoped)
14− * [Effectful](#effectful)
11+ * [Uncurried functions](#uncurried-functions)
12+ * [Varargs functions](#vararg-functions)
13+ * [Scoped functions](#scoped-functions)
14+ * [Effectful functions](#effectful-functions)
15+ * [`new` constructor](#new-constructor)
1516* [Credits](#credits)
1617
1718## Installation
@@ -75,7 +76,7 @@ Running it will print:
7576
7677![green leaf printed in bold green underline](./assets/green-leaf.png).
7778
78−### Uncurried
79+### Uncurried functions
7980
8081js typically uses uncurried functions (e.g. `f(a,b,c) `) instead of uncurried functions (e.g. `f(a)(b)(c)` ) like purescript. E.g. we can use the `blue` function as a three-argument uncurried function:
8182
@@ -97,7 +98,7 @@ Running it will print:
9798
9899![blue azul blau in blue colours](./assets/blau-azul.png)
99100
100−### Varargs
101+### Vararg functions
101102
102103js functions are sometimes designed to be variadic, i.e. to have a variable number of arguments. In fact, the colour methods in `chalk` are variadic methods (as you have seen in the previous example) and you can pass an arbitrary number of arguments:
103104```js
@@ -115,7 +116,7 @@ main = launchAff_ do
115116 log $ variadic blue [ "Hello", "world!", "Hola", "mundo!"]
116117```
117118
118−### Scoped
119+### Scoped functions
119120
120121Sometimes js functions don't work in purescript, because they sometimes use `this` internally which fails to resolve in a curried contex. E.g. simply using the `rgb` function from `chalk` as we did before will fail. To make it work again we will need to set the scope for `this` properly. You can use `scoped` to set the scope of a function to the module:
121122
@@ -131,7 +132,7 @@ Running it will print:
131132
132133![purple in bold purple with a kite](./assets/purple-kite.png)
133134
134−### Effectful
135+### Effectful functions
135136
136137Let's try another example and install minimalistic http-client `got`:
137138
@@ -164,6 +165,9 @@ main = launchAff_ do
164165
165166We import the `post` from `got`. The first thing we need to do is uncurry it, since it receives two arguments, the url and the json record. We then wrap it using `effectful` so that is run in an `Effect`. We can then call the effectful js function `json()` on the resulting `Promise` to get the body, so we can just `bind` (`>>=`) it.
166167
168+### `new` constructor
169+
170+TBA
167171
168172## Credits
169173