It seems like this is not possible. To quote @user17732522, "there is nothing in the language to test the validity of an instantiation."