当前位置: 首页>>代码示例>>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;未经允许,请勿转载。