-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiff.ts
More file actions
26 lines (24 loc) · 760 Bytes
/
Copy pathdiff.ts
File metadata and controls
26 lines (24 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { Schema } from 'effect'
import { type DiffToken, diffTokenSchema } from 'src/schemas/token/diff'
import { type Exp, type ExpEncoded, expSchema } from './union'
import { IdentExp, type IdentExpEncoded } from './ident'
export type DiffExpEncoded = {
readonly _tag: 'DiffExp'
readonly token: DiffToken
readonly exp: ExpEncoded
readonly params: readonly IdentExpEncoded[]
}
export class DiffExp extends Schema.TaggedClass<DiffExp>()('DiffExp', {
token: diffTokenSchema,
exp: Schema.suspend((): Schema.Schema<Exp, ExpEncoded> => expSchema),
params: Schema.Array(
Schema.suspend((): Schema.Schema<IdentExp, IdentExpEncoded> => IdentExp),
),
}) {
tokenLiteral() {
return this.token.literal
}
string() {
return `${this.tokenLiteral()}`
}
}