Skip to content

Commit e15ea09

Browse files
committed
Merge pull request functionaljava#155 from mperry/realworld
Added IO example from chapter 7 of Real World Haskell
2 parents 9d11cd4 + f2710c7 commit e15ea09

File tree

12 files changed

+797
-378
lines changed

12 files changed

+797
-378
lines changed

core/src/main/java/fj/Show.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,14 @@ public static <A> Show<Class<A>> classShow() {
422422
* @return A show instance for the {@link P1 tuple-1} type.
423423
*/
424424
public static <A> Show<P1<A>> p1Show(final Show<A> sa) {
425+
return p1ShowLazy(sa);
426+
}
427+
428+
public static <A> Show<P1<A>> p1ShowLazy(final Show<A> sa) {
429+
return show(p -> Stream.fromString("(?)"));
430+
}
431+
432+
public static <A> Show<P1<A>> p1ShowEager(final Show<A> sa) {
425433
return show(p -> cons('(', p(sa.show(p._1()))).snoc(')'));
426434
}
427435

core/src/main/java/fj/Try.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static <A, B, C, D, E, F, G, H, I, Z extends Exception> F8<A, B, C, D, E,
160160
}
161161

162162
public static <A> IO<A> io(Try0<A, ? extends IOException> t) {
163-
return IOFunctions.io(t);
163+
return IOFunctions.fromTry(t);
164164
}
165165

166166
}

0 commit comments

Comments
 (0)