Fix bug in type of `apply-pattern-substitute`.

Found by @takikawa.