[GHC] #11661: Missing MonadFail instance for Q monad from TemplateHaskell
GHC
ghc-devs at haskell.org
Tue Mar 1 14:10:21 UTC 2016
#11661: Missing MonadFail instance for Q monad from TemplateHaskell
-------------------------------------+-------------------------------------
Reporter: PeterTrsko | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Template Haskell | Version: 8.0.1-rc2
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 hvr):
Yes... I have been wondering for some time already (which is the reason
there is no `MonadFail` instance yet) how to properly define one given :
{{{#!hs
class Monad m => Quasi m where
-- ...
newtype Q a = Q { unQ :: forall m. Quasi m => m a }
instance Monad Q where
-- ...
fail s = report True s >> Q (fail "Q monad failure")
}}}
Now obviously we can't
{{{#!hs
instance Fail.MonadFail Q where
-- ...
fail = Control.Monad.fail
}}}
as that would call `Q`'s inner `Monad(fail)`, whereas we'd need it to call
`Q`'s inner `MonadFail(fail)` which would require changing `Quasi`'s
superclass, and I'm not sure that's appropriate.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11661#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list