[GHC] #12073: Missing instance of MonadFix for Q

GHC ghc-devs at haskell.org
Mon May 16 15:32:22 UTC 2016


#12073: Missing instance of MonadFix for Q
-------------------------------------+-------------------------------------
           Reporter:  jophish        |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Template       |           Version:
  Haskell                            |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 `Q` is capable of being an instance of `MonadFix`. The definition of
 `mfix` is the same as `fixIO` except that the `MVar` handling is wrapped
 in `runIO`.

 {{{#!hs
 instance MonadFix Q where
   mfix k = do
     m <- runIO newEmptyMVar
     ans <- runIO (unsafeInterleaveIO (takeMVar m))
     result <- k ans
     runIO (putMVar m result)
     pure result
 }}}

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


More information about the ghc-tickets mailing list