added RankNTypes for compatibility with GHC 7.6