(;module: lux (lux (control monad ["ex" exception #+ exception:]) (data text/format [product]) [meta] (meta [type] (type ["tc" check]))) (luxc ["&" base] (lang analysis))) (def: #export (with-unknown-type action) (All [a] (-> (Meta Analysis) (Meta [Type Analysis]))) (do meta;Monad [[var-id var-type] (&;with-type-env tc;var) analysis (&;with-expected-type var-type action) analysis-type (&;with-type-env (tc;clean var-id var-type))] (wrap [analysis-type analysis]))) (exception: #export Variant-Tag-Out-Of-Bounds) (def: #export (variant-out-of-bounds-error type size tag) (All [a] (-> Type Nat Nat (Meta a))) (&;throw Variant-Tag-Out-Of-Bounds (format " Tag: " (%n tag) "\n" "Variant Size: " (%n size) "\n" "Variant Type: " (%type type))))