Package: effect
Module: Effect
Retrieves an optional service from the context as an Option.
Details
This function retrieves a service from the context and wraps it in an
Option. If the service is available, it returns a Some containing the
service. If the service is not found, it returns a None. This approach is
useful when you want to handle the absence of a service gracefully without
causing an error.
When to Use
Use this function when:
Option type instead
of throwing an error.See
serviceOptional for a version that throws an error if the service is missing.Signature
declare const serviceOption: <I, S>(tag: Context.Tag<I, S>) => Effect<Option.Option<S>>
Since v2.0.0