pattern matching library