From 5c115236fe795aa01f0c10106f1b1c959486a739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 23 Sep 2015 13:19:58 -0500 Subject: reify associated types when reifying typeclasses As reported in Trac #10891, Template Haskell's `reify` was not generating Decls for associated types. This patch fixes that. Note that even though `reifyTyCon` function used in this patch returns some type instances, I'm ignoring that. Here's an example of how associated types are encoded with this patch: (Simplified representation) class C a where type F a :: * --> OpenTypeFamilyD "F" ["a"] With default type instances: class C a where type F a :: * type F a = a --> OpenTypeFamilyD "F" ["a"] TySynInstD "F" (TySynEqn [VarT "a"] "a") Reviewed By: goldfire Differential Revision: https://phabricator.haskell.org/D1254 GHC Trac Issues: #10891 --- testsuite/tests/th/T10891.stderr | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 testsuite/tests/th/T10891.stderr (limited to 'testsuite/tests/th/T10891.stderr') diff --git a/testsuite/tests/th/T10891.stderr b/testsuite/tests/th/T10891.stderr new file mode 100644 index 0000000000..874f4f0890 --- /dev/null +++ b/testsuite/tests/th/T10891.stderr @@ -0,0 +1,12 @@ +class T10891.C (a_0 :: *) + where T10891.f :: forall (a_0 :: *) . T10891.C a_0 => + a_0 -> GHC.Types.Int +class T10891.C' (a_0 :: *) + where type T10891.F (a_0 :: *) :: * + type T10891.F a_0 = a_0 + T10891.f' :: forall (a_0 :: *) . T10891.C' a_0 => + a_0 -> GHC.Types.Int +instance T10891.C' GHC.Types.Int +class T10891.C'' (a_0 :: *) + where data T10891.Fd (a_0 :: *) :: * +instance T10891.C'' GHC.Types.Int -- cgit v1.2.1