Skip to content

Commit

Permalink
use rewriteRelativeImportExtensions
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Dec 4, 2024
1 parent a78f525 commit cf5b9d9
Show file tree
Hide file tree
Showing 93 changed files with 298 additions and 297 deletions.
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"format": "prettier src --write"
},
"devDependencies": {
"@types/node": "^22.9.0",
"prettier": "^3.3.3",
"@types/node": "^22.10.1",
"prettier": "^3.4.2",
"prettier-plugin-organize-imports": "^4.1.0",
"typescript": "^5.6.3"
"typescript": "^5.7.2"
},
"license": "GPL-3.0-or-later"
}
4 changes: 2 additions & 2 deletions src/belief-system/BeliefSystem.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Belief, isBelief } from "../belief/index.js"
import { isNonNullObject } from "../utils/isNonNullObject.js"
import { Belief, isBelief } from "../belief/index.ts"
import { isNonNullObject } from "../utils/isNonNullObject.ts"

export type BeliefSystem<A> = {
"@type": "BeliefSystem"
Expand Down
8 changes: 4 additions & 4 deletions src/belief-system/assimilateBelief.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Belief } from "../belief/index.js"
import { isStrongerBelief } from "../belief/index.js"
import { type Nothing, isNothing } from "../nothing/index.js"
import { BeliefSystem } from "./BeliefSystem.js"
import type { Belief } from "../belief/index.ts"
import { isStrongerBelief } from "../belief/index.ts"
import { type Nothing, isNothing } from "../nothing/index.ts"
import { BeliefSystem } from "./BeliefSystem.ts"

export function assimilateBelief<A>(
base: BeliefSystem<A>,
Expand Down
4 changes: 2 additions & 2 deletions src/belief-system/assimilateBeliefSystem.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assimilateBelief } from "./assimilateBelief.js"
import type { BeliefSystem } from "./BeliefSystem.js"
import { assimilateBelief } from "./assimilateBelief.ts"
import type { BeliefSystem } from "./BeliefSystem.ts"

// The procedure `assimilate` incorporates all the given items, one by
// one, into the given belief system with no deduction of
Expand Down
6 changes: 3 additions & 3 deletions src/belief-system/beliefSystemEqual.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Belief, beliefEqual } from "../belief/index.js"
import { QuotientSet } from "../utils/quotient-set/index.js"
import type { BeliefSystem } from "./BeliefSystem.js"
import { type Belief, beliefEqual } from "../belief/index.ts"
import { QuotientSet } from "../utils/quotient-set/index.ts"
import type { BeliefSystem } from "./BeliefSystem.ts"

export function beliefSystemEqual<A>(
x: BeliefSystem<A>,
Expand Down
10 changes: 5 additions & 5 deletions src/belief-system/beliefSystemMerge.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
beliefMergeManyStillBelieved,
checkConsistent,
} from "../belief/index.js"
import { type Contradiction } from "../contradiction/index.js"
import { assimilateBelief } from "./assimilateBelief.js"
import { assimilateBeliefSystem } from "./assimilateBeliefSystem.js"
import { BeliefSystem } from "./BeliefSystem.js"
} from "../belief/index.ts"
import { type Contradiction } from "../contradiction/index.ts"
import { assimilateBelief } from "./assimilateBelief.ts"
import { assimilateBeliefSystem } from "./assimilateBeliefSystem.ts"
import { BeliefSystem } from "./BeliefSystem.ts"

// Asking the belief system to deduce all the consequences of all its
// beliefs all the time is perhaps a bad idea, so when we merge belief
Expand Down
8 changes: 4 additions & 4 deletions src/belief-system/beliefSystemQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
beliefMergeManyStillBelieved,
checkConsistent,
type Belief,
} from "../belief/index.js"
import type { Nothing } from "../nothing/Nothing.js"
import type { BeliefSystem } from "./BeliefSystem.js"
import { assimilateBelief } from "./assimilateBelief.js"
} from "../belief/index.ts"
import type { Nothing } from "../nothing/Nothing.ts"
import type { BeliefSystem } from "./BeliefSystem.ts"
import { assimilateBelief } from "./assimilateBelief.ts"

export function beliefSystemQuery<A>(
beliefSystem: BeliefSystem<A>,
Expand Down
8 changes: 4 additions & 4 deletions src/belief-system/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from "./BeliefSystem.js"
export * from "./beliefSystemEqual.js"
export * from "./beliefSystemMerge.js"
export * from "./beliefSystemQuery.js"
export * from "./BeliefSystem.ts"
export * from "./beliefSystemEqual.ts"
export * from "./beliefSystemMerge.ts"
export * from "./beliefSystemQuery.ts"
8 changes: 4 additions & 4 deletions src/belief/Belief.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from "node:assert"
import { test } from "node:test"
import { Cell, patch } from "../cell/index.js"
import { Interval, intervalAlmostEqual } from "../interval/index.js"
import { run } from "../scheduler/index.js"
import { Belief, beliefEqual, isBelief } from "./index.js"
import { Cell, patch } from "../cell/index.ts"
import { Interval, intervalAlmostEqual } from "../interval/index.ts"
import { run } from "../scheduler/index.ts"
import { Belief, beliefEqual, isBelief } from "./index.ts"

test("dependency / a justified-intervals anomaly", async () => {
// A: [ ]
Expand Down
4 changes: 2 additions & 2 deletions src/belief/Belief.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toReasons, type Reasons } from "../reason/index.js"
import { isNonNullObject } from "../utils/isNonNullObject.js"
import { toReasons, type Reasons } from "../reason/index.ts"
import { isNonNullObject } from "../utils/isNonNullObject.ts"

export type Belief<T> = {
"@type": "Belief"
Expand Down
4 changes: 2 additions & 2 deletions src/belief/beliefEqual.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { setEqual } from "../utils/set/index.js"
import { type Belief } from "./index.js"
import { setEqual } from "../utils/set/index.ts"
import { type Belief } from "./index.ts"

export function beliefEqual<A>(
x: Belief<A>,
Expand Down
6 changes: 3 additions & 3 deletions src/belief/beliefMerge.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { merge } from "../merge/index.js"
import { setIsSubsetOf, setUnion } from "../utils/set/index.js"
import { Belief } from "./Belief.js"
import { merge } from "../merge/index.ts"
import { setIsSubsetOf, setUnion } from "../utils/set/index.ts"
import { Belief } from "./Belief.ts"

// The important thing is to describe how to merge the information
// contained in two such data structures; The value contained in the
Expand Down
6 changes: 3 additions & 3 deletions src/belief/beliefMergeMany.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { merge } from "../merge/merge.js"
import { type Nothing, nothing } from "../nothing/Nothing.js"
import type { Belief } from "./Belief.js"
import { merge } from "../merge/merge.ts"
import { type Nothing, nothing } from "../nothing/Nothing.ts"
import type { Belief } from "./Belief.ts"

export function beliefMergeMany<A>(
beliefs: Array<Belief<A>>,
Expand Down
8 changes: 4 additions & 4 deletions src/belief/beliefMergeManyStillBelieved.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Belief } from "../belief/Belief.js"
import { beliefMergeMany } from "../belief/index.js"
import { type Nothing } from "../nothing/Nothing.js"
import { isStillBelieved } from "./isStillBelieved.js"
import type { Belief } from "../belief/Belief.ts"
import { beliefMergeMany } from "../belief/index.ts"
import { type Nothing } from "../nothing/Nothing.ts"
import { isStillBelieved } from "./isStillBelieved.ts"

// This function finds the most informative consequence
// of the current worldview. It does this by using merge to combine
Expand Down
8 changes: 4 additions & 4 deletions src/belief/checkConsistent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isContradictory } from "../contradiction/isContradictory.js"
import { processNogood } from "../nogood/index.js"
import type { Nothing } from "../nothing/index.js"
import { isBelief, type Belief } from "./Belief.js"
import { isContradictory } from "../contradiction/isContradictory.ts"
import { processNogood } from "../nogood/index.ts"
import type { Nothing } from "../nothing/index.ts"
import { isBelief, type Belief } from "./Belief.ts"

export function checkConsistent(belief: Nothing | Belief<any>): void {
if (isBelief(belief)) {
Expand Down
16 changes: 8 additions & 8 deletions src/belief/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * from "./Belief.js"
export * from "./beliefEqual.js"
export * from "./beliefMerge.js"
export * from "./beliefMergeMany.js"
export * from "./beliefMergeManyStillBelieved.js"
export * from "./checkConsistent.js"
export * from "./isStillBelieved.js"
export * from "./isStrongerBelief.js"
export * from "./Belief.ts"
export * from "./beliefEqual.ts"
export * from "./beliefMerge.ts"
export * from "./beliefMergeMany.ts"
export * from "./beliefMergeManyStillBelieved.ts"
export * from "./checkConsistent.ts"
export * from "./isStillBelieved.ts"
export * from "./isStrongerBelief.ts"
6 changes: 3 additions & 3 deletions src/belief/isStillBelieved.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Belief } from "../belief/index.js"
import { type Reason, type Reasons } from "../reason/index.js"
import { scheduleAllEverScheduledPropagators } from "../scheduler/index.js"
import { Belief } from "../belief/index.ts"
import { type Reason, type Reasons } from "../reason/index.ts"
import { scheduleAllEverScheduledPropagators } from "../scheduler/index.ts"

export function isStillBelieved<A>(belief: Belief<A>): boolean {
return Array.from(belief.reasons).every(isReasonBelieved)
Expand Down
6 changes: 3 additions & 3 deletions src/belief/isStrongerBelief.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Belief } from "../belief/Belief.js"
import { implies } from "../merge/merge.js"
import { setIsSubsetOf } from "../utils/set/Set.js"
import type { Belief } from "../belief/Belief.ts"
import { implies } from "../merge/merge.ts"
import { setIsSubsetOf } from "../utils/set/Set.ts"

// The predicate `isStrongerBelief` returns true only if the
// information contained in the second argument is deducible from that
Expand Down
4 changes: 2 additions & 2 deletions src/cell/Cell.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { nothing, type Nothing } from "../nothing/index.js"
import type { Propagator } from "../propagator/index.js"
import { nothing, type Nothing } from "../nothing/index.ts"
import type { Propagator } from "../propagator/index.ts"

export type Cell<T> = {
"@type": "Cell"
Expand Down
6 changes: 3 additions & 3 deletions src/cell/addPropagator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Propagator } from "../propagator/index.js"
import { schedule } from "../scheduler/index.js"
import { type Cell } from "./Cell.js"
import type { Propagator } from "../propagator/index.ts"
import { schedule } from "../scheduler/index.ts"
import { type Cell } from "./Cell.ts"

export function addPropagator<T>(cell: Cell<T>, propagator: Propagator): void {
if (cell.propagators.includes(propagator)) {
Expand Down
6 changes: 3 additions & 3 deletions src/cell/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./addPropagator.js"
export * from "./Cell.js"
export * from "./patch.js"
export * from "./addPropagator.ts"
export * from "./Cell.ts"
export * from "./patch.ts"
6 changes: 3 additions & 3 deletions src/cell/patch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { merge } from "../merge/index.js"
import { schedule } from "../scheduler/index.js"
import { type Cell } from "./Cell.js"
import { merge } from "../merge/index.ts"
import { schedule } from "../scheduler/index.ts"
import { type Cell } from "./Cell.ts"

export function patch<T>(cell: Cell<T>, increment?: any): void {
const newContent = merge(cell.content, increment)
Expand Down
4 changes: 2 additions & 2 deletions src/contradiction/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./Contradiction.js"
export * from "./isContradictory.js"
export * from "./Contradiction.ts"
export * from "./isContradictory.ts"
8 changes: 4 additions & 4 deletions src/contradiction/isContradictory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isBelief } from "../belief/index.js"
import { defineGeneric } from "../generic/defineGeneric.js"
import { defineHandler } from "../generic/index.js"
import { isContradiction } from "./Contradiction.js"
import { isBelief } from "../belief/index.ts"
import { defineGeneric } from "../generic/defineGeneric.ts"
import { defineHandler } from "../generic/index.ts"
import { isContradiction } from "./Contradiction.ts"

export const isContradictory = defineGeneric({
default: isContradiction,
Expand Down
16 changes: 8 additions & 8 deletions src/examples/barometer-belief-system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
BeliefSystem,
beliefSystemEqual,
beliefSystemQuery,
} from "../belief-system/index.js"
import { Belief, beliefEqual, bringIn, kickOut } from "../belief/index.js"
import { Cell, patch } from "../cell/index.js"
import { theContradiction } from "../contradiction/index.js"
import { Interval, intervalAlmostEqual, isInterval } from "../interval/index.js"
import { isNothing } from "../nothing/index.js"
import { run } from "../scheduler/index.js"
import { fallDuration, similarTriangles } from "./barometer.js"
} from "../belief-system/index.ts"
import { Belief, beliefEqual, bringIn, kickOut } from "../belief/index.ts"
import { Cell, patch } from "../cell/index.ts"
import { theContradiction } from "../contradiction/index.ts"
import { Interval, intervalAlmostEqual, isInterval } from "../interval/index.ts"
import { isNothing } from "../nothing/index.ts"
import { run } from "../scheduler/index.ts"
import { fallDuration, similarTriangles } from "./barometer.ts"

test("examples / barometer-belief-system", async () => {
// If we put belief systems in our cells, we can revisit the
Expand Down
10 changes: 5 additions & 5 deletions src/examples/barometer-belief.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from "node:assert"
import { test } from "node:test"
import { Belief, beliefEqual, isBelief } from "../belief/index.js"
import { Cell, patch } from "../cell/index.js"
import { Interval, intervalAlmostEqual } from "../interval/index.js"
import { run } from "../scheduler/index.js"
import { fallDuration, similarTriangles } from "./barometer.js"
import { Belief, beliefEqual, isBelief } from "../belief/index.ts"
import { Cell, patch } from "../cell/index.ts"
import { Interval, intervalAlmostEqual } from "../interval/index.ts"
import { run } from "../scheduler/index.ts"
import { fallDuration, similarTriangles } from "./barometer.ts"

test("examples / barometer-belief", async () => {
const [barometerShadow, barometerHeight, buildingShadow, buildingHeight] =
Expand Down
8 changes: 4 additions & 4 deletions src/examples/barometer.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from "node:assert"
import { test } from "node:test"
import { Cell, patch } from "../cell/index.js"
import { Interval, intervalAlmostEqual } from "../interval/index.js"
import { run } from "../scheduler/index.js"
import { fallDuration, similarTriangles } from "./barometer.js"
import { Cell, patch } from "../cell/index.ts"
import { Interval, intervalAlmostEqual } from "../interval/index.ts"
import { run } from "../scheduler/index.ts"
import { fallDuration, similarTriangles } from "./barometer.ts"

test("examples / barometer / fallDuration", async () => {
const [fallTime, buildingHeight] = fallDuration()
Expand Down
8 changes: 4 additions & 4 deletions src/examples/barometer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Cell } from "../cell/index.js"
import { Interval } from "../interval/index.js"
import { definePropagator } from "../propagator/index.js"
import { constantCell, product, quadratic } from "../propagators/index.js"
import { Cell } from "../cell/index.ts"
import { Interval } from "../interval/index.ts"
import { definePropagator } from "../propagator/index.ts"
import { constantCell, product, quadratic } from "../propagators/index.ts"

// h = (1 / 2) * g * t * t

Expand Down
6 changes: 3 additions & 3 deletions src/examples/celsius.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import assert from "node:assert"
import { test } from "node:test"
import { patch } from "../cell/index.js"
import { run } from "../scheduler/index.js"
import { patch } from "../cell/index.ts"
import { run } from "../scheduler/index.ts"
import {
celsiusKelvin,
fahrenheitCelsius,
fahrenheitToCelsius,
} from "./celsius.js"
} from "./celsius.ts"

test("examples / celsius / fahrenheitToCelsius", async () => {
const [f, c] = fahrenheitToCelsius()
Expand Down
Loading

0 comments on commit cf5b9d9

Please sign in to comment.