github Effect-TS/effect @effect/rpc-http@0.26.0

latest releases: @effect/sql-sqlite-wasm@0.20.4, @effect/typeclass@0.29.13, @effect/vitest@0.13.13...
9 months ago

Minor Changes

  • #2006 9a2d1c1 Thanks @github-actions! - With this change we now require a string key to be provided for all tags and renames the dear old Tag to GenericTag, so when previously you could do:

    import { Effect, Context } from "effect";
    interface Service {
      readonly _: unique symbol;
    }
    const Service = Context.Tag<
      Service,
      {
        number: Effect.Effect<never, never, number>;
      }
    >();

    you are now mandated to do:

    import { Effect, Context } from "effect";
    interface Service {
      readonly _: unique symbol;
    }
    const Service = Context.GenericTag<
      Service,
      {
        number: Effect.Effect<never, never, number>;
      }
    >("Service");

    This makes by default all tags globals and ensures better debuggaility when unexpected errors arise.

    Furthermore we introduce a new way of constructing tags that should be considered the new default:

    import { Effect, Context } from "effect";
    class Service extends Context.Tag("Service")<
      Service,
      {
        number: Effect.Effect<never, never, number>;
      }
    >() {}
    
    const program = Effect.flatMap(Service, ({ number }) => number).pipe(
      Effect.flatMap((_) => Effect.log(`number: ${_}`)),
    );

    this will use "Service" as the key and will create automatically an opaque identifier (the class) to be used at the type level, it does something similar to the above in a single shot.

  • #2006 2131a8c Thanks @github-actions! - second revision of /rpc api

    /rpc now uses Schema.TaggedRequest to define the schemas, and supports
    streaming.

    The api has been simplified and has a less complex design. See the examples
    folder in the /rpc-http package for a simple example.

  • #2006 1a77f72 Thanks @github-actions! - change Effect type parameters order from Effect<R, E, A> to Effect<A, E = never, R = never>

  • #2006 b1e2086 Thanks @github-actions! - remove re-exports from platform packages

  • #2006 9a2d1c1 Thanks @github-actions! - This change enables Effect.serviceConstants and Effect.serviceMembers to access any constant in the service, not only the effects, namely it is now possible to do:

    import { Effect, Context } from "effect";
    
    class NumberRepo extends Context.TagClass("NumberRepo")<
      NumberRepo,
      {
        readonly numbers: Array<number>;
      }
    >() {
      static numbers = Effect.serviceConstants(NumberRepo).numbers;
    }

Patch Changes

Don't miss a new effect release

NewReleases is sending notifications on new releases.