Skip to content

Template haskell instance declaration quotations with members don't work in ghci

Inside GHCi, the following quotation fails:

Prelude Language.Haskell.TH> runQ [d| instance Monad ((,) a) where return = (,) undefined; (a,x) >>= f = f x |]

<interactive>:1:38:
    `return' is not a (visible) method of class `Monad'

<interactive>:1:68:
    `>>=' is not a (visible) method of class `Monad'

The same error seems to occur for any typeclass I try. This code works fine inside a module passed to GHC.

Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information