Skip to content

Bad warning from quoted instance

This quoted instance gives a bogus warning; from #4127 (closed).

$ ghc -XTemplateHaskell
GHCi, version 6.13.20100704: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :m + Language.Haskell.TH
Prelude Language.Haskell.TH> runQ $ [d| f = undefined; class Foo x where { f :: x -> x }; instance Foo Int where { f = id } |]
Loading package array-0.3.0.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.

<interactive>:1:71:
    Warning: No explicit method nor default method for `f'
    In the instance declaration for `Foo Int'
    In the Template Haskell quotation
      [d| f = undefined
          
          class Foo x where { f :: x -> x; }
          
          instance Foo Int where
              { f = id } |]
    In the second argument of `($)', namely
        `[d| f = undefined
             
             class Foo x where { f :: x -> x; }
             
             instance Foo Int where
                 { f = id } |]'
[ValD (VarP f) (NormalB (VarE GHC.Err.undefined)) [],ClassD [] Foo [PlainTV x_0] [] [SigD f (AppT (AppT ArrowT (VarT x_0)) (VarT x_0))],InstanceD [] (AppT (ConT Foo) (ConT GHC.Types.Int)) [ValD (VarP f) (NormalB (VarE GHC.Base.id)) []]]
Prelude Language.Haskell.TH> 
Trac metadata
Trac field Value
Version 6.13
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
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