當前位置: 首頁>>代碼示例>>Java>>正文


Java TypeEq類代碼示例

本文整理匯總了Java中org.derive4j.hkt.TypeEq的典型用法代碼示例。如果您正苦於以下問題:Java TypeEq類的具體用法?Java TypeEq怎麽用?Java TypeEq使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TypeEq類屬於org.derive4j.hkt包,在下文中一共展示了TypeEq類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: of

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
static <K, S, E, R> StreamIOAlgebra<K, S, E, R> of(EventStream<K, S, E> eventStream) {

    return new StreamIOAlgebra<K, S, E, R>() {

      @Override public IO<R> Read(Option<S> fromSeq, Fold<Event<K, S, E>, R> streamFold) {
        return eventStream.read(fromSeq, streamFold);
      }

      @Override public IO<R> Latest(TypeEq<Option<Event<K, S, E>>, R> resultType) {
        return eventStream.latest().map(resultType::coerce);
      }

      @Override public <Q> StreamIOAlgebra<K, S, E, Q> vary() {
        return of(eventStream);
      }
    };
  }
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:18,代碼來源:StreamIOAlgebra.java

示例2: testNondeterminism

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
@Test
@SuppressWarnings("UnusedAssignment")
public void testNondeterminism() {
    List<String> results = asList(
        Do_.<List.µ>do_()
            .pushM(List.range(1, 1, 3))
            .pushM(List.range(1, 1, 3))
            .map2(
                TypeEq.refl(),
                (Integer a, Integer b) ->
                    "" + a + " x " + b + " = " + (a*b)
            )
            .runWithResultNoTailRec(TypeEq.refl(), List.monadPlus)
    );
    assertThat(results).containsExactly(
            "1 x 1 = 1", "1 x 2 = 2", "1 x 3 = 3",
            "2 x 1 = 2", "2 x 2 = 4", "2 x 3 = 6",
            "3 x 1 = 3", "3 x 2 = 6", "3 x 3 = 9"
    );
}
 
開發者ID:highj,項目名稱:highj,代碼行數:21,代碼來源:DoTest.java

示例3: testBind

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
@Test
public void testBind() {
    Either<String, Integer> handSum = asEither(
        Do_.<__<Either.µ,String>>do_()
            .push(6)
            .push(7)
            .pushBind2(TypeEq.refl(), (Integer a, Integer b) -> {
                int r = a + b;
                if (r > 10) {
                    return Either.<String, Integer>Left("Not enough fingers!");
                } else {
                    return Either.<String, Integer>Right(r);
                }
            })
            .runWithResult(TypeEq.refl(), Either.monad())
    );
    assertEquals("Left(Not enough fingers!)", handSum.toString());
}
 
開發者ID:highj,項目名稱:highj,代碼行數:19,代碼來源:DoTest.java

示例4: GenCode

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
GenCode(Elements elts, Types types, Filer filer, TypeElement elt) {
    Elts = elts;
    Types = types;
    Filer = filer;
    __Elt = elt;
    TypeEqElt = Elts.getTypeElement(TypeEq.class.getName());
}
 
開發者ID:derive4j,項目名稱:hkt,代碼行數:8,代碼來源:GenCode.java

示例5: WriteEvents

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
default WStreamAction<K, S, E, WriteResult<K, S, E>> WriteEvents(Option<S> expectedSeq, Instant time,
    Iterable<E> events) {
  return new WStreamAction<K, S, E, WriteResult<K, S, E>>() {
    @Override public <X> X eval(Algebra<K, S, E, WriteResult<K, S, E>, X> interpreter) {
      return interpreter.Write(expectedSeq, time, events, TypeEq.refl());
    }
  };
}
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:9,代碼來源:WStreamAction.java

示例6: GetLatestEvent

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
default StreamAction<K, S, E, Option<Event<K, S, E>>> GetLatestEvent() {
  return new StreamAction<K, S, E, Option<Event<K, S, E>>>() {
    @Override public <X> X eval(Algebra<K, S, E, Option<Event<K, S, E>>, X> interpreter) {
      return interpreter.Latest(TypeEq.refl());
    }
  };
}
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:8,代碼來源:StreamAction.java

示例7: GetSnapshot

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
default SnapshotAction<S, V, Snapshot<S, V>> GetSnapshot(SequenceQuery<S> sequence) {
  return new SnapshotAction<S, V, Snapshot<S, V>>() {
    @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
      return interpreter.Get(sequence, TypeEq.refl());
    }
  };
}
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:8,代碼來源:SnapshotAction.java

示例8: PutSnapshot

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
default SnapshotAction<S, V, Snapshot<S, V>> PutSnapshot(Snapshot<S, V> snapshot, SnapshotStoreMode mode) {
  return new SnapshotAction<S, V, Snapshot<S, V>>() {
    @Override public <X> X eval(Algebra<S, V, Snapshot<S, V>, X> interpreter) {
      return interpreter.Put(snapshot, mode, TypeEq.refl());
    }
  };
}
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:8,代碼來源:SnapshotAction.java

示例9: Get

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
@Override default X Get(SequenceQuery<S> sequence, TypeEq<Snapshot<S, V>, R> resultType) {
  return snapshotAlgebra().Get(sequence, resultType);
}
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:4,代碼來源:ESAction.java

示例10: Put

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
@Override default X Put(Snapshot<S, V> snapshot, SnapshotStoreMode mode, TypeEq<Snapshot<S, V>, R> resultType) {
  return snapshotAlgebra().Put(snapshot, mode, resultType);
}
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:4,代碼來源:ESAction.java

示例11: Write

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
@Override default X Write(Option<S> expectedSeq, Instant time, Iterable<E> events, TypeEq<WriteResult<K, S, E>, R> resultType) {
  return wStreamAlgebra().Write(expectedSeq, time, events, resultType);
}
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:4,代碼來源:ESAction.java

示例12: Latest

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
@Override default X Latest(TypeEq<Option<Event<K, S, E>>, R> resultType) {
  return wStreamAlgebra().Latest(resultType);
}
 
開發者ID:jbgi,項目名稱:eventsrc4j,代碼行數:4,代碼來源:ESAction.java

示例13: First

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
private First(FreeArrow<F,ARR,B,C> a, TypeEq<E,T2<B,D>> typeEq1, TypeEq<T2<C,D>,G> typeEq2) {
    this._a = a;
    this._typeEq1 = typeEq1;
    this._typeEq2 = typeEq2;
}
 
開發者ID:highj,項目名稱:highj,代碼行數:6,代碼來源:FreeArrow.java

示例14: create

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
public static <F,ARR,B,C,D> First<F,ARR,B,C,D,T2<B,D>,T2<C,D>> create(FreeArrow<F,ARR,B,C> a) {
    return new First<>(a, TypeEq.refl(), TypeEq.refl());
}
 
開發者ID:highj,項目名稱:highj,代碼行數:4,代碼來源:FreeArrow.java

示例15: typeEq1

import org.derive4j.hkt.TypeEq; //導入依賴的package包/類
public TypeEq<E,T2<B,D>> typeEq1() {
    return _typeEq1;
}
 
開發者ID:highj,項目名稱:highj,代碼行數:4,代碼來源:FreeArrow.java


注:本文中的org.derive4j.hkt.TypeEq類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。