-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfix.ts
More file actions
28 lines (23 loc) · 839 Bytes
/
Copy pathinfix.ts
File metadata and controls
28 lines (23 loc) · 839 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
27
28
import { Schema } from 'effect'
import { infixOperatorSchema } from '../infix-operator'
import { Obj, ObjEncoded, objSchema } from './union'
const fields = {
operator: infixOperatorSchema
}
export interface InfixObj extends Schema.Struct.Type<typeof fields> {
readonly _tag: 'InfixObj'
readonly left: Obj
readonly right: Obj
}
export interface InfixObjEncoded extends Schema.Struct.Type<typeof fields> {
readonly _tag: 'InfixObj'
readonly left: ObjEncoded
readonly right: ObjEncoded
}
export const infixObjSchema = Schema.TaggedStruct('InfixObj', {
...fields,
left: Schema.suspend((): Schema.Schema<Obj, ObjEncoded> => objSchema),
right: Schema.suspend((): Schema.Schema<Obj, ObjEncoded> => objSchema),
operator: infixOperatorSchema
})
export const infixObjEq = Schema.equivalence(infixObjSchema)