[scala] implement class: Env, T, TypeError; some type rules