#4173: Bad warning from quoted instance
---------------------------------+------------------------------------------
    Reporter:  igloo             |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:  6.14.1      
   Component:  Template Haskell  |      Version:  6.13        
    Keywords:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Testcase:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------
 This quoted instance gives a bogus warning; from #4127.

 {{{
 $ 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>
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4173>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to