; Fieldtest kem.4-green (Axis 4, param-in restriction, accepting path).
; User-defined `NumBox a` ADT restricts its type parameter to
; {Int, Float}. The consumer uses `(con NumBox (con Int))` — Int is in
; the allowed set, so check is clean.
;
; Per spec § "Iteration prep.3 — Kernel-tier modules + param-in":
; the param-in restriction is a generic, data-driven check; nothing
; in the checker mentions any specific extension. So a user TypeDef
; can declare it just as the raw_buf.RawBuf base extension does.

(module kem_4_paramin_box_green

  (data NumBox (vars a)
    (doc "An Int-or-Float container — param-in restriction on `a`.")
    (param-in (a Int Float))
    (ctor MkNumBox a))

  (fn unwrap
    (doc "Project the contained Int out of a NumBox<Int>.")
    (type (fn-type (params (own (con NumBox (con Int)))) (ret (own (con Int)))))
    (params b)
    (body (match b (case (pat-ctor MkNumBox x) x))))

  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (let b (term-ctor NumBox MkNumBox 17)
        (seq (app print (app unwrap b)) (do io/print_str "\n"))))))
