Eff

The Eff monad

Represents synchronous computations which are both dependency-injected and explicitly effectful

new Eff()
Static Members
of(a)
Require()
Requires(f)
Instance Members
map(transform)
andThen(next)
toEffResult()
toEffTask()

EffResult

The EffResult monad

new EffResult()
Static Members
fromEff(eff)
fromResult(result)
of(a)
Require()
Requires(f)
Val(a)
Err(x)
Instance Members
map(f)
andThen(next)
toEffTask()

EffTask

The EffTask monad

new EffTask()
Static Members
fromEff(eff)
fromEffResult(eff)
fromTask(task)
of(a)
Require()
Requires(f)
Success(a)
Fail(x)
Instance Members
map(f)
andThen(next)

Identity

The Identity monad

Simply acts a container for values without any additional behavior

new Identity()
Example
let a = Identity.of(42)
Static Members
of(a)
lift(f)
lift2(f)
lift3(f)
Instance Members
map(transform)
andThen(next)
toString()

IO

The IO monad

Represents a potentially-effectful synchronous computation

new IO()
Static Members
of(value)
lift(f)
lift2(f)
lift3(f)
Instance Members
map(transform)
andThen(next)

Maybe

The Maybe monad

Represents the possibility of the presence or absence of a value. Commonly used to safely deal with nullable values because it is composable and forces the developer to explicitly handle the null case.

new Maybe()
Example
// construct a Maybe with a value
let some =  Maybe.Just(42);

// construct a maybe absent of a value
let none = Maybe.Nothing;

// create Maybes from nullable values
let ma = Maybe.of('foo'),
	mb = Maybe.of(null);
Static Members
of(a)
Just(a)
Nothing
fromThrowable(throwFn)
lift(f)
lift2(f)
lift3(f)
Instance Members
cases(patterns)
isJust()
isNothing()
getOrElse(defaultVal)
map(f)
andThen(next)
toString()

Pair

Pair functor

new Pair()
Static Members
from(a, b)
of(data)
Instance Members
map(f)

Reader

The Reader monad

new Reader()
Static Members
of(val)
merge2(r1, r2)
merge3(r1, r2, r3)
all(readers)
Ask()
Asks(f)
lift(f)
lift2(f)
lift3(f)
Instance Members
constructor(runReader)
map(f)
andThen(next)

Result

The Result monad

Represents the possiblity of either a success value or an error value

new Result()
Example
// create a "success" value
let a = Result.Val(42),
	b = Result.of(42);

// create an "error" value
let x = Result.Error('error!');
Static Members
of(value)
Val(value)
Err(error)
fromThrowable(throwFn)
Instance Members
cases(patterns)
map(f)
andThen(next)
handleError(handle)
toMaybe()

State

The State monad

new State()
Static Members
join(state)
of(val)
Get()
Put(s)
Modify(f)
Instance Members
getState(initState)
getValue(initState)
map(f)
andThen(next)

Task

The Task monad

new Task()
Static Members
of(a)
Success(a)
Fail(x)
fromResult(res)
fromIO(io)
fromPromise(promise)
fromPromiseFunc(promiseFn)
fromCallback(fn)
fromThrowable(fn)
lift(f)
lift2(f)
lift3(f)
Instance Members
constructor(runTask)
map(f)
andThen(next)
handleError(handle)
toMaybe()

Writer

The Writer monad

new Writer()
Static Members
of(val)
Tell(msg)
Instance Members
runWriter()
getEnv()
getValue()
map(f)
andThen(next)