a generic erlang term type checker