implement conversion from terms to type