diff options
Diffstat (limited to 'testsuite/tests/simplCore/should_compile/T2520.hs')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T2520.hs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T2520.hs b/testsuite/tests/simplCore/should_compile/T2520.hs new file mode 100644 index 0000000000..f0115474ea --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T2520.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE GADTs #-} + +-- Trac #2520: a bug in the specialiser when we tried to +-- quantify over an Internal Name + +module Types where + +data Prod a b = Prod a b + +data Nil = Nil + +class ProdSel f where + nil :: f Nil + prod :: f x -> f y -> f (Prod x y) + +instance ProdSel SqlFields where + nil = SFNil + prod = SFProd + +{-# SPECIALIZE reproject :: SqlFields a -> SqlFields a #-} + +reproject :: ProdSel f => SqlFields a -> f a +reproject SFNil = nil +reproject (SFProd a b) = prod (reproject a) (reproject b) + +data SqlFields a where + SFNil :: SqlFields Nil + SFProd :: SqlFields a -> SqlFields b -> SqlFields (Prod a b) |