Avoid misleading type

This commit is contained in:
Tony Garnock-Jones 2021-02-24 22:15:57 +01:00
parent cf1a3da43d
commit 63270a97b4
1 changed files with 3 additions and 4 deletions

View File

@ -32,11 +32,10 @@ export interface Ref {
export type Attenuation = Array<Rewrite>;
export type Rewrite = { pattern: Pattern, template: Template };
export type PBind = { type: 'bind', name: string, pattern: Pattern };
export type PatternPointer =
| Ref
| { type: 'discard' }
| PBind
| { type: 'bind', name: string, pattern: Pattern }
| { type: 'and', patterns: Array<Pattern> }
| { type: 'or', patterns: Array<Pattern> }
| { type: 'not', pattern: Pattern };
@ -271,8 +270,8 @@ export function runRewrites(a: Attenuation, v: Assertion): Assertion | null {
return v;
}
export function rfilter(... patterns: Value<Exclude<PatternPointer, PBind>>[]): Rewrite {
return { pattern: pbind('a', por(... (patterns as Pattern[]))), template: tref('a') };
export function rfilter(... patterns: Pattern[]): Rewrite {
return { pattern: pbind('a', por(... patterns)), template: tref('a') };
}
export function attenuate(ref: Ref, ... a: Attenuation): Ref {