towards constrained pattern matching