Make `define-type` work at top-level

Closes PR 12913
Fixed bad let syntax
Hacky fix to only flatten repeats
Added Redex enum tests