com.github.mperry.fg.StateIntMonad.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionalgroovy-main Show documentation
Show all versions of functionalgroovy-main Show documentation
FunctionalGroovy enhances FunctionalJava for Groovy
package com.github.mperry.fg
import com.github.mperry.fg.typeclass.Monad
import fj.F
import fj.P
import groovy.transform.Canonical
import groovy.transform.TypeChecked
import groovy.transform.TypeCheckingMode
/**
* Created by MarkPerry on 9/01/14.
*/
@TypeChecked
@Canonical
class StateIntMonad extends Monad {
@Override
@TypeChecked(TypeCheckingMode.SKIP)
def StateInt flatMap(StateInt mb, F> f) {
mb.flatMap(f)
}
@Override
@TypeChecked(TypeCheckingMode.SKIP)
def StateInt unit(B b) {
new StateInt({ Integer s -> P.p(b, s) } as F)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy