All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mperry.fg.IdentityMonad.groovy Maven / Gradle / Ivy

The newest version!
package com.github.mperry.fg

import com.github.mperry.fg.typeclass.Monad
import fj.F
import groovy.transform.TypeChecked

/**
 * Created by mperry on 1/07/2014.
 */
@TypeChecked
class IdentityMonad extends Monad {

    @Override
    def  Identity flatMap(Identity id, F> f) {
        f.f(id.item)
    }

    @Override
    def  Identity unit(B b) {
        new Identity(b)
    }

}