functionalscript 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/crypto/sha2/module.f.ts +6 -2
- package/deno.json +1 -1
- package/dev/module.f.ts +1 -1
- package/fsc/module.f.ts +3 -1
- package/html/module.f.ts +6 -2
- package/json/serializer/module.f.ts +6 -2
- package/package.json +1 -1
- package/text/sgr/module.f.ts +0 -4
- package/text/utf16/module.f.ts +7 -2
- package/text/utf8/module.f.ts +4 -2
- package/types/bigint/module.f.ts +4 -2
- package/types/byte_set/module.f.ts +8 -4
- package/types/function/operator/module.f.ts +3 -1
- package/types/list/module.f.ts +3 -1
- package/types/number/module.f.ts +12 -6
- package/types/string/module.f.ts +12 -8
- package/types/string_set/module.f.ts +5 -3
package/crypto/sha2/module.f.ts
CHANGED
|
@@ -206,6 +206,10 @@ export const computeSha224
|
|
|
206
206
|
: (input: readonly number[]) => (bitsCount: number) => Hash8
|
|
207
207
|
= compute(init224)
|
|
208
208
|
|
|
209
|
-
export const compress256
|
|
209
|
+
export const compress256
|
|
210
|
+
: (data: Array16) => Hash8
|
|
211
|
+
= compress(init256)
|
|
210
212
|
|
|
211
|
-
export const compress224
|
|
213
|
+
export const compress224
|
|
214
|
+
: (data: Array16) => Hash8
|
|
215
|
+
= compress(init224)
|
package/deno.json
CHANGED
package/dev/module.f.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const todo = () => { throw 'not implemented' }
|
|
1
|
+
export const todo = (): never => { throw 'not implemented' }
|
package/fsc/module.f.ts
CHANGED
|
@@ -85,7 +85,9 @@ const toInit
|
|
|
85
85
|
: () => ToResult
|
|
86
86
|
= () => () => [[], init]
|
|
87
87
|
|
|
88
|
-
export const init
|
|
88
|
+
export const init
|
|
89
|
+
: ToResult
|
|
90
|
+
= create([
|
|
89
91
|
codePointRange(one(terminal))(toInit),
|
|
90
92
|
rangeSet(['\t', ' ', '\n', '\r'])(toInit),
|
|
91
93
|
range('!')(() => () => [['!'], unexpectedSymbol]),
|
package/html/module.f.ts
CHANGED
|
@@ -100,6 +100,10 @@ export const element
|
|
|
100
100
|
return element3(t)(a === undefined ? [{}, []]: typeof a === 'object' && !(a instanceof Array) ? [a, n] : [{}, [a, ...n]])
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
export const html
|
|
103
|
+
export const html
|
|
104
|
+
: (_: Element) => List<string>
|
|
105
|
+
= compose(element)(listConcat(['<!DOCTYPE html>']))
|
|
104
106
|
|
|
105
|
-
export const htmlToString
|
|
107
|
+
export const htmlToString
|
|
108
|
+
: (_: Element) => string
|
|
109
|
+
= compose(html)(stringConcat)
|
|
@@ -59,9 +59,13 @@ const wrap
|
|
|
59
59
|
return input => flat([seqOpen, join(input), seqClose])
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export const objectWrap
|
|
62
|
+
export const objectWrap
|
|
63
|
+
: (input: list.List<list.List<string>>) => list.List<string>
|
|
64
|
+
= wrap('{')('}')
|
|
63
65
|
|
|
64
|
-
export const arrayWrap
|
|
66
|
+
export const arrayWrap
|
|
67
|
+
: (input: list.List<list.List<string>>) => list.List<string>
|
|
68
|
+
= wrap('[')(']')
|
|
65
69
|
|
|
66
70
|
type Entry<T> = O.Entry<Unknown<T>>
|
|
67
71
|
|
package/package.json
CHANGED
package/text/sgr/module.f.ts
CHANGED
package/text/utf16/module.f.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
empty,
|
|
8
8
|
type List,
|
|
9
9
|
type Result,
|
|
10
|
+
type Thunk,
|
|
10
11
|
} from '../../types/list/module.f.ts'
|
|
11
12
|
import * as operator from '../../types/function/operator/module.f.ts'
|
|
12
13
|
import { contains } from '../../types/range/module.f.ts'
|
|
@@ -55,9 +56,13 @@ const codePointToUtf16
|
|
|
55
56
|
return [codePoint & 0xffff]
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
export const fromCodePointList
|
|
59
|
+
export const fromCodePointList
|
|
60
|
+
: (input: List<number>) => Thunk<number>
|
|
61
|
+
= flatMap(codePointToUtf16)
|
|
59
62
|
|
|
60
|
-
const u16
|
|
63
|
+
const u16
|
|
64
|
+
: (i: number) => boolean
|
|
65
|
+
= contains([0x0000, 0xFFFF])
|
|
61
66
|
|
|
62
67
|
const utf16ByteToCodePointOp
|
|
63
68
|
: operator.StateScan<u16, Utf16State, List<i32>>
|
package/text/utf8/module.f.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flatMap, flat, stateScan, type List } from '../../types/list/module.f.ts'
|
|
1
|
+
import { flatMap, flat, stateScan, type List, type Thunk } from '../../types/list/module.f.ts'
|
|
2
2
|
import * as operator from '../../types/function/operator/module.f.ts'
|
|
3
3
|
import * as Array from '../../types/array/module.f.ts'
|
|
4
4
|
|
|
@@ -30,7 +30,9 @@ const codePointToUtf8
|
|
|
30
30
|
return [errorMask]
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const fromCodePointList
|
|
33
|
+
export const fromCodePointList
|
|
34
|
+
: (input: List<number>) => Thunk<number>
|
|
35
|
+
= flatMap(codePointToUtf8)
|
|
34
36
|
|
|
35
37
|
const utf8StateToError
|
|
36
38
|
: (state: Utf8NonEmptyState) => i32
|
package/types/bigint/module.f.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as compare from '../function/compare/module.f.ts'
|
|
2
2
|
import * as Operator from '../function/operator/module.f.ts'
|
|
3
3
|
const { unsafeCmp } = compare
|
|
4
|
-
import { reduce } from '../list/module.f.ts'
|
|
4
|
+
import { reduce, type List } from '../list/module.f.ts'
|
|
5
5
|
|
|
6
6
|
type Unary = Operator.Unary<bigint, bigint>
|
|
7
7
|
|
|
@@ -9,7 +9,9 @@ export const addition
|
|
|
9
9
|
: (a: bigint) => (b: bigint) => bigint
|
|
10
10
|
= a => b => a + b
|
|
11
11
|
|
|
12
|
-
export const sum
|
|
12
|
+
export const sum
|
|
13
|
+
: (input: List<bigint>) => bigint
|
|
14
|
+
= reduce(addition)(0n)
|
|
13
15
|
|
|
14
16
|
export const abs
|
|
15
17
|
: (a: bigint) => bigint
|
|
@@ -46,13 +46,17 @@ const difference
|
|
|
46
46
|
|
|
47
47
|
// additional operations
|
|
48
48
|
|
|
49
|
-
export const set
|
|
49
|
+
export const set
|
|
50
|
+
: (_: number) => (b: ByteSet) => ByteSet
|
|
51
|
+
= compose(one)(union)
|
|
50
52
|
|
|
51
|
-
export const setRange
|
|
53
|
+
export const setRange
|
|
54
|
+
: (_: readonly [number, number]) => (b: ByteSet) => ByteSet
|
|
55
|
+
= compose(range)(union)
|
|
52
56
|
|
|
53
57
|
export const unset
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
: (n: Byte) => (s: ByteSet) => ByteSet
|
|
59
|
+
= n => s => difference(s)(one(n))
|
|
56
60
|
|
|
57
61
|
const counter = reverse(countdown(256))
|
|
58
62
|
|
package/types/list/module.f.ts
CHANGED
package/types/number/module.f.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { reduce } from '../list/module.f.ts'
|
|
1
|
+
import { reduce, type List } from '../list/module.f.ts'
|
|
2
2
|
import { addition, min as minOp, max as maxOp } from '../function/operator/module.f.ts'
|
|
3
3
|
import * as compare from '../function/compare/module.f.ts'
|
|
4
4
|
const { unsafeCmp } = compare
|
|
5
5
|
|
|
6
|
-
export const sum
|
|
6
|
+
export const sum
|
|
7
|
+
: (input: List<number>) => number
|
|
8
|
+
= reduce(addition)(0)
|
|
7
9
|
|
|
8
|
-
export const min
|
|
10
|
+
export const min
|
|
11
|
+
: (input: List<number>) => number | null
|
|
12
|
+
= reduce(minOp)(null)
|
|
9
13
|
|
|
10
|
-
export const max
|
|
14
|
+
export const max
|
|
15
|
+
: (input: List<number>) => number | null
|
|
16
|
+
= reduce(maxOp)(null)
|
|
11
17
|
|
|
12
18
|
export const cmp
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
: (a: number) => (b: number) => compare.Sign
|
|
20
|
+
= unsafeCmp
|
package/types/string/module.f.ts
CHANGED
|
@@ -6,17 +6,21 @@ const { unsafeCmp } = compare
|
|
|
6
6
|
import { join as joinOp, concat as concatOp, type Reduce } from '../function/operator/module.f.ts'
|
|
7
7
|
|
|
8
8
|
const reduce
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
: (o: Reduce<string>) => (input: list.List<string>) => string
|
|
10
|
+
= o => listReduce(o)('')
|
|
11
11
|
|
|
12
|
-
export const join
|
|
12
|
+
export const join
|
|
13
|
+
: (_: string) => (input: list.List<string>) => string
|
|
14
|
+
= compose(joinOp)(reduce)
|
|
13
15
|
|
|
14
|
-
export const concat
|
|
16
|
+
export const concat
|
|
17
|
+
: (input: list.List<string>) => string
|
|
18
|
+
= reduce(concatOp)
|
|
15
19
|
|
|
16
20
|
export const repeat
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
: (n: string) => (v: number) => string
|
|
22
|
+
= v => compose(listRepeat(v))(concat)
|
|
19
23
|
|
|
20
24
|
export const cmp
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
: (a: string) => (b: string) => compare.Sign
|
|
26
|
+
= unsafeCmp
|
|
@@ -28,8 +28,10 @@ export const set
|
|
|
28
28
|
: (value: string) => (s: StringSet) => StringSet
|
|
29
29
|
= value => btreeSet(cmp(value))(() => value)
|
|
30
30
|
|
|
31
|
-
export const fromValues
|
|
31
|
+
export const fromValues
|
|
32
|
+
: (input: List<string>) => StringSet
|
|
33
|
+
= fold(set)(null)
|
|
32
34
|
|
|
33
35
|
export const remove
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
: (value: string) => (s: StringSet) => StringSet
|
|
37
|
+
= compose(cmp)(btreeRemove)
|