Skip to content

Commit 231c2d0

Browse files
committed
Docs: add Semigroup examples
1 parent 6a3c7cb commit 231c2d0

7 files changed

+390
-85
lines changed

code2comment.html

+23-25
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
<!DOCTYPE html>
22
<html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>code 2 comment</title>
6+
</head>
37

4-
<head>
5-
<meta charset="UTF-8" />
6-
<title>code 2 comment</title>
7-
</head>
8-
9-
<body>
10-
<div id="app">
11-
<textarea id="code" cols="100" rows="20"></textarea>
12-
<textarea id="comment" cols="100" rows="20"></textarea>
13-
<button id="transform">transform</button>
14-
</div>
15-
<script>
16-
const transform = document.getElementById('transform')
17-
const code = document.getElementById('code')
18-
const comment = document.getElementById('comment')
19-
transform.onclick = () => {
20-
comment.value = t(code.value)
21-
}
22-
function t(src) {
23-
const lines = src.split('\n').map(line => '* ' + line.replace('../src/', 'fp-ts/lib/'))
24-
return '*\n* @example\n' + lines.join('\n') + '\n'
25-
}
26-
</script>
27-
</body>
28-
8+
<body>
9+
<div id="app">
10+
<textarea id="code" cols="100" rows="20"></textarea>
11+
<textarea id="comment" cols="100" rows="20"></textarea>
12+
<button id="transform">transform</button>
13+
</div>
14+
<script>
15+
const transform = document.getElementById('transform')
16+
const code = document.getElementById('code')
17+
const comment = document.getElementById('comment')
18+
transform.onclick = () => {
19+
comment.value = t(code.value)
20+
}
21+
function t(src) {
22+
const lines = src.split('\n').map((line) => '* ' + line.replace('../src/', 'fp-ts/'))
23+
return '*\n* @example\n' + lines.join('\n') + '\n'
24+
}
25+
</script>
26+
</body>
2927
</html>

docs/modules/Array.ts.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ Break an array into its first element and remaining elements
12931293
**Signature**
12941294

12951295
```ts
1296-
export declare const foldLeft: <A, B>(onNil: Lazy<B>, onCons: (head: A, tail: A[]) => B) => (as: A[]) => B
1296+
export declare const foldLeft: <A, B>(onEmpty: Lazy<B>, onCons: (head: A, tail: A[]) => B) => (as: A[]) => B
12971297
```
12981298

12991299
**Example**
@@ -1317,7 +1317,7 @@ Break an array into its initial elements and the last element
13171317
**Signature**
13181318

13191319
```ts
1320-
export declare const foldRight: <A, B>(onNil: Lazy<B>, onCons: (init: A[], last: A) => B) => (as: A[]) => B
1320+
export declare const foldRight: <A, B>(onEmpty: Lazy<B>, onCons: (init: A[], last: A) => B) => (as: A[]) => B
13211321
```
13221322

13231323
Added in v2.0.0

docs/modules/ReadonlyArray.ts.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ Break an array into its first element and remaining elements
11721172

11731173
```ts
11741174
export declare function foldLeft<A, B>(
1175-
onNil: Lazy<B>,
1175+
onEmpty: Lazy<B>,
11761176
onCons: (head: A, tail: ReadonlyArray<A>) => B
11771177
): (as: ReadonlyArray<A>) => B
11781178
```
@@ -1199,7 +1199,7 @@ Break an array into its initial elements and the last element
11991199

12001200
```ts
12011201
export declare function foldRight<A, B>(
1202-
onNil: Lazy<B>,
1202+
onEmpty: Lazy<B>,
12031203
onCons: (init: ReadonlyArray<A>, last: A) => B
12041204
): (as: ReadonlyArray<A>) => B
12051205
```

0 commit comments

Comments
 (0)