1module Main where
2
3import Prelude
4
5import Effect.Console (log)
6import Data.Generic.Rep (class Generic)
7
8import Lib (namedExportStillWorksUnit)
9
10-- This file verifies that unnamed instances will produce
11-- completely-generated instance names without problems.
12
13class NoTypeParams
14instance NoTypeParams
15
16
17class OneTypeParam a
18instance OneTypeParam Boolean
19
20
21class OneTypeParamChain a
22instance OneTypeParamChain Boolean
23else instance OneTypeParamChain String
24
25
26class MultipleTypeParams :: Type -> Type -> Type -> Type -> Type -> Constraint
27class MultipleTypeParams a b c d e
28
29instance MultipleTypeParams Boolean Int Number Char String
30
31
32class MultipleTypeParamsChain :: Type -> Type -> Type -> Type -> Type -> Constraint
33class MultipleTypeParamsChain a b c d e
34
35instance MultipleTypeParamsChain Boolean Int Number Char Boolean
36else instance MultipleTypeParamsChain Boolean Int Number Char Int
37else instance MultipleTypeParamsChain Boolean Int Number Char Number
38else instance MultipleTypeParamsChain Boolean Int Number Char Char
39else instance MultipleTypeParamsChain Boolean Int Number Char String
40
41
42class HigherKindedTypeParams :: (Type -> Type) -> (Type -> Type) -> Constraint
43class HigherKindedTypeParams f g where
44  hktp :: f Int -> g Int -> Int
45
46instance HigherKindedTypeParams Array (Either Int) where
47  hktp _ _ = 0
48
49
50class HigherKindedTypeParamsChain :: (Type -> Type) -> (Type -> Type) -> Constraint
51class HigherKindedTypeParamsChain f g where
52  hktpChain :: f Int -> g Int -> Int
53
54instance HigherKindedTypeParamsChain Array (Either Int) where
55  hktpChain _ _ = 0
56else instance HigherKindedTypeParamsChain (Either Int) Array where
57  hktpChain _ _ = 0
58
59
60data CustomKind
61foreign import data Constructor1 :: CustomKind
62foreign import data Constructor2 :: CustomKind
63foreign import data Constructor3 :: CustomKind
64
65class MultipleKindParams :: CustomKind -> Constraint
66class MultipleKindParams customKind
67
68instance MultipleKindParams Constructor1
69
70
71class MultipleKindParamsChain :: CustomKind -> Constraint
72class MultipleKindParamsChain customKind
73
74instance MultipleKindParamsChain Constructor1
75else instance MultipleKindParamsChain Constructor2
76else instance MultipleKindParamsChain Constructor3
77
78
79data Arrow a b = Foo a b
80class ReservedWord a
81instance ReservedWord (Arrow a b)
82instance ReservedWord ((->) a b)
83
84
85data GenericFoo = GenericFoo
86derive instance Generic GenericFoo _
87
88
89class OverlappingStillCompiles a
90instance OverlappingStillCompiles x
91else instance OverlappingStillCompiles x
92
93
94main = do
95  namedExportStillWorksUnit 0
96  log "Done"
97
98data Either l r = Left l | Right r
99