typed intensionalize and extensinalize functions