@effect/platform 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Console.ts DELETED
@@ -1,165 +0,0 @@
1
- /**
2
- * @since 1.0.0
3
- */
4
- import type * as Context from "@effect/data/Context"
5
- import type { Effect } from "@effect/io/Effect"
6
- import type { Layer } from "@effect/io/Layer"
7
- import type { Scope } from "@effect/io/Scope"
8
- import * as internal from "@effect/platform/internal/console"
9
-
10
- /**
11
- * @since 1.0.0
12
- * @category model
13
- */
14
- export interface Console {
15
- assert(condition: boolean, ...args: ReadonlyArray<any>): Effect<never, never, void>
16
- clear(): Effect<never, never, void>
17
- count(label?: string): Effect<never, never, void>
18
- countReset(label?: string): Effect<never, never, void>
19
- debug(...args: ReadonlyArray<any>): Effect<never, never, void>
20
- dir(...args: ReadonlyArray<any>): Effect<never, never, void>
21
- dirxml(...args: ReadonlyArray<any>): Effect<never, never, void>
22
- error(...args: ReadonlyArray<any>): Effect<never, never, void>
23
- group(options?: {
24
- readonly label?: string
25
- readonly collapsed?: boolean
26
- }): Effect<Scope, never, void>
27
- info(...args: ReadonlyArray<any>): Effect<never, never, void>
28
- log(...args: ReadonlyArray<any>): Effect<never, never, void>
29
- table(tabularData: any, properties?: ReadonlyArray<string>): Effect<never, never, void>
30
- time(label?: string): Effect<Scope, never, void>
31
- timeLog(label?: string, ...args: ReadonlyArray<any>): Effect<never, never, void>
32
- trace(...args: ReadonlyArray<any>): Effect<never, never, void>
33
- warn(...args: ReadonlyArray<any>): Effect<never, never, void>
34
- withGroup(options?: {
35
- readonly label?: string
36
- readonly collapsed?: boolean
37
- }): <R, E, A>(self: Effect<R, E, A>) => Effect<R, E, A>
38
- withTime(label?: string): <R, E, A>(self: Effect<R, E, A>) => Effect<R, E, A>
39
- }
40
-
41
- /**
42
- * @since 1.0.0
43
- * @category tag
44
- */
45
- export const Console: Context.Tag<Console, Console> = internal.Console
46
-
47
- /**
48
- * @since 1.0.0
49
- * @category layer
50
- */
51
- export const layer: Layer<never, never, Console> = internal.layer
52
-
53
- /**
54
- * @since 1.0.0
55
- * @category accessor
56
- */
57
- export const assert: (condition: boolean, ...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.assert
58
-
59
- /**
60
- * @since 1.0.0
61
- * @category accessor
62
- */
63
- export const clear: () => Effect<Console, never, void> = internal.clear
64
-
65
- /**
66
- * @since 1.0.0
67
- * @category accessor
68
- */
69
- export const count: (label?: string) => Effect<Console, never, void> = internal.count
70
-
71
- /**
72
- * @since 1.0.0
73
- * @category accessor
74
- */
75
- export const countReset: (label?: string) => Effect<Console, never, void> = internal.countReset
76
-
77
- /**
78
- * @since 1.0.0
79
- * @category accessor
80
- */
81
- export const debug: (...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.debug
82
-
83
- /**
84
- * @since 1.0.0
85
- * @category accessor
86
- */
87
- export const dir: (...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.dir
88
-
89
- /**
90
- * @since 1.0.0
91
- * @category accessor
92
- */
93
- export const dirxml: (...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.dirxml
94
-
95
- /**
96
- * @since 1.0.0
97
- * @category accessor
98
- */
99
- export const error: (...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.error
100
-
101
- /**
102
- * @since 1.0.0
103
- * @category accessor
104
- */
105
- export const group: (
106
- options?: { label?: string; collapsed?: boolean }
107
- ) => Effect<Console | Scope, never, void> = internal.group
108
-
109
- /**
110
- * @since 1.0.0
111
- * @category accessor
112
- */
113
- export const info: (...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.info
114
-
115
- /**
116
- * @since 1.0.0
117
- * @category accessor
118
- */
119
- export const log: (...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.log
120
-
121
- /**
122
- * @since 1.0.0
123
- * @category accessor
124
- */
125
- export const table: (tabularData: any, properties?: ReadonlyArray<string>) => Effect<Console, never, void> =
126
- internal.table
127
-
128
- /**
129
- * @since 1.0.0
130
- * @category accessor
131
- */
132
- export const time: (label?: string) => Effect<Console | Scope, never, void> = internal.time
133
-
134
- /**
135
- * @since 1.0.0
136
- * @category accessor
137
- */
138
- export const timeLog: (label?: string, ...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.timeLog
139
-
140
- /**
141
- * @since 1.0.0
142
- * @category accessor
143
- */
144
- export const trace: (...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.trace
145
-
146
- /**
147
- * @since 1.0.0
148
- * @category accessor
149
- */
150
- export const warn: (...args: ReadonlyArray<any>) => Effect<Console, never, void> = internal.warn
151
-
152
- /**
153
- * @since 1.0.0
154
- * @category accessor
155
- */
156
- export const withGroup: (
157
- options?: { label?: string; collapsed?: boolean }
158
- ) => <R, E, A>(self: Effect<R, E, A>) => Effect<Console | R, E, A> = internal.withGroup
159
-
160
- /**
161
- * @since 1.0.0
162
- * @category accessor
163
- */
164
- export const withTime: (label?: string) => <R, E, A>(self: Effect<R, E, A>) => Effect<Console | R, E, A> =
165
- internal.withTime
@@ -1,183 +0,0 @@
1
- import { Tag } from "@effect/data/Context"
2
- import * as Effect from "@effect/io/Effect"
3
- import * as Layer from "@effect/io/Layer"
4
- import type { Console as Console_ } from "@effect/platform/Console"
5
-
6
- /**
7
- * @since 1.0.0
8
- * @category tag
9
- */
10
- export const Console = Tag<Console_>("@effect/platform/Console")
11
-
12
- /** @internal */
13
- const consoleImpl = Console.of({
14
- assert(condition, ...args) {
15
- return Effect.sync(() => {
16
- console.assert(condition, ...args)
17
- })
18
- },
19
- clear() {
20
- return Effect.sync(() => {
21
- console.clear()
22
- })
23
- },
24
- count(label) {
25
- return Effect.sync(() => {
26
- console.count(label)
27
- })
28
- },
29
- countReset(label) {
30
- return Effect.sync(() => {
31
- console.countReset(label)
32
- })
33
- },
34
- debug(...args) {
35
- return Effect.sync(() => {
36
- console.debug(...args)
37
- })
38
- },
39
- dir(...args) {
40
- return Effect.sync(() => {
41
- console.dir(...args)
42
- })
43
- },
44
- dirxml(...args) {
45
- return Effect.sync(() => {
46
- console.dirxml(...args)
47
- })
48
- },
49
- error(...args) {
50
- return Effect.sync(() => {
51
- console.error(...args)
52
- })
53
- },
54
- group(options) {
55
- return Effect.acquireRelease(
56
- options?.collapsed ?
57
- Effect.sync(() => console.groupCollapsed(options?.label)) :
58
- Effect.sync(() => console.group(options?.label)),
59
- () => Effect.sync(() => console.groupEnd())
60
- )
61
- },
62
- info(...args) {
63
- return Effect.sync(() => {
64
- console.info(...args)
65
- })
66
- },
67
- log(...args) {
68
- return Effect.sync(() => {
69
- console.log(...args)
70
- })
71
- },
72
- table(tabularData, properties) {
73
- return Effect.sync(() => {
74
- console.table(tabularData, properties)
75
- })
76
- },
77
- time(label) {
78
- return Effect.acquireRelease(
79
- Effect.sync(() => console.time(label)),
80
- () => Effect.sync(() => console.timeEnd(label))
81
- )
82
- },
83
- timeLog(label, ...args) {
84
- return Effect.sync(() => {
85
- console.timeLog(label, ...args)
86
- })
87
- },
88
- trace(...args) {
89
- return Effect.sync(() => {
90
- console.trace(...args)
91
- })
92
- },
93
- warn(...args) {
94
- return Effect.sync(() => {
95
- console.warn(...args)
96
- })
97
- },
98
- withGroup(options) {
99
- return (self) =>
100
- Effect.acquireUseRelease(
101
- options?.collapsed ?
102
- Effect.sync(() => console.groupCollapsed(options?.label)) :
103
- Effect.sync(() => console.group(options?.label)),
104
- () => self,
105
- () => Effect.sync(() => console.groupEnd())
106
- )
107
- },
108
- withTime(label) {
109
- return (self) =>
110
- Effect.acquireUseRelease(
111
- Effect.sync(() => console.time(label)),
112
- () => self,
113
- () => Effect.sync(() => console.timeEnd(label))
114
- )
115
- }
116
- })
117
-
118
- /** @internal */
119
- export const layer = Layer.succeed(Console, consoleImpl)
120
-
121
- /** @internal */
122
- export const assert = (condition: boolean, ...args: ReadonlyArray<any>) =>
123
- Effect.flatMap(Console, (_) => _.assert(condition, ...args))
124
-
125
- /** @internal */
126
- export const clear = () => Effect.flatMap(Console, (_) => _.clear())
127
-
128
- /** @internal */
129
- export const count = (label?: string) => Effect.flatMap(Console, (_) => _.count(label))
130
-
131
- /** @internal */
132
- export const countReset = (label?: string) => Effect.flatMap(Console, (_) => _.countReset(label))
133
-
134
- /** @internal */
135
- export const debug = (...args: ReadonlyArray<any>) => Effect.flatMap(Console, (_) => _.debug(...args))
136
-
137
- /** @internal */
138
- export const dir = (...args: ReadonlyArray<any>) => Effect.flatMap(Console, (_) => _.dir(...args))
139
-
140
- /** @internal */
141
- export const dirxml = (...args: ReadonlyArray<any>) => Effect.flatMap(Console, (_) => _.dirxml(...args))
142
-
143
- /** @internal */
144
- export const error = (...args: ReadonlyArray<any>) => Effect.flatMap(Console, (_) => _.error(...args))
145
-
146
- /** @internal */
147
- export const group = (options?: { label?: string; collapsed?: boolean }) =>
148
- Effect.flatMap(Console, (_) => _.group(options))
149
-
150
- /** @internal */
151
- export const info = (...args: ReadonlyArray<any>) => Effect.flatMap(Console, (_) => _.info(...args))
152
-
153
- /** @internal */
154
- export const log = (...args: ReadonlyArray<any>) => Effect.flatMap(Console, (_) => _.log(...args))
155
-
156
- /** @internal */
157
- export const table = (tabularData: any, properties?: ReadonlyArray<string>) =>
158
- Effect.flatMap(Console, (_) => _.table(tabularData, properties))
159
-
160
- /** @internal */
161
- export const time = (label?: string) => Effect.flatMap(Console, (_) => _.time(label))
162
-
163
- /** @internal */
164
- export const timeLog = (label?: string, ...args: ReadonlyArray<any>) =>
165
- Effect.flatMap(Console, (_) => _.timeLog(label, ...args))
166
-
167
- /** @internal */
168
- export const trace = (...args: ReadonlyArray<any>) => Effect.flatMap(Console, (_) => _.trace(...args))
169
-
170
- /** @internal */
171
- export const warn = (...args: ReadonlyArray<any>) => Effect.flatMap(Console, (_) => _.warn(...args))
172
-
173
- /** @internal */
174
- export const withGroup = (options?: { label?: string; collapsed?: boolean }) =>
175
- <R, E, A>(
176
- self: Effect.Effect<R, E, A>
177
- ) => Effect.flatMap(Console, (_) => _.withGroup(options)(self))
178
-
179
- /** @internal */
180
- export const withTime = (label?: string) =>
181
- <R, E, A>(
182
- self: Effect.Effect<R, E, A>
183
- ) => Effect.flatMap(Console, (_) => _.withTime(label)(self))