derive4j / hkt

Higher Kinded Type machinery for Java
BSD 3-Clause "New" or "Revised" License
81 stars 9 forks source link

Add compatibility with KindedJ standard encoding #33

Open jbgi opened 6 years ago

jbgi commented 6 years ago

Minor change to generated casting methods (to handle KindedJ encoding directly) but should be source compatible (tested on HighJ). Eg. for Either the generated code is now:

  @SuppressWarnings("unchecked")
  static <A, B> Either<A,B> asEither(Hk<? extends Hk<Either.µ,A>,B> hkt) {
    return (Either<A,B>) hkt;
  }

  @SuppressWarnings("unchecked") // unchanged
  static <A, B> TypeEq<__<__<Either.µ,A>,B>, Either<A,B>> either(){
    return (TypeEq) TypeEq.refl();
  }