summaryrefslogtreecommitdiff
path: root/testsuite/tests/deSugar/should_compile/ds055.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/deSugar/should_compile/ds055.hs')
-rw-r--r--testsuite/tests/deSugar/should_compile/ds055.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/deSugar/should_compile/ds055.hs b/testsuite/tests/deSugar/should_compile/ds055.hs
new file mode 100644
index 0000000000..280fe968d2
--- /dev/null
+++ b/testsuite/tests/deSugar/should_compile/ds055.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE ExistentialQuantification, DeriveDataTypeable #-}
+
+-- This module requires quite trick desugaring,
+-- because of the context in the existentials
+-- It broke a pre 6.4 GHC
+
+module Foo where
+
+ import Data.Data
+ import Data.HashTable
+
+ data Item = forall a. (Data a) => Leaf Bool a
+ | forall a. (Data a) => Branch Bool a Int Int
+ deriving (Typeable)
+
+
+ instance Data Item where
+ gfoldl k z (Leaf b v) = z (Leaf b) `k` v
+ gfoldl k z (Branch b v a1 a2) = z (\x -> Branch b x a1 a2) `k` v
+ gunfold _ _ _ = error "urk"
+ toConstr (Leaf _ _) = leafConstr
+ toConstr (Branch _ _ _ _) = branchConstr
+ dataTypeOf _ = itemDataType
+
+ itemDataType = mkDataType "Subliminal.Item" [leafConstr, branchConstr]
+ leafConstr = mkConstr itemDataType "Leaf" [] Prefix
+ branchConstr = mkConstr itemDataType "Branch" [] Prefix
+
+
+