@effect/data
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -10,2 +10,3 @@ /** | ||
*/ | ||
import type { SourceLocation, Trace } from "@effect/data/Debug"; | ||
import type { Equal } from "@effect/data/Equal"; | ||
@@ -29,6 +30,17 @@ import type { Option } from "@effect/data/Option"; | ||
}; | ||
traced(this: Tag<Identifier, Service>, trace: Trace): TracedTag<Identifier, Service> | Tag<Identifier, Service>; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
* @category models | ||
*/ | ||
export interface TracedTag<Identifier, Service> { | ||
readonly _tag: "Traced"; | ||
readonly i0: Tag<Identifier, Service> | TracedTag<Identifier, Service>; | ||
readonly trace: SourceLocation; | ||
traced(this: TracedTag<Identifier, Service>, trace: Trace): TracedTag<Identifier, Service>; | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare namespace Tag { | ||
@@ -58,3 +70,3 @@ type Service<T extends Tag<any, any>> = T extends Tag<any, infer A> ? A : never; | ||
*/ | ||
export declare const Tag: <Service, Identifier = Service>(key?: unknown) => Tag<Service, Identifier>; | ||
export declare const Tag: <Identifier, Service = Identifier>(key?: unknown) => Tag<Identifier, Service>; | ||
declare const TypeId: unique symbol; | ||
@@ -61,0 +73,0 @@ /** |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.unsafeGet = exports.pick = exports.merge = exports.make = exports.isTag = exports.isContext = exports.getOption = exports.get = exports.empty = exports.add = exports.TagTypeId = exports.TagImpl = exports.ContextTypeId = exports.ContextImpl = void 0; | ||
var _Debug = /*#__PURE__*/require("@effect/data/Debug"); | ||
var Equal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Equal")); | ||
@@ -51,2 +52,8 @@ var Dual = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Function")); | ||
} | ||
traced(trace) { | ||
if (trace) { | ||
return (0, _Debug.makeTraced)(this, trace); | ||
} | ||
return this; | ||
} | ||
} | ||
@@ -53,0 +60,0 @@ /** @internal */ |
{ | ||
"name": "@effect/data", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -10,2 +10,3 @@ /** | ||
*/ | ||
import type { SourceLocation, Trace } from "@effect/data/Debug" | ||
import type { Equal } from "@effect/data/Equal" | ||
@@ -33,2 +34,6 @@ import * as C from "@effect/data/internal/Context" | ||
} | ||
traced( | ||
this: Tag<Identifier, Service>, | ||
trace: Trace | ||
): TracedTag<Identifier, Service> | Tag<Identifier, Service> | ||
} | ||
@@ -38,3 +43,17 @@ | ||
* @since 1.0.0 | ||
* @category models | ||
*/ | ||
export interface TracedTag<Identifier, Service> { | ||
readonly _tag: "Traced" | ||
readonly i0: Tag<Identifier, Service> | TracedTag<Identifier, Service> | ||
readonly trace: SourceLocation | ||
traced( | ||
this: TracedTag<Identifier, Service>, | ||
trace: Trace | ||
): TracedTag<Identifier, Service> | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare namespace Tag { | ||
@@ -65,3 +84,3 @@ type Service<T extends Tag<any, any>> = T extends Tag<any, infer A> ? A : never | ||
*/ | ||
export const Tag = <Service, Identifier = Service>(key?: unknown): Tag<Service, Identifier> => new C.TagImpl(key) | ||
export const Tag = <Identifier, Service = Identifier>(key?: unknown): Tag<Identifier, Service> => new C.TagImpl(key) | ||
@@ -68,0 +87,0 @@ const TypeId: unique symbol = C.ContextTypeId as TypeId |
import type * as C from "@effect/data/Context" | ||
import type { Trace } from "@effect/data/Debug" | ||
import { makeTraced } from "@effect/data/Debug" | ||
import * as Equal from "@effect/data/Equal" | ||
@@ -46,2 +48,8 @@ import * as Dual from "@effect/data/Function" | ||
} | ||
traced(this: this, trace: Trace): C.TracedTag<Identifier, Service> | this { | ||
if (trace) { | ||
return makeTraced(this, trace) | ||
} | ||
return this | ||
} | ||
} | ||
@@ -48,0 +56,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3562809
666
75944