[GHC] #11125: Typechecker can't infer StM m Bool ~ Bool from StM m a ~ a

GHC ghc-devs at haskell.org
Mon Nov 23 09:57:39 UTC 2015


#11125: Typechecker can't infer StM m Bool ~ Bool from StM m a ~ a
-------------------------------------+-------------------------------------
        Reporter:  nikomi            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.10.2
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nomeata):

 Are you sure that it indeed solves `StM m a ~ a`, because how could it?

 From reading the type signatures, I get the impression that
 `STM.alwaysSucceeds`’s is rather instantiated with `StM m a`.

 Note that
 {{{
 alwaysSucceeds :: forall m a. (Monad m, MonadSTM m, MonadBaseControl STM
 m) => m a -> m ()
 alwaysSucceeds inv = liftBaseWith $ \runInSTM -> STM.alwaysSucceeds
 (runInSTM inv :: STM (StM m a))
 }}}
 compiles, but
 {{{
 alwaysSucceeds :: forall m a. (Monad m, MonadSTM m, MonadBaseControl STM
 m) => m a -> m ()
 alwaysSucceeds inv = liftBaseWith $ \runInSTM -> STM.alwaysSucceeds
 (runInSTM inv :: STM a)
 }}}
 does not (`Couldn't match type ‘a’ with ‘StM m a’`).

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11125#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list