fix types to avoid unnecessary casts
simplify implementation of phrase combinator
provide mapr helper function for consistency with Choice
clean up and unify frontend code and error reporting code for parsing