
#14836: GHC fails to infer implied superclass constraint -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by crockeea): Oddly, if I involve `MultiParamTypeClasses`, I can make this work in some cases, but GHC refuses others: {{{ {-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances #-} module Bug where import Control.Monad.Reader import Control.Monad.IO.Class class (Monad m) => Message msg m where class (Monad m) => ImpliesMonad m where data Foo --instance (ImpliesMonad m) => Message Foo m where -- compiles --instance (MonadIO m) => Message Foo m where -- compiles --instance (MonadReader Bool m) => Message Foo m where -- does NOT compile }}} I've defined three similar instances above. The first two instances are accepted by GHC (as, in my opinion, they should be), but the third instance is reject (`could not deduce (Monad m)`). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14836#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler