Monad – simple example definition

Combines the following concept.

1. Functor
– Type constructor.
– Value lifting.
2. Bind
– Create a functor then unwrap -> for example, flatMap in optional in Java8.

| Leave a comment

C++14: in Java 8 for functional programming(Monad)

Pseudo C++ example implementation of map function in optional in Java8 for functional style programming by utilizing Monad concept.

template<class T>
class optional
  T value;
  bool valid;

  optional() : valid(false)
  optional(T value) {
    this.value = value;
    valid = true;

  template<class F>
  auto map(F f) -> optional<std::decay_t<decltyp(f(value))>> {
    if (value.has_value())
        return f(value);
    return decltype(f(value))();

Posted in C++ | Leave a comment

Java – Guava API to sort items in collection with Ordering compound example

	Ordering.from((Comparator<Item>) Comparator.comparingInt(item -> item.getId()))
Posted in Java, Programming | Leave a comment

C++17 – new features in C++17

Nice article for C++17 features.

Posted in C++, Programming | Tagged | Leave a comment

Docker – Best practice to refresh on building image

Adding the date in docker file so that user can update the data for every change.

Posted in docker, Programming | Leave a comment

Docker – Subnet address in Ubuntu

$ sudo vi /etc/default/docker

modify the following section.

Posted in docker, Programming | Leave a comment

Java – Spring boot with JAX-RS

Enabling Spring boot to use JAX-RS

Posted in Java, Programming | Leave a comment