T5452.hs 409 Bytes
Newer Older
Simon Peyton Jones's avatar
Simon Peyton Jones committed
1 2 3 4 5 6 7 8 9 10 11
{-# LANGUAGE TemplateHaskell, KindSignatures, FlexibleInstances #-}

module T5452 where
import Language.Haskell.TH

class C (f :: * -> *)
class D (f :: * -> *)

instance C ((,) Int)

$(do { ClassI _ [inst_dec] <- reify ''C
12 13
     ; let InstanceD o cxt (AppT _ ty) _ = inst_dec
     ; return [InstanceD o cxt
Simon Peyton Jones's avatar
Simon Peyton Jones committed
14 15 16 17
                         (foldl AppT (ConT ''D) [ty]) 
                         []
              ] })