-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: ecyrbe <ecyrbe@gmail.com> Co-authored-by: Giulio Canti <giulio.canti@gmail.com> Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co> Co-authored-by: Dmitry <dilame@users.noreply.github.com> Co-authored-by: Tim <hello@timsmart.co> Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com> Co-authored-by: Milan Suk <Milansuk@email.cz> Co-authored-by: Vincent François <vincent.francois@inato.com> Co-authored-by: Tim Smart <tim.smart@arisechurch.com> Co-authored-by: Maxim Khramtsov <khraks.mamtsov@gmail.com> Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
- Loading branch information
1 parent
d12ec65
commit 9c058c9
Showing
88 changed files
with
4,753 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
make List.Cons extend NonEmptyIterable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
add DateTime module | ||
|
||
The `DateTime` module provides functionality for working with time, including | ||
support for time zones and daylight saving time. | ||
|
||
It has two main data types: `DateTime.Utc` and `DateTime.Zoned`. | ||
|
||
A `DateTime.Utc` represents a time in Coordinated Universal Time (UTC), and | ||
a `DateTime.Zoned` contains both a UTC timestamp and a time zone. | ||
|
||
There is also a `CurrentTimeZone` service, for setting a time zone contextually. | ||
|
||
```ts | ||
import { DateTime, Effect } from "effect"; | ||
|
||
Effect.gen(function* () { | ||
// Get the current time in the current time zone | ||
const now = yield* DateTime.nowInCurrentZone; | ||
|
||
// Math functions are included | ||
const tomorrow = DateTime.add(now, 1, "day"); | ||
|
||
// Convert to a different time zone | ||
// The UTC portion of the `DateTime` is preserved and only the time zone is | ||
// changed | ||
const sydneyTime = tomorrow.pipe( | ||
DateTime.unsafeSetZoneNamed("Australia/Sydney"), | ||
); | ||
}).pipe(DateTime.withCurrentZoneNamed("America/New_York")); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@effect/sql-mssql": patch | ||
--- | ||
|
||
make mssql placeholder format compatible with kysely |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
add Stream.asyncPush api | ||
|
||
This api creates a stream from an external push-based resource. | ||
|
||
You can use the `emit` helper to emit values to the stream. You can also use | ||
the `emit` helper to signal the end of the stream by using apis such as | ||
`emit.end` or `emit.fail`. | ||
|
||
By default it uses an "unbounded" buffer size. | ||
You can customize the buffer size and strategy by passing an object as the | ||
second argument with the `bufferSize` and `strategy` fields. | ||
|
||
```ts | ||
import { Effect, Stream } from "effect"; | ||
|
||
Stream.asyncPush<string>( | ||
(emit) => | ||
Effect.acquireRelease( | ||
Effect.gen(function* () { | ||
yield* Effect.log("subscribing"); | ||
return setInterval(() => emit.single("tick"), 1000); | ||
}), | ||
(handle) => | ||
Effect.gen(function* () { | ||
yield* Effect.log("unsubscribing"); | ||
clearInterval(handle); | ||
}), | ||
), | ||
{ bufferSize: 16, strategy: "dropping" }, | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Implement Struct.keys as a typed alternative to Object.keys | ||
|
||
```ts | ||
import { Struct } from "effect" | ||
|
||
const symbol: unique symbol = Symbol() | ||
|
||
const value = { | ||
a: 1, | ||
b: 2, | ||
[symbol]: 3 | ||
} | ||
|
||
const keys: Array<"a" | "b"> = Struct.keys(value) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@effect/sql-kysely": patch | ||
--- | ||
|
||
Add kysely support with @effect/sql-kysely package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Add `Random.choice`. | ||
|
||
```ts | ||
import { Random } from "effect" | ||
|
||
Effect.gen(function* () { | ||
const randomItem = yield* Random.choice([1, 2, 3]) | ||
console.log(randomItem) | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Add onlyEffect option to Effect.tap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Support `Refinement` in `Predicate.tuple` and `Predicate.struct` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@effect/schema": patch | ||
--- | ||
|
||
add schemas for working with the DateTime module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Implement `Stream.onEnd` that adds an effect to be executed at the end of the stream. | ||
|
||
```ts | ||
import { Console, Effect, Stream } from "effect"; | ||
|
||
const stream = Stream.make(1, 2, 3).pipe( | ||
Stream.map((n) => n * 2), | ||
Stream.tap((n) => Console.log(`after mapping: ${n}`)), | ||
Stream.onEnd(Console.log("Stream ended")) | ||
) | ||
|
||
Effect.runPromise(Stream.runCollect(stream)).then(console.log) | ||
// after mapping: 2 | ||
// after mapping: 4 | ||
// after mapping: 6 | ||
// Stream ended | ||
// { _id: 'Chunk', values: [ 2, 4, 6 ] } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
Implement `Stream.onStart` that adds an effect to be executed at the start of the stream. | ||
|
||
```ts | ||
import { Console, Effect, Stream } from "effect"; | ||
|
||
const stream = Stream.make(1, 2, 3).pipe( | ||
Stream.onStart(Console.log("Stream started")), | ||
Stream.map((n) => n * 2), | ||
Stream.tap((n) => Console.log(`after mapping: ${n}`)) | ||
) | ||
|
||
Effect. runPromise(Stream. runCollect(stream)).then(console. log) | ||
// Stream started | ||
// after mapping: 2 | ||
// after mapping: 4 | ||
// after mapping: 6 | ||
// { _id: 'Chunk', values: [ 2, 4, 6 ] } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
add `bufferSize` option to Stream.fromEventListener |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@effect/platform": patch | ||
"effect": minor | ||
"@effect/cli": patch | ||
"@effect/rpc": patch | ||
--- | ||
|
||
Changed various function signatures to return `Array` instead of `ReadonlyArray` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type * as Array from "../src/Array.js" | ||
import type { Chunk } from "../src/index.js" | ||
import * as Random from "../src/Random.js" | ||
|
||
declare const array: Array<number> | ||
declare const nonEmptyArray: Array.NonEmptyArray<number> | ||
|
||
// $ExpectType Effect<number, NoSuchElementException, never> | ||
Random.choice(array) | ||
|
||
// $ExpectType Effect<number, never, never> | ||
Random.choice(nonEmptyArray) | ||
|
||
declare const readonlyArray: Array<number> | ||
declare const nonEmptyReadonlyArray: Array.NonEmptyArray<number> | ||
|
||
// $ExpectType Effect<number, NoSuchElementException, never> | ||
Random.choice(readonlyArray) | ||
|
||
// $ExpectType Effect<number, never, never> | ||
Random.choice(nonEmptyReadonlyArray) | ||
|
||
declare const chunk: Chunk.Chunk<number> | ||
declare const nonEmptyChunk: Chunk.NonEmptyChunk<number> | ||
|
||
// $ExpectType Effect<number, NoSuchElementException, never> | ||
Random.choice(chunk) | ||
|
||
// $ExpectType Effect<number, never, never> | ||
Random.choice(nonEmptyChunk) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.