added an implementation of isRight to retain compatibility with base < 4.7