Skip to content

Commit 5718fb0

Browse files
committed
Add natural_number.is to prelude
1 parent aa00c75 commit 5718fb0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/language/semantics/prelude.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,24 @@ export const prelude: ObjectNode = makeObjectNode({
467467
),
468468
),
469469
),
470+
is: preludeFunction(
471+
['natural_number', 'is'],
472+
{
473+
parameter: types.something,
474+
return: types.boolean,
475+
},
476+
argument =>
477+
either.makeRight(
478+
typeof argument === 'string' &&
479+
types.naturalNumber.isAssignableFrom({
480+
name: '',
481+
kind: 'union',
482+
members: new Set([argument]),
483+
})
484+
? 'true'
485+
: 'false',
486+
),
487+
),
470488
}),
471489

472490
object: makeObjectNode({

0 commit comments

Comments
 (0)