--!strict -- base/effect-plan.md: Effect(fn, ...deps) — deps는 State/Source(→Observer)와 -- Ref(→:Callback)가 섞인다. fn엔 deps가 안 넘어간다(H-14). export type StateData = { Get: (self: StateData) -> T } export type State = StateData & { Compute: (self: StateData, fn: (self: StateData) -> U) -> State, } export type Ref = { Value: T?, Set: (self: Ref, v: T) -> (), Callback: (self: Ref, fn: (T) -> ()) -> () } export type EffectHandle = { Rerun: (self: EffectHandle) -> (), Subscribe: (self: EffectHandle) -> () } type Dep = State | Ref local function Effect(fn: (self: EffectHandle) -> (() -> ())?, ...: Dep): EffectHandle return nil :: any end local n: State = nil :: any local b: State = nil :: any local r: Ref = nil :: any -- (A) State 하나 local e1 = Effect(function(self) return nil end, n) -- (B) 이형 State 둘 local e2 = Effect(function(self) return nil end, n, b) -- (C) State + Ref 섞기 — effect-plan.md가 확정한 대표 용례 local e3 = Effect(function(self) return nil end, n, r) -- (D) 음성 대조군 — 아무 테이블이나 넣으면 걸려야 정상 local e4 = Effect(function(self) return nil end, {foo = 1})