Infer the intermediate_type in inclusive_scan.