FuncType - v1.21.0
    Preparing search index...

    Variable Tag

    Tag: <S extends unknown>(id: string) => Tag<S>

    Creates a Tag for identifying a service type.

    Type Declaration

      • <S extends unknown>(id: string): Tag<S>
      • Type Parameters

        • S extends unknown

        Parameters

        • id: string

          Unique identifier for this tag (usually the service name)

        Returns Tag<S>

        A Tag that can be used to request the service

    interface Logger {
    log(message: string): void
    }

    const Logger = Tag<Logger>("Logger")

    // Now Logger can be used to request the Logger service
    const program = IO.service(Logger).flatMap(logger =>
    IO.sync(() => logger.log("Hello!"))
    )