Commit 809f807a authored by dreixel's avatar dreixel

Add a test for the output of -ddump-deriv.

In particular, we are testing the output of deriving
Generic instances.
parent 8ae32011
{-# LANGUAGE DeriveGeneric #-}
{-# OPTIONS_GHC -ddump-deriv #-}
module GenDerivOutput where
import GHC.Generics (Generic)
data List a = Nil | Cons { element :: a, rest :: List a } deriving Generic
==================== Derived instances ====================
Derived instances:
instance GHC.Generics.Generic (GenDerivOutput.List a) where
GHC.Generics.from GenDerivOutput.Nil
= GHC.Generics.M1
(GHC.Generics.L1 (GHC.Generics.M1 GHC.Generics.U1))
GHC.Generics.from (GenDerivOutput.Cons g1 g2)
= GHC.Generics.M1
(GHC.Generics.R1
(GHC.Generics.M1
((GHC.Generics.:*:)
(GHC.Generics.M1 (GHC.Generics.K1 g1))
(GHC.Generics.M1 (GHC.Generics.K1 g2)))))
GHC.Generics.to
(GHC.Generics.M1 (GHC.Generics.L1 (GHC.Generics.M1 GHC.Generics.U1)))
= GenDerivOutput.Nil
GHC.Generics.to
(GHC.Generics.M1 (GHC.Generics.R1 (GHC.Generics.M1 (GHC.Generics.:*: (GHC.Generics.M1 (GHC.Generics.K1 g1))
(GHC.Generics.M1 (GHC.Generics.K1 g2))))))
= GenDerivOutput.Cons g1 g2
instance GHC.Generics.Datatype GenDerivOutput.D1List where
GHC.Generics.datatypeName _ = "List"
GHC.Generics.moduleName _ = "GenDerivOutput"
instance GHC.Generics.Constructor GenDerivOutput.C1_0List where
GHC.Generics.conName _ = "Nil"
instance GHC.Generics.Constructor GenDerivOutput.C1_1List where
GHC.Generics.conName _ = "Cons"
GHC.Generics.conIsRecord _ = GHC.Types.True
instance GHC.Generics.Selector GenDerivOutput.S1_1_0List where
GHC.Generics.selName _ = "element"
instance GHC.Generics.Selector GenDerivOutput.S1_1_1List where
GHC.Generics.selName _ = "rest"
Generic representation:
Generated datatypes for meta-information:
GenDerivOutput.D1List
GenDerivOutput.C1_0List
GenDerivOutput.C1_1List
GenDerivOutput.S1_1_0List
GenDerivOutput.S1_1_1List
Representation types: GenDerivOutput.Rep_List
Meta-information instances:
instance GHC.Generics.Datatype GenDerivOutput.D1List where
GHC.Generics.datatypeName _ = "List"
GHC.Generics.moduleName _ = "GenDerivOutput"
instance GHC.Generics.Constructor GenDerivOutput.C1_0List where
GHC.Generics.conName _ = "Nil"
instance GHC.Generics.Constructor GenDerivOutput.C1_1List where
GHC.Generics.conName _ = "Cons"
GHC.Generics.conIsRecord _ = GHC.Types.True
instance GHC.Generics.Selector GenDerivOutput.S1_1_0List where
GHC.Generics.selName _ = "element"
instance GHC.Generics.Selector GenDerivOutput.S1_1_1List where
GHC.Generics.selName _ = "rest"
setTestOpts(only_compiler_types(['ghc']))
test('GenCanDoRep0', normal, compile, [''])
test('GenCanDoRep0', normal, compile, [''])
test('GenDerivOutput', normal, compile, ['-dsuppress-uniques'])
test('GenShouldFail0', normal, compile_fail, [''])
test('GenCannotDoRep0', normal, compile_fail, [''])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment