resolve for pattern matching- basic example gets through typecheck. but does not yet compile