Fix linter errors

master
Freywar Ulvnaudgari 2 years ago
parent ac61856d3d
commit b883515a5f
  1. 1
      eslint.config.mjs
  2. 2
      src/bf.ts
  3. 4
      src/core.ts
  4. 2
      src/string.ts
  5. 2
      test/list.spec.ts
  6. 2
      test/num.spec.ts
  7. 3
      test/string.spec.ts

@ -28,6 +28,7 @@ export default [
rules: {
'arrow-body-style': 'error',
'no-extra-parens': ['error', 'all'],
'no-unexpected-multiline': 'off',
'sort-imports': ['error', { ignoreDeclarationSort: true }],
'@stylistic/quotes': ['error', 'single'],
'@stylistic/semi': ['error', 'always'],

@ -4,7 +4,7 @@ import { Num, Zero, ge, ifz, pred, succ } from './num';
import { x00 } from './byte';
import { Char, fromChar as _c, dec as cdec, inc as cinc, eq, ifn } from './char';
import { Pair, first, fst, second, snd, uncurry } from './pair';
import { List, Nil, cons, head, repeat, set, singleton, tail, update } from './list';
import { List, cons, head, repeat, set, singleton, tail, update } from './list';
import { Empty, String, get, len, snoc } from './string';
type Program = Pair<List<Num>, String>;

@ -1,10 +1,10 @@
export type L<T extends (v: P) => L<any>> = T & { run: () => T; }
export type L<T extends (v: P) => L<any>> = T & { run: () => T };
export function ___<T extends (v: P) => L<any>>(run: () => T): L<T> {
const r: T = ((p: Parameters<T>[0]) => {
let v: any;
return ___(() => run()(
___(() => v ??= p.run())
___(() => v ??= p.run()),
).run());
}) as T;

@ -3,7 +3,7 @@ import { Ord } from './ord';
import { Bool } from './bool';
import { fromNumber as _nn } from './num';
import { toChar as $c, Char, fromChar as _c, cmp as cmpc, eq as eqc } from './char';
import { Cons, List, Nil, append, cmp as cmpl, concat, cons, eq as eql, ge as gel, gt as gtl, le as lel, lt as ltl } from './list';
import { Cons, List, Nil, append, cmp as cmpl, eq as eql, ge as gel, gt as gtl, le as lel, lt as ltl } from './list';
export type String = List<Char>;

@ -1,5 +1,5 @@
import { describe, expect, it } from '@jest/globals';
import { toNative as $$, L, _, fromNative as __, ___, undef } from '../src/core';
import { toNative as $$, _, fromNative as __, ___, undef } from '../src/core';
import { toNOrd as $o, NOrd } from '../src/ord';
import { toBoolean as $b, iif } from '../src/bool';
import { toNumber as $n, toNumber as $nn, Num, Succ, Zero, fromNumber as _n, fromNumber as _nn, cmp as cmpn, eq as eqn, even, gt as ngt, show as nshow, odd, succ, sum } from '../src/num';

@ -1,5 +1,5 @@
import { describe, expect, it } from '@jest/globals';
import { ___, L, undef } from '../src/core';
import { ___, undef } from '../src/core';
import { toNOrd as $o, NOrd } from '../src/ord';
import { toBoolean as $b, fromBoolean as _b } from '../src/bool';
import { toNumber as $n, Num, Succ, Zero, fromNumber as _n, cmp, div, eq, ge, gt, ifz, le, lt, mod, mul, pred, show, sub, succ, sum } from '../src/num';

@ -1,5 +1,5 @@
import { describe, expect, it } from '@jest/globals';
import { L, _, ___, undef } from '../src/core';
import { _, ___, undef } from '../src/core';
import { NOrd, toNOrd } from '../src/ord';
import { toBoolean as $b } from '../src/bool';
import { toNumber as $n, Zero, gt as ngt } from '../src/num';
@ -55,7 +55,6 @@ describe('String', () => {
// });
// });
describe('empty', () => {
it('empty "" is True', () => {
expect($b(empty(_s('')))).toEqual(true);

Loading…
Cancel
Save