13
13
import com .jnape .palatable .traitor .runners .Traits ;
14
14
import org .junit .Test ;
15
15
import org .junit .runner .RunWith ;
16
- import testsupport .traits .ApplicativeLaws ;
17
- import testsupport .traits .Equivalence ;
18
- import testsupport .traits .FunctorLaws ;
19
- import testsupport .traits .MonadLaws ;
20
- import testsupport .traits .MonadRecLaws ;
16
+ import testsupport .traits .*;
21
17
22
18
import java .util .ArrayList ;
23
19
import java .util .Collection ;
34
30
import static com .jnape .palatable .lambda .functions .recursion .RecursiveResult .terminate ;
35
31
import static com .jnape .palatable .lambda .functor .builtin .Identity .pureIdentity ;
36
32
import static com .jnape .palatable .lambda .functor .builtin .Lazy .lazy ;
37
- import static com .jnape .palatable .lambda .functor .builtin .Writer .listen ;
38
- import static com .jnape .palatable .lambda .functor .builtin .Writer .pureWriter ;
39
- import static com .jnape .palatable .lambda .functor .builtin .Writer .tell ;
40
- import static com .jnape .palatable .lambda .functor .builtin .Writer .writer ;
33
+ import static com .jnape .palatable .lambda .functor .builtin .Writer .*;
41
34
import static com .jnape .palatable .lambda .io .IO .io ;
42
- import static com .jnape .palatable .lambda .monad .transformer .builtin .IterateT .empty ;
43
- import static com .jnape .palatable .lambda .monad .transformer .builtin .IterateT .singleton ;
44
- import static com .jnape .palatable .lambda .monad .transformer .builtin .IterateT .unfold ;
35
+ import static com .jnape .palatable .lambda .monad .transformer .builtin .IterateT .*;
45
36
import static com .jnape .palatable .lambda .monoid .builtin .AddAll .addAll ;
46
37
import static com .jnape .palatable .lambda .monoid .builtin .Join .join ;
47
38
import static com .jnape .palatable .traitor .framework .Subjects .subjects ;
53
44
import static org .junit .Assert .assertThat ;
54
45
import static testsupport .Constants .STACK_EXPLODING_NUMBER ;
55
46
import static testsupport .matchers .IOMatcher .yieldsValue ;
56
- import static testsupport .matchers .IterateTMatcher .isEmpty ;
57
- import static testsupport .matchers .IterateTMatcher .iterates ;
58
- import static testsupport .matchers .IterateTMatcher .iteratesAll ;
47
+ import static testsupport .matchers .IterateTMatcher .*;
59
48
import static testsupport .traits .Equivalence .equivalence ;
60
49
61
50
@ RunWith (Traits .class )
@@ -242,4 +231,20 @@ public void concatIsStackSafe() {
242
231
assertEquals (new Identity <>(10_000 ),
243
232
bigIterateT .fold ((x , y ) -> new Identity <>(x + y ), new Identity <>(0 )));
244
233
}
234
+
235
+ @ Test
236
+ public void staticPure () {
237
+ assertEquals (new Identity <>(singletonList (1 )),
238
+ pureIterateT (pureIdentity ())
239
+ .<Integer , IterateT <Identity <?>, Integer >>apply (1 )
240
+ .<List <Integer >, Identity <List <Integer >>>toCollection (ArrayList ::new ));
241
+ }
242
+
243
+ @ Test
244
+ public void staticLift () {
245
+ assertEquals (new Identity <>(singletonList (1 )),
246
+ liftIterateT ()
247
+ .<Integer , Identity <?>, IterateT <Identity <?>, Integer >>apply (new Identity <>(1 ))
248
+ .<List <Integer >, Identity <List <Integer >>>toCollection (ArrayList ::new ));
249
+ }
245
250
}
0 commit comments