Fixed error where type checking Monad or subclass of Monad causes StackOverflowError in Intellij.