add .validator() to bind a spec to a function

I added this, and thought this could be useful for code readability though it's not hard to do on the user's side.