17
17
import com .jnape .palatable .lambda .functions .Fn6 ;
18
18
import com .jnape .palatable .lambda .functions .Fn7 ;
19
19
import com .jnape .palatable .lambda .functions .Fn8 ;
20
- import com .jnape .palatable .lambda .structural .Matchers .Any ;
20
+ import com .jnape .palatable .lambda .structural .Matcher .Any ;
21
21
22
22
import java .util .function .BiFunction ;
23
23
import java .util .function .Function ;
24
24
25
+ import static com .jnape .palatable .lambda .Spike .liftA ;
25
26
import static com .jnape .palatable .lambda .adt .Maybe .just ;
26
27
import static com .jnape .palatable .lambda .functions .builtin .fn2 .Into .into ;
27
28
import static com .jnape .palatable .lambda .functions .builtin .fn2 .Into1 .into1 ;
@@ -122,81 +123,81 @@ public static <A, B, C, R> Total<Tuple3<A, B, C>, R> of(Any<A> __,
122
123
}
123
124
124
125
@ SuppressWarnings ({"RedundantTypeArguments" ,"unused" })
125
- public static <A ,B ,C ,D ,R >Total <Tuple4 <A ,B ,C ,D >,R >of (Any __ ,
126
- Any ___ ,
127
- Any ____ ,
128
- Any _____ ,
126
+ public static <A ,B ,C ,D ,R >Total <Tuple4 <A ,B ,C ,D >,R >of (Any < A > __ ,
127
+ Any < B > ___ ,
128
+ Any < C > ____ ,
129
+ Any < D > _____ ,
129
130
Fn4 <?super A , ?super B , ?super C , ?super D , ?extends R >fn ) {
130
131
return Case .<A ,B ,C ,D ,R >of (fn );
131
132
}
132
133
133
134
@ SuppressWarnings ({"RedundantTypeArguments" ,"unused" })
134
- public static <A ,B ,C ,D ,E ,R >Total <Tuple5 <A ,B ,C ,D ,E >,R >of (Any __ ,
135
- Any ___ ,
136
- Any ____ ,
137
- Any _____ ,
138
- Any ______ ,
135
+ public static <A ,B ,C ,D ,E ,R >Total <Tuple5 <A ,B ,C ,D ,E >,R >of (Any < A > __ ,
136
+ Any < B > ___ ,
137
+ Any < C > ____ ,
138
+ Any < D > _____ ,
139
+ Any < E > ______ ,
139
140
Fn5 <?super A , ?super B , ?super C , ?super D , ?super E , ?extends R >fn ) {
140
141
return Case .<A ,B ,C ,D ,E ,R >of (fn );
141
142
}
142
143
143
144
@ SuppressWarnings ({"RedundantTypeArguments" ,"unused" })
144
- public static <A ,B ,C ,D ,E ,F ,R >Total <Tuple6 <A ,B ,C ,D ,E ,F >,R >of (Any __ ,
145
- Any ___ ,
146
- Any ____ ,
147
- Any _____ ,
148
- Any ______ ,
149
- Any _______ ,
145
+ public static <A ,B ,C ,D ,E ,F ,R >Total <Tuple6 <A ,B ,C ,D ,E ,F >,R >of (Any < A > __ ,
146
+ Any < B > ___ ,
147
+ Any < C > ____ ,
148
+ Any < D > _____ ,
149
+ Any < E > ______ ,
150
+ Any < F > _______ ,
150
151
Fn6 <?super A , ?super B , ?super C , ?super D , ?super E , ?super F , ?extends R >fn ) {
151
152
return Case .<A ,B ,C ,D ,E ,F ,R >of (fn );
152
153
}
153
154
154
155
@ SuppressWarnings ({"RedundantTypeArguments" ,"unused" })
155
- public static <A ,B ,C ,D ,E ,F ,G ,R >Total <Tuple7 <A ,B ,C ,D ,E ,F ,G >,R >of (Any __ ,
156
- Any ___ ,
157
- Any ____ ,
158
- Any _____ ,
159
- Any ______ ,
160
- Any _______ ,
161
- Any ________ ,
156
+ public static <A ,B ,C ,D ,E ,F ,G ,R >Total <Tuple7 <A ,B ,C ,D ,E ,F ,G >,R >of (Any < A > __ ,
157
+ Any < B > ___ ,
158
+ Any < C > ____ ,
159
+ Any < D > _____ ,
160
+ Any < E > ______ ,
161
+ Any < F > _______ ,
162
+ Any < G > ________ ,
162
163
Fn7 <?super A , ?super B , ?super C , ?super D , ?super E , ?super F , ?super G , ?extends R >fn ) {
163
164
return Case .<A ,B ,C ,D ,E ,F ,G ,R >of (fn );
164
165
}
165
166
166
167
@ SuppressWarnings ({"RedundantTypeArguments" ,"unused" })
167
- public static <A ,B ,C ,D ,E ,F ,G ,H ,R >Total <Tuple8 <A ,B ,C ,D ,E ,F ,G ,H >,R >of (Any __ ,
168
- Any ___ ,
169
- Any ____ ,
170
- Any _____ ,
171
- Any ______ ,
172
- Any _______ ,
173
- Any ________ ,
174
- Any _________ ,
168
+ public static <A ,B ,C ,D ,E ,F ,G ,H ,R >Total <Tuple8 <A ,B ,C ,D ,E ,F ,G ,H >,R >of (Any < A > __ ,
169
+ Any < B > ___ ,
170
+ Any < C > ____ ,
171
+ Any < D > _____ ,
172
+ Any < E > ______ ,
173
+ Any < F > _______ ,
174
+ Any < G > ________ ,
175
+ Any < H > _________ ,
175
176
Fn8 <?super A , ?super B , ?super C , ?super D , ?super E , ?super F , ?super G , ?super H , ?extends R >fn ) {
176
177
return Case .<A ,B ,C ,D ,E ,F ,G ,H ,R >of (fn );
177
178
}
178
179
179
180
180
181
public static <A ,APrime ,R >Partial <SingletonHList <A >,R >of (Matcher <?super A , ?extends APrime >aMatcher ,
181
182
Function <?super APrime , ?extends R >body ) {
182
- return new Partial <>(into1 (a ->aMatcher .apply (a ).fmap (body )));
183
+ return new Partial <>(into1 (a ->aMatcher .match (a ).fmap (body )));
183
184
}
184
185
185
186
public static <A ,APrime ,B ,BPrime ,R >Partial <Tuple2 <A ,B >,R >of (
186
187
Matcher <?super A , ?extends APrime >aMatcher ,
187
188
Matcher <?super B , ?extends BPrime >bMatcher ,
188
189
BiFunction <?super APrime , ?super BPrime , ?extends R >body ) {
189
- return new Partial <>(into ((a ,b ) ->aMatcher .apply (a ).flatMap (aPrime ->bMatcher .apply (b ).fmap (bPrime ->body .apply (aPrime ,bPrime )))));
190
+ return new Partial <>(into ((a ,b ) ->aMatcher .match (a ).flatMap (aPrime ->bMatcher .match (b ).fmap (bPrime ->body .apply (aPrime ,bPrime )))));
190
191
}
191
192
192
193
public static <A ,APrime ,B ,BPrime ,C ,CPrime ,R >Partial <Tuple3 <A ,B ,C >,R >of (
193
194
Matcher <?super A , ?extends APrime >aMatcher ,
194
195
Matcher <?super B , ?extends BPrime >bMatcher ,
195
196
Matcher <?super C , ?extends CPrime >cMatcher ,
196
197
Fn3 <?super APrime , ?super BPrime , ?super CPrime , ?extends R >body ) {
197
- return new Partial <>(into3 ((a ,b ,c ) ->aMatcher .apply (a )
198
- .flatMap (aPrime ->bMatcher .apply (b )
199
- .flatMap (bPrime ->cMatcher .apply (c )
198
+ return new Partial <>(into3 ((a ,b ,c ) ->aMatcher .match (a )
199
+ .flatMap (aPrime ->bMatcher .match (b )
200
+ .flatMap (bPrime ->cMatcher .match (c )
200
201
.fmap (cPrime ->body .apply (aPrime ,bPrime ,cPrime ))))));
201
202
}
202
203
@@ -206,10 +207,10 @@ public static <A, APrime, B, BPrime, C, CPrime, D, DPrime, R> Partial<Tuple4<A,
206
207
Matcher <?super C , ?extends CPrime >cMatcher ,
207
208
Matcher <?super D , ?extends DPrime >dMatcher ,
208
209
Fn4 <?super APrime , ?super BPrime , ?super CPrime , ?super DPrime , ?extends R >body ) {
209
- return new Partial <>(into4 ((a ,b ,c ,d ) ->aMatcher .apply (a )
210
- .flatMap (aPrime ->bMatcher .apply (b )
211
- .flatMap (bPrime ->cMatcher .apply (c )
212
- .flatMap (cPrime ->dMatcher .apply (d )
210
+ return new Partial <>(into4 ((a ,b ,c ,d ) ->aMatcher .match (a )
211
+ .flatMap (aPrime ->bMatcher .match (b )
212
+ .flatMap (bPrime ->cMatcher .match (c )
213
+ .flatMap (cPrime ->dMatcher .match (d )
213
214
.fmap (dPrime ->body .apply (aPrime ,bPrime ,cPrime ,dPrime )))))));
214
215
}
215
216
@@ -221,11 +222,11 @@ public static <A, APrime, B, BPrime, C, CPrime, D, DPrime, E, EPrime, R> Partial
221
222
Matcher <?super D , ?extends DPrime >dMatcher ,
222
223
Matcher <?super E , ?extends EPrime >eMatcher ,
223
224
Fn5 <?super APrime , ?super BPrime , ?super CPrime , ?super DPrime , ?super EPrime , ?extends R >body ) {
224
- return new Partial <>(into5 ((a ,b ,c ,d ,e ) ->aMatcher .apply (a )
225
- .flatMap (aPrime ->bMatcher .apply (b )
226
- .flatMap (bPrime ->cMatcher .apply (c )
227
- .flatMap (cPrime ->dMatcher .apply (d )
228
- .flatMap (dPrime ->eMatcher .apply (e )
225
+ return new Partial <>(into5 ((a ,b ,c ,d ,e ) ->aMatcher .match (a )
226
+ .flatMap (aPrime ->bMatcher .match (b )
227
+ .flatMap (bPrime ->cMatcher .match (c )
228
+ .flatMap (cPrime ->dMatcher .match (d )
229
+ .flatMap (dPrime ->eMatcher .match (e )
229
230
.fmap (ePrime ->body .apply (aPrime ,bPrime ,cPrime ,dPrime ,ePrime ))))))));
230
231
}
231
232
@@ -237,15 +238,8 @@ public static <A, APrime, B, BPrime, C, CPrime, D, DPrime, E, EPrime, F, FPrime,
237
238
Matcher <?super D , ?extends DPrime >dMatcher ,
238
239
Matcher <?super E , ?extends EPrime >eMatcher ,
239
240
Matcher <?super F , ?extends FPrime >fMatcher ,
240
- Fn6 <?super APrime , ?super BPrime , ?super CPrime , ?super DPrime , ?super EPrime , ?super FPrime , ?extends R >body ) {
241
- //todo: for-comprehensions, lest any consumers needing to flatMap 6 levels deep instead choose death's sweet embrace
242
- return new Partial <>(into6 ((a ,b ,c ,d ,e ,f ) ->aMatcher .apply (a )
243
- .flatMap (aPrime ->bMatcher .apply (b )
244
- .flatMap (bPrime ->cMatcher .apply (c )
245
- .flatMap (cPrime ->dMatcher .apply (d )
246
- .flatMap (dPrime ->eMatcher .apply (e )
247
- .flatMap (ePrime ->fMatcher .apply (f )
248
- .fmap (fPrime ->body .apply (aPrime ,bPrime ,cPrime ,dPrime ,ePrime ,fPrime )))))))));
241
+ Fn6 <?super APrime , ?super BPrime , ?super CPrime , ?super DPrime , ?super EPrime , ?super FPrime ,R >body ) {
242
+ return new Partial <>(into6 ((a ,b ,c ,d ,e ,f ) ->liftA (aMatcher .match (a ),bMatcher .match (b ),cMatcher .match (c ),dMatcher .match (d ),eMatcher .match (e ),fMatcher .match (f ),body ).coerce ()));
249
243
}
250
244
251
245
public static <A ,APrime ,B ,BPrime ,C ,CPrime ,D ,DPrime ,E ,EPrime ,F ,FPrime ,G ,GPrime ,R >Partial <Tuple7 <A ,B ,C ,D ,E ,F ,G >,R >of (
@@ -257,13 +251,13 @@ public static <A, APrime, B, BPrime, C, CPrime, D, DPrime, E, EPrime, F, FPrime,
257
251
Matcher <?super F , ?extends FPrime >fMatcher ,
258
252
Matcher <?super G , ?extends GPrime >gMatcher ,
259
253
Fn7 <?super APrime , ?super BPrime , ?super CPrime , ?super DPrime , ?super EPrime , ?super FPrime , ?super GPrime , ?extends R >body ) {
260
- return new Partial <>(into7 ((a ,b ,c ,d ,e ,f ,g ) ->aMatcher .apply (a )
261
- .flatMap (aPrime ->bMatcher .apply (b )
262
- .flatMap (bPrime ->cMatcher .apply (c )
263
- .flatMap (cPrime ->dMatcher .apply (d )
264
- .flatMap (dPrime ->eMatcher .apply (e )
265
- .flatMap (ePrime ->fMatcher .apply (f )
266
- .flatMap (fPrime ->gMatcher .apply (g )
254
+ return new Partial <>(into7 ((a ,b ,c ,d ,e ,f ,g ) ->aMatcher .match (a )
255
+ .flatMap (aPrime ->bMatcher .match (b )
256
+ .flatMap (bPrime ->cMatcher .match (c )
257
+ .flatMap (cPrime ->dMatcher .match (d )
258
+ .flatMap (dPrime ->eMatcher .match (e )
259
+ .flatMap (ePrime ->fMatcher .match (f )
260
+ .flatMap (fPrime ->gMatcher .match (g )
267
261
.fmap (gPrime ->body .apply (aPrime ,bPrime ,cPrime ,dPrime ,ePrime ,fPrime ,gPrime ))))))))));
268
262
}
269
263
@@ -277,14 +271,14 @@ public static <A, APrime, B, BPrime, C, CPrime, D, DPrime, E, EPrime, F, FPrime,
277
271
Matcher <?super G , ?extends GPrime >gMatcher ,
278
272
Matcher <?super H , ?extends HPrime >hMatcher ,
279
273
Fn8 <?super APrime , ?super BPrime , ?super CPrime , ?super DPrime , ?super EPrime , ?super FPrime , ?super GPrime , ?super HPrime , ?extends R >body ) {
280
- return new Partial <>(into8 ((a ,b ,c ,d ,e ,f ,g ,h ) ->aMatcher .apply (a )
281
- .flatMap (aPrime ->bMatcher .apply (b )
282
- .flatMap (bPrime ->cMatcher .apply (c )
283
- .flatMap (cPrime ->dMatcher .apply (d )
284
- .flatMap (dPrime ->eMatcher .apply (e )
285
- .flatMap (ePrime ->fMatcher .apply (f )
286
- .flatMap (fPrime ->gMatcher .apply (g )
287
- .flatMap (gPrime ->hMatcher .apply (h )
274
+ return new Partial <>(into8 ((a ,b ,c ,d ,e ,f ,g ,h ) ->aMatcher .match (a )
275
+ .flatMap (aPrime ->bMatcher .match (b )
276
+ .flatMap (bPrime ->cMatcher .match (c )
277
+ .flatMap (cPrime ->dMatcher .match (d )
278
+ .flatMap (dPrime ->eMatcher .match (e )
279
+ .flatMap (ePrime ->fMatcher .match (f )
280
+ .flatMap (fPrime ->gMatcher .match (g )
281
+ .flatMap (gPrime ->hMatcher .match (h )
288
282
.fmap (hPrime ->body .apply (aPrime ,bPrime ,cPrime ,dPrime ,ePrime ,fPrime ,gPrime ,hPrime )))))))))));
289
283
}
290
284