30 lines
411 B
Python
30 lines
411 B
Python
from __future__ import annotations
|
|
from dataclasses import dataclass
|
|
|
|
class Int:
|
|
pass
|
|
|
|
class Bool:
|
|
pass
|
|
|
|
class Unit:
|
|
pass
|
|
|
|
Int_Instance = Int()
|
|
Bool_Instance = Bool()
|
|
Unit_Instance = Unit()
|
|
|
|
class Any(Int, Bool, Unit):
|
|
pass
|
|
|
|
Any_Instance = Any()
|
|
|
|
type Type = Int | Bool | Unit | FunType
|
|
|
|
ParamsType = Type | list[Type | list['ParamsType']]
|
|
|
|
@dataclass
|
|
class FunType:
|
|
params: ParamsType
|
|
result: Type
|