type of higher-order function for building parsers by composition