summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_compile/T8165.hs
blob: dd56002648ec7a1ac6b13684baad8c75d5e3be79 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module T8165 where

-----------------------------------------------------------

class C a where
    type T a

instance C Int where
    type T Int = Bool

newtype NT = NT Int
    deriving C

-----------------------------------------------------------

class D a where
  type U a

instance D Int where
  type U Int = Int

newtype E = MkE Int
  deriving D

-----------------------------------------------------------

class C2 a b where
  type F b c a           :: *
  type G b (d :: * -> *) :: * -> *

instance C2 a y => C2 a (Either x y) where
  type F (Either x y) c a = F y c a
  type G (Either x y) d   = G y d

newtype N a = MkN (Either Int a)
  deriving (C2 x)

-----------------------------------------------------------

class HasRing a where
    type Ring a

newtype L2Norm a = L2Norm a
    deriving HasRing

newtype L1Norm a = L1Norm a
    deriving HasRing