Skip to content

Commit

Permalink
v0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
cd1m0 committed Apr 4, 2024
1 parent 359e03d commit 4cb40e3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "souffle.ts",
"version": "0.1.4",
"version": "0.1.5",
"description": "Typed bindings and helpers for using the Souffle Datalog Engine",
"keywords": [],
"files": [
Expand Down
24 changes: 24 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ export class ADTT extends DatalogType {
}
}

/**
* Returns true iff t is a primitive types. Primitive types are:
* - number
* - unsigned
* - float
* - symbol
* - alias/sub-types of primitive types
*/
export function isPrimitiveType(t: DatalogType): boolean {
if (t instanceof PrimitiveT) {
return true;
}

if (t instanceof AliasT) {
return isPrimitiveType(t.originalT);
}

if (t instanceof SubT) {
return isPrimitiveType(t.parentT);
}

return false;
}

export class TypeEnv {
private env: Map<string, DatalogType> = new Map();

Expand Down

0 comments on commit 4cb40e3

Please sign in to comment.