@@ -72,8 +72,13 @@ object BasisConstraint {
72
72
type λ [L <: HList ] = BasisConstraint [L , M ]
73
73
}
74
74
75
- implicit def hnilBasis [M <: HList ] = new BasisConstraint [HNil , M ] {}
76
- implicit def hlistBasis [H , T <: HList , M <: HList ](implicit bct : BasisConstraint [T , M ], sel : Selector [M , H ]) =
75
+ implicit def hnilBasis [M <: HList ]: BasisConstraint [HNil , M ] =
76
+ new BasisConstraint [HNil , M ] {}
77
+
78
+ implicit def hlistBasis [H , T <: HList , M <: HList ](implicit
79
+ bct : BasisConstraint [T , M ],
80
+ sel : Selector [M , H ]
81
+ ): BasisConstraint [H :: T , M ] =
77
82
new BasisConstraint [H :: T , M ] {}
78
83
}
79
84
@@ -89,8 +94,13 @@ object LUBConstraint {
89
94
type λ [L <: HList ] = LUBConstraint [L , B ]
90
95
}
91
96
92
- implicit def hnilLUB [T ] = new LUBConstraint [HNil , T ] {}
93
- implicit def hlistLUB [H , T <: HList , B ](implicit bct : LUBConstraint [T , B ], ev : H <:< B ) =
97
+ implicit def hnilLUB [T ]: LUBConstraint [HNil , T ] =
98
+ new LUBConstraint [HNil , T ] {}
99
+
100
+ implicit def hlistLUB [H , T <: HList , B ](implicit
101
+ bct : LUBConstraint [T , B ],
102
+ ev : H <:< B
103
+ ): LUBConstraint [H :: T , B ] =
94
104
new LUBConstraint [H :: T , B ] {}
95
105
}
96
106
@@ -108,9 +118,14 @@ object KeyConstraint {
108
118
type λ [L <: HList ] = KeyConstraint [L , M ]
109
119
}
110
120
111
- implicit def hnilKeys [M <: HList ] = new KeyConstraint [HNil , M ] {}
112
- implicit def hlistKeys [K , V , T <: HList , M <: HList ]
113
- (implicit bct : KeyConstraint [T , M ], sel : Selector [M , K ]) = new KeyConstraint [FieldType [K , V ] :: T , M ] {}
121
+ implicit def hnilKeys [M <: HList ]: KeyConstraint [HNil , M ] =
122
+ new KeyConstraint [HNil , M ] {}
123
+
124
+ implicit def hlistKeys [K , V , T <: HList , M <: HList ](implicit
125
+ bct : KeyConstraint [T , M ],
126
+ sel : Selector [M , K ]
127
+ ): KeyConstraint [FieldType [K , V ] :: T , M ] =
128
+ new KeyConstraint [FieldType [K , V ] :: T , M ] {}
114
129
}
115
130
116
131
/**
@@ -127,9 +142,14 @@ object ValueConstraint {
127
142
type λ [L <: HList ] = ValueConstraint [L , M ]
128
143
}
129
144
130
- implicit def hnilValues [M <: HList ] = new ValueConstraint [HNil , M ] {}
131
- implicit def hlistValues [K , V , T <: HList , M <: HList ]
132
- (implicit bct : ValueConstraint [T , M ], sel : Selector [M , V ]) = new ValueConstraint [FieldType [K , V ] :: T , M ] {}
145
+ implicit def hnilValues [M <: HList ]: ValueConstraint [HNil , M ] =
146
+ new ValueConstraint [HNil , M ] {}
147
+
148
+ implicit def hlistValues [K , V , T <: HList , M <: HList ](implicit
149
+ bct : ValueConstraint [T , M ],
150
+ sel : Selector [M , V ]
151
+ ): ValueConstraint [FieldType [K , V ] :: T , M ] =
152
+ new ValueConstraint [FieldType [K , V ] :: T , M ] {}
133
153
}
134
154
135
155
/**
@@ -146,8 +166,13 @@ object NotContainsConstraint {
146
166
type λ [L <: HList ] = NotContainsConstraint [L , U ]
147
167
}
148
168
149
- implicit def hnilNotContains [U ] = new NotContainsConstraint [HNil , U ] {}
150
- implicit def hlistNotContains [H , T <: HList , U ](implicit nc : T NotContainsConstraint U , neq : U =:!= H ) =
169
+ implicit def hnilNotContains [U ]: NotContainsConstraint [HNil , U ] =
170
+ new NotContainsConstraint [HNil , U ] {}
171
+
172
+ implicit def hlistNotContains [H , T <: HList , U ](implicit
173
+ nc : T NotContainsConstraint U ,
174
+ neq : U =:!= H
175
+ ): NotContainsConstraint [H :: T , U ] =
151
176
new NotContainsConstraint [H :: T , U ] {}
152
177
}
153
178
@@ -161,8 +186,12 @@ object IsDistinctConstraint {
161
186
162
187
def apply [L <: HList ](implicit idc : IsDistinctConstraint [L ]): IsDistinctConstraint [L ] = idc
163
188
164
- implicit def hnilIsDistinct = new IsDistinctConstraint [HNil ] {}
165
- implicit def hlistIsDistinct [H , T <: HList ](implicit d : IsDistinctConstraint [T ],
166
- nc : NotContainsConstraint [T , H ]): IsDistinctConstraint [H :: T ] =
189
+ implicit def hnilIsDistinct : IsDistinctConstraint [HNil ] =
190
+ new IsDistinctConstraint [HNil ] {}
191
+
192
+ implicit def hlistIsDistinct [H , T <: HList ](implicit
193
+ d : IsDistinctConstraint [T ],
194
+ nc : NotContainsConstraint [T , H ]
195
+ ): IsDistinctConstraint [H :: T ] =
167
196
new IsDistinctConstraint [H :: T ] {}
168
197
}
0 commit comments