Annotations overview
Added in v1.0.0
Table of contents
context
Tag
The Context
tag for Annotations
.
Signature
export declare const Tag: Context.Tag<Annotations>
Added in v1.0.0
live
Constructs a new Annotations
service.
Signature
export declare const live: () => Layer.Layer<never, never, Annotations>
Added in v1.0.0
models
Annotations (interface)
The Annotations
trait provides access to an annotation map that tests can add arbitrary annotations to. Each annotation consists of a string identifier, an initial value, and a function for combining two values. Annotations form monoids and you can think of Annotations
as a more structured logging service or as a super polymorphic version of the writer monad effect.
Signature
export interface Annotations extends Annotations.Proto {
/**
* Accesses an `Annotations` instance in the context and retrieves the
* annotation of the specified type, or its default value if there is none.
*/
get<A>(key: TestAnnotation.TestAnnotation<A>): Effect.Effect<never, never, A>
/**
* Accesses an `Annotations` instance in the context and appends the
* specified annotation to the annotation map.
*/
annotate<A>(key: TestAnnotation.TestAnnotation<A>, value: A): Effect.Effect<never, never, void>
/**
* Returns the set of all fibers in this test.
*/
supervisedFibers(): Effect.Effect<never, never, SortedSet.SortedSet<Fiber.RuntimeFiber<unknown, unknown>>>
}
Added in v1.0.0
refinements
isAnnotations
Returns true
if the specified value is an Annotations
, false
otherwise.
Signature
export declare const isAnnotations: (u: unknown) => u is Annotations
Added in v1.0.0
symbols
AnnotationsTypeId
Signature
export declare const AnnotationsTypeId: typeof AnnotationsTypeId
Added in v1.0.0
AnnotationsTypeId (type alias)
Signature
export type AnnotationsTypeId = typeof AnnotationsTypeId
Added in v1.0.0
utils
annotate
Accesses an Annotations
instance in the environment and appends the specified annotation to the annotation map.
Signature
export declare const annotate: <A>(
key: TestAnnotation.TestAnnotation<A>,
value: A
) => Effect.Effect<Annotations, never, void>
Added in v1.0.0
get
Accesses an Annotations
instance in the environment and retrieves the annotation of the specified type, or its default value if there is none.
Signature
export declare const get: <A>(key: TestAnnotation.TestAnnotation<A>) => Effect.Effect<Annotations, never, A>
Added in v1.0.0
supervisedFibers
Returns the set of all fibers in this test.
Signature
export declare const supervisedFibers: () => Effect.Effect<
Annotations,
never,
SortedSet.SortedSet<Fiber.RuntimeFiber<unknown, unknown>>
>
Added in v1.0.0