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

#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

#12073: Missing instance of MonadFix for Q -------------------------------------+------------------------------------- Reporter: jophish | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 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 goldfire): I have no knowledge of whether this implementation is correct, although it certainly looks plausible. As the TH czar, I'm happy to accept this instance from a design point of view. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12073#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12073: Missing instance of MonadFix for Q -------------------------------------+------------------------------------- Reporter: jophish | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 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 ekmett): This looks reasonable to me. It acts like IO. I suppose any manually constructed infinite terms it might allow are entirely on the user's head anyways. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12073#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12073: Missing instance of MonadFix for Q -------------------------------------+------------------------------------- Reporter: jophish | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 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: | -------------------------------------+------------------------------------- Changes (by erikd): * cc: erikd (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12073#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12073: Missing instance of MonadFix for Q -------------------------------------+------------------------------------- Reporter: jophish | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 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 dfeuer): One change: `unsafeInterleaveIO` is now safer than necessary, and this should instead use `unsafeDupableInterleaveIO`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12073#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC