Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Jun 21, 2024
1 parent 256bcbd commit fa63738
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/dependency/Supported.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isNonNullObject } from "../utils/isNonNullObject.js"

export type Supported<T> = {
"@type": "Supported"
content: T
Expand All @@ -11,3 +13,7 @@ export function Supported<T>(content: T, supports: Set<string>): Supported<T> {
supports,
}
}

export function isSupported(x: any): x is Supported<any> {
return isNonNullObject(x) && x["@type"] === "Supported"
}
3 changes: 3 additions & 0 deletions src/merge/merge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isNothing } from "../cell/index.js"
import { isSupported, supportedMerge } from "../dependency/index.js"
import { defineGeneric, defineHandler } from "../generic/index.js"
import {
intervalContainsNumber,
Expand Down Expand Up @@ -65,3 +66,5 @@ defineHandler(merge, [isInterval, isNumber], (content, increment) =>
defineHandler(merge, [isNumber, isInterval], (content, increment) =>
intervalContainsNumber(increment, content) ? content : theContradiction,
)

defineHandler(merge, [isSupported, isSupported], supportedMerge)
2 changes: 1 addition & 1 deletion src/utils/Set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function setIsSupersetOf<T>(x: Set<T>, y: Set<T>): boolean {
return setIsSubsetOf(y, x)
}

export function setIsDisjointFrom(x: Set<T>, y: Set<T>): boolean {
export function setIsDisjointFrom<T>(x: Set<T>, y: Set<T>): boolean {
for (const e of x) {
if (y.has(e)) {
return false
Expand Down

0 comments on commit fa63738

Please sign in to comment.