Better internal structure for `match`

In order to make the '^' anchor work properly, we needed a zipper-ish
structure. Since I don't know about zippers yet, just went with a simple
three-partition.

It's a lot more idiomatic since `match` uses Maybe Input; a lot of the
operations boiled down to binds or mplus.