[GHC] #5508: Template Haskell -ddump-splices lambda pretty printing bug

GHC cvs-ghc at haskell.org
Sun Sep 25 03:15:45 CEST 2011


#5508: Template Haskell -ddump-splices lambda pretty printing bug
---------------------------------+------------------------------------------
    Reporter:  mgsloan1          |       Owner:                                   
        Type:  bug               |      Status:  new                              
    Priority:  normal            |   Component:  Template Haskell                 
     Version:  7.2.1             |    Keywords:                                   
    Testcase:                    |   Blockedby:                                   
          Os:  Unknown/Multiple  |    Blocking:                                   
Architecture:  Unknown/Multiple  |     Failure:  Incorrect warning at compile-time
---------------------------------+------------------------------------------
 Parentheses are not placed around lambda expressions when dumping template
 haskell splices.

 One strange thing about this bug is that it only occurs when using
 "-ddump-splices", and not when using Language.Haskell.TH.Ppr.pprint

 {{{
 x = mkName "x"

 thb = QuasiQuoter (const [| $(return . LamE [VarP x] $ VarE x) . id |])
                   undefined undefined undefined
 }}}

 {{{
 ghci THPrettyBug.hs -ddump-splices -XQuasiQuotes
 GHCi, version 7.2.1: 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.
 [1 of 1] Compiling Main             ( THPrettyBug.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> [thb| |]
 Loading package pretty-1.1.0.0 ... linking ... done.
 Loading package array-0.3.0.3 ... linking ... done.
 Loading package containers-0.4.1.0 ... linking ... done.
 Loading package template-haskell ... linking ... done.
 <interactive>:0:1-8: Splicing expression
     " " ======> (\ x -> x . id)

 <interactive>:0:1:
     No instance for (Show (c0 -> c0))
       arising from a use of `print'
     Possible fix: add an instance declaration for (Show (c0 -> c0))
     In a stmt of an interactive GHCi command: print it
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5508>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list