summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/indexed-types/should_compile/Ind2_help.hs
blob: b088302fec4ee80d23291fcb8258d1ea8b1c2e7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{-# LANGUAGE TypeFamilies #-}

module Ind2_help where

class C a where
  data T a :: *
  unT :: T a -> a
  mkT :: a -> T a

instance (C a, C b) => C (a,b) where
  data T (a,b) = TProd (T a) (T b)
  unT (TProd x y) = (unT x, unT y)
  mkT (x,y)       = TProd (mkT x) (mkT y)