refactor: require match to merge any function (#23)
All checks were successful
/ test (push) Successful in 16s

Resolves #12.

Reviewed-on: #23
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
Glen Whitney 2025-04-24 00:16:04 +00:00 committed by Glen Whitney
parent 236f46c0c0
commit 0ff00ff8cb
4 changed files with 14 additions and 8 deletions

View file

@ -1,7 +1,7 @@
import {ReturnsAs} from './helpers.js'
import {match} from '#core/helpers.js'
import {Returns} from '#core/Type.js'
import {Any, matched} from '#core/TypePatterns.js'
import {Any, Passthru, matched} from '#core/TypePatterns.js'
import {boolnum} from '#number/helpers.js'
export const equal = match([Any, Any], (math, [T, U]) => {
@ -76,10 +76,10 @@ export const sign = match(Any, (math, T) => {
return ReturnsAs(comp, t => comp(t, zero))
})
export const unequal = (math, types) => {
export const unequal = match(Passthru, (math, types) => {
const eq = math.equal.resolve(types)
return ReturnsAs(eq, (...args) => !eq(...args))
}
})
export const larger = match([Any, Any], (math, [T, U]) => {
const eq = math.equal.resolve([T, U])