blob: e7cc0458cee0a598ef099a0a78559345c100eef7 (
plain) (
blame)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
{-# LANGUAGE TypeFamilies, UndecidableInstances, PolyKinds, TypeOperators, DataKinds, MultiParamTypeClasses #-}
-- | Doc for: module TypeFamilies
module TypeFamilies where
-- | Doc for: data X
data X
= X -- ^ Doc for: X
| XX -- ^ Doc for: XX
| XXX -- ^ Doc for: XXX
-- | Doc for: data Y
data Y
-- | Doc for: class Test a
class Test a
-- | Doc for: instance Test X
instance Test X
-- | Doc for: instance Test Y
instance Test Y
-- | Doc for: type family Foo a
type family Foo a :: k
-- | Doc for: type instance Foo X = Y
type instance Foo X = Y
-- | Doc for: type instance Foo Y = X
type instance Foo Y = X
-- | Doc for: data family Bat a
data family Bat a :: *
-- | Doc for: data instance Bat X
data instance Bat X
= BatX X -- ^ Doc for: BatX X
| BatXX { aaa :: X , bbb :: Y } -- ^ Doc for: BatXX { ... }
-- | Doc for: data instance Bat Y
data instance Bat Y
= BatY Y -- ^ Doc for: BatY Y
| X :+ X -- X :+ X
-- | Doc for: class Assoc a
class Assoc a where
-- | Doc for: data AssocD a
data AssocD a :: *
-- | Doc for: type AssocT a
type AssocT a :: *
-- | Doc for: instance Assoc X
instance Assoc X where
-- | Doc for: data AssocD X = AssocX
data AssocD X = AssocX -- ^ Doc for: AssocX
-- | Doc for: type AssocT X = Foo X
type AssocT X = Foo X
-- | Doc for: instance Assoc Y
instance Assoc Y where
-- | Doc for: data AssocD Y = AssocY
data AssocD Y = AssocY -- ^ Doc for: AssocY
-- | Doc for: type AssocT Y = Bat Y
type AssocT Y = Bat Y
-- | Doc for: type family Bar b
type family Bar b where
Bar X = X
Bar y = Y
type family (<>) (a :: k) (b :: k) :: k
type instance X <> a = X
type instance Y <> a = a
type instance XXX <> XX = 'X
class (><) (a :: k) (b :: k)
instance XX >< XXX
|