summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/InstContextNorm.hs
blob: 329756aa9c470f15f682625e3b469af72478b382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
{-# LANGUAGE EmptyDataDecls, FlexibleInstances #-}

module InstContextNorm
where

data EX _x _y (p :: * -> *)
data ANY

class Base p

class Base (Def p) => Prop p where
 type Def p

instance Base ()
instance Prop () where
 type Def () = ()

instance (Base (Def (p ANY))) => Base (EX _x _y p)
instance (Prop (p ANY)) => Prop (EX _x _y p) where
 type Def (EX _x _y p) = EX _x _y p


data FOO x

instance Prop (FOO x) where
 type Def (FOO x) = ()

data BAR

instance Prop BAR where
 type Def BAR = EX () () FOO
  
  -- Needs Base (Def BAR)
  -- And (Def Bar = Ex () () FOO)
  -- so we need Base (Def (Foo ANY))