MonadFix instance for Q

Joe Hermaszewski joe at haskell.monoid.al
Wed Aug 3 09:01:14 UTC 2016


Q is capable of being an instance of MonadFix, I've opened a ticket
here, I'd appreciate it if someone could take a look:

https://ghc.haskell.org/trac/ghc/ticket/12073

```
instance MonadFix Q where
  mfix k = do
    m <- runIO newEmptyMVar
    ans <- runIO (unsafeInterleaveIO (takeMVar m))
    result <- k ans
    runIO (putMVar m result)
    pure result
```


More information about the Libraries mailing list