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

GHC ghc-devs at haskell.org
Mon Nov 23 10:35:57 UTC 2015


#11125: Typechecker can't infer StM m Bool ~ Bool from StM m a ~ a
-------------------------------------+-------------------------------------
        Reporter:  nikomi            |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.10.2
  checker)                           |
      Resolution:  invalid           |             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:                    |
-------------------------------------+-------------------------------------
Changes (by nomeata):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 More relevant types:
 {{{
 liftBaseWith :: (RunInBase m b -> b a) -> m a
 type RunInBase m b = forall a. m a -> b (StM m a)
 }}}
 so the `runInST` function in your  code changes the return type from `a`
 to `StM m a`. Note the docs:

 > The difference with liftBase is that before lifting the base computation
 liftBaseWith captures the state of m. It then provides the base
 computation with a RunInBase function that allows running m computations
 in the base monad on the captured state.

 I’m confident that GHC is doing the right thing here, and it’s just
 `monad-control`’s API that is confusing here.

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


More information about the ghc-tickets mailing list