Skip to content

Output of -ddump-splices is parenthesized incorrectly

Sometimes, Template Haskell splices lack necessary parentheses. Minimal example:

$ ghci -XTemplateHaskell -ddump-splices
GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
λ> :t $([| case Just 'a' of Just a -> Just ((\x -> x) a) |])
<interactive>:1:3-53: Splicing expression
    [| case Just 'a' of {
         Just a_avZ -> Just ((\ x_aw0 -> x_aw0) a_avZ) } |]
  ======>
    case Just 'a' of {
      Just a_a3wI -> Just (\ x_a3wJ -> x_a3wJ a_a3wI) }
$([| case Just 'a' of Just a -> Just ((\x -> x) a) |])
  :: Maybe Char

The suspect part is case Just 'a' of { Just a_a3wI -> Just (\ x_a3wJ -> x_a3wJ a_a3wI) } , which should be case Just 'a' of { Just a_a3wI -> Just ((\ x_a3wJ -> x_a3wJ) a_a3wI) } .

Trac metadata
Trac field Value
Version 7.10.1
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