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.
@@ -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 = compress(init256)
209
+ export const compress256
210
+ : (data: Array16) => Hash8
211
+ = compress(init256)
210
212
 
211
- export const compress224 = compress(init224)
213
+ export const compress224
214
+ : (data: Array16) => Hash8
215
+ = compress(init224)
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalscript/functionalscript",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "license": "AGPL-3.0-only",
5
5
  "exports": {
6
6
  "./com/cpp": "./com/cpp/module.f.ts",
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 = create([
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 = compose(element)(listConcat(['<!DOCTYPE html>']))
103
+ export const html
104
+ : (_: Element) => List<string>
105
+ = compose(element)(listConcat(['<!DOCTYPE html>']))
104
106
 
105
- export const htmlToString = compose(html)(stringConcat)
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 = wrap('{')('}')
62
+ export const objectWrap
63
+ : (input: list.List<list.List<string>>) => list.List<string>
64
+ = wrap('{')('}')
63
65
 
64
- export const arrayWrap = wrap('[')(']')
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "description": "FunctionalScript is a functional subset of JavaScript",
6
6
  "scripts": {
@@ -6,12 +6,8 @@ export const sgr
6
6
  = c => `\x1b[${c.toString()}m`
7
7
 
8
8
  export const codes = {
9
- /** @readonly */
10
9
  reset: sgr(0),
11
- /** @readonly */
12
10
  bold: sgr(1),
13
- /** @readonly */
14
11
  fgRed: sgr(31),
15
- /** @readonly */
16
12
  fgGreen: sgr(32),
17
13
  }
@@ -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 = flatMap(codePointToUtf16)
59
+ export const fromCodePointList
60
+ : (input: List<number>) => Thunk<number>
61
+ = flatMap(codePointToUtf16)
59
62
 
60
- const u16 = contains([0x0000, 0xFFFF])
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>>
@@ -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 = flatMap(codePointToUtf8)
33
+ export const fromCodePointList
34
+ : (input: List<number>) => Thunk<number>
35
+ = flatMap(codePointToUtf8)
34
36
 
35
37
  const utf8StateToError
36
38
  : (state: Utf8NonEmptyState) => i32
@@ -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 = reduce(addition)(0n)
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 = compose(one)(union)
49
+ export const set
50
+ : (_: number) => (b: ByteSet) => ByteSet
51
+ = compose(one)(union)
50
52
 
51
- export const setRange = compose(range)(union)
53
+ export const setRange
54
+ : (_: readonly [number, number]) => (b: ByteSet) => ByteSet
55
+ = compose(range)(union)
52
56
 
53
57
  export const unset
54
- : (n: Byte) => (s: ByteSet) => ByteSet
55
- = n => s => difference(s)(one(n))
58
+ : (n: Byte) => (s: ByteSet) => ByteSet
59
+ = n => s => difference(s)(one(n))
56
60
 
57
61
  const counter = reverse(countdown(256))
58
62
 
@@ -58,6 +58,8 @@ export const max
58
58
  : Reduce<number>
59
59
  = a => b => a > b ? a : b
60
60
 
61
- export const increment = addition(1)
61
+ export const increment
62
+ : (b: number) => number
63
+ = addition(1)
62
64
 
63
65
  export const counter = () => increment
@@ -222,7 +222,9 @@ export const isEmpty
222
222
  .then(logicalNot)
223
223
  .result
224
224
 
225
- export const every = fn(map(logicalNot))
225
+ export const every
226
+ : (_: List<boolean>) => boolean
227
+ = fn(map(logicalNot))
226
228
  .then(some)
227
229
  .then(logicalNot)
228
230
  .result
@@ -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 = reduce(addition)(0)
6
+ export const sum
7
+ : (input: List<number>) => number
8
+ = reduce(addition)(0)
7
9
 
8
- export const min = reduce(minOp)(null)
10
+ export const min
11
+ : (input: List<number>) => number | null
12
+ = reduce(minOp)(null)
9
13
 
10
- export const max = reduce(maxOp)(null)
14
+ export const max
15
+ : (input: List<number>) => number | null
16
+ = reduce(maxOp)(null)
11
17
 
12
18
  export const cmp
13
- : (a: number) => (b: number) => compare.Sign
14
- = unsafeCmp
19
+ : (a: number) => (b: number) => compare.Sign
20
+ = unsafeCmp
@@ -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
- : (o: Reduce<string>) => (input: list.List<string>) => string
10
- = o => listReduce(o)('')
9
+ : (o: Reduce<string>) => (input: list.List<string>) => string
10
+ = o => listReduce(o)('')
11
11
 
12
- export const join = compose(joinOp)(reduce)
12
+ export const join
13
+ : (_: string) => (input: list.List<string>) => string
14
+ = compose(joinOp)(reduce)
13
15
 
14
- export const concat = reduce(concatOp)
16
+ export const concat
17
+ : (input: list.List<string>) => string
18
+ = reduce(concatOp)
15
19
 
16
20
  export const repeat
17
- : (n: string) => (v: number) => string
18
- = v => compose(listRepeat(v))(concat)
21
+ : (n: string) => (v: number) => string
22
+ = v => compose(listRepeat(v))(concat)
19
23
 
20
24
  export const cmp
21
- : (a: string) => (b: string) => compare.Sign
22
- = unsafeCmp
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 = fold(set)(null)
31
+ export const fromValues
32
+ : (input: List<string>) => StringSet
33
+ = fold(set)(null)
32
34
 
33
35
  export const remove
34
- : (value: string) => (s: StringSet) => StringSet
35
- = compose(cmp)(btreeRemove)
36
+ : (value: string) => (s: StringSet) => StringSet
37
+ = compose(cmp)(btreeRemove)