'use strict';

const { isNotNull } = require('ramda-adjunct');

const FlutureTMonetEither = require('../FlutureTMonetEither');


const MonetEitherT = ({ monet, fluture = null }) => {
  const { Either, Identity } = monet;

  const type = (monadOrValue) => {
    if (isNotNull(fluture) && fluture.isFuture(monadOrValue)) {
      return FlutureTMonetEither({ monet, fluture }).fromFuture(monadOrValue);
    } else if (monadOrValue instanceof Identity.fn.init) {
      return Either.of(monadOrValue.get());
    } else if (monadOrValue instanceof Either.fn.init) {
      return monadOrValue;
    }
    return Either.of(monadOrValue);
  };

  return Object.assign(type, Either);
};


module.exports = MonetEitherT;

@@ -8,16 +8,51 @@
 rict';%0A%0A
+const %7B once %7D = require('ramda');%0A
 const %7B 
@@ -91,16 +91,16 @@
 unct');%0A
-
 %0Aconst F
@@ -248,16 +248,77 @@
 = monet;
+%0A  const FlutureTMonetEitherType = once(FlutureTMonetEither);
 %0A%0A  cons
@@ -406,24 +406,24 @@
 OrValue)) %7B%0A
-
       return
@@ -442,16 +442,20 @@
 etEither
+Type
 (%7B monet

create new types only once