summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt/T3169.hs
blob: bc4326c8a498e70a06e031185358a081ac2eecea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE  TypeFamilies, ScopedTypeVariables #-}
module T3169 where

import Prelude hiding ( lookup )

class Key k where
  type Map k :: * -> *
  lookup :: k -> Map k elt -> Maybe elt

instance (Key a, Key b) => Key (a,b) where
  type Map (a,b) = MP a b
  lookup (a,b) (m :: Map (a,b) elt)
     = case lookup a m :: Maybe (Map b elt) of
          Just (m2 :: Map b elt) -> lookup b m2 :: Maybe elt

data MP a b elt = MP (Map a (Map b elt))