Skip to content

-ddump-splices prints out declarations in the wrong order

{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -ddump-splices #-}
module Bug where

$([d| data A = A
      data B = B
    |])

$([d| deriving instance Eq A
      deriving instance Eq B
    |])
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
Bug.hs:(6,3)-(8,6): Splicing declarations
    [d| data A_a13D = A_a13E
        data B_a13B = B_a13C |]
  ======>
    data A_a3IA = A_a3IB
    data B_a3IC = B_a3ID
Bug.hs:(10,3)-(12,6): Splicing declarations
    [d| deriving instance Eq B
        deriving instance Eq A |]
  ======>
    deriving instance Eq A
    deriving instance Eq B

Notice that it printed

    [d| deriving instance Eq B
        deriving instance Eq A |]

instead of

    [d| deriving instance Eq A
        deriving instance Eq B |]

which is what I originally wrote.

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