Package at.jku.ssw.fp.sect06_3_4
Class Logged<A>
- java.lang.Object
-
- at.jku.ssw.fp.sect06_3_4.Logged<A>
-
- Type Parameters:
A
- the type of values
public class Logged<A> extends Object
Class representing Logged monad. Wraps a value and contains a log string.- Author:
- Herbert Praehofer
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <B> Logged<B>
flatMap(Function<A,Logged<B>> mapper)
Monad operator mapping value and concatenating log strings.static <A> Logged<A>
of(A a, String log)
Creates a Logged monad with a wrapped value.String
toString()
-
-
-
Method Detail
-
of
public static <A> Logged<A> of(A a, String log)
Creates a Logged monad with a wrapped value.- Type Parameters:
A
- the type of the value- Parameters:
a
- the wrapped valuelog
- the log message- Returns:
- the monad with the wrapped value
-
flatMap
public <B> Logged<B> flatMap(Function<A,Logged<B>> mapper)
Monad operator mapping value and concatenating log strings.- Type Parameters:
B
- the type of the wrapped result object.- Parameters:
mapper
- the mapping function- Returns:
- the wrapped result value
-
-