-
-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Micro: renaming to align with
Effect
module (#3096)
Co-authored-by: Tim <hello@timsmart.co>
- Loading branch information
Showing
7 changed files
with
1,043 additions
and
702 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,73 @@ | ||
--- | ||
"effect": patch | ||
--- | ||
|
||
Micro: align with `Effect` module (renamings and new combinators). | ||
|
||
General naming convention rule: `<reference module (start with lowercase)><api (start with Uppercase)>`. | ||
|
||
- `Failure` -> `MicroCause` | ||
- `Failure.Expected<E>` -> `MicroCause.Fail<E>` | ||
- `Failure.Unexpected` -> `MicroCause.Die` | ||
- `Failure.Aborted` -> `MicroCause.Interrupt` | ||
- `FailureExpected` -> `causeFail` | ||
- `FailureUnexpected` -> `causeDie` | ||
- `FailureAborted` -> `causeInterrupt` | ||
- `failureIsExpected` -> `causeIsFail` | ||
- `failureIsExpected` -> `causeIsFail` | ||
- `failureIsUnexpected` -> `causeIsDie` | ||
- `failureIsAborted` -> `causeIsInterrupt` | ||
- `failureSquash` -> `causeSquash` | ||
- `failureWithTrace` -> `causeWithTrace` | ||
- `Result` -> `MicroExit` | ||
- `ResultAborted` -> `exitInterrupt` | ||
- `ResultSuccess` -> `exitSucceed` | ||
- `ResultFail` -> `exitFail` | ||
- `ResultFailUnexpected` -> `exitDie` | ||
- `ResultFailWith` -> `exitFailCause` | ||
- `resultIsSuccess` -> `exitIsSuccess` | ||
- `resultIsFailure` -> `exitIsFailure` | ||
- `resultIsAborted` -> `exitIsInterrupt` | ||
- `resultIsFailureExpected` -> `exitIsFail` | ||
- `resultIsFailureUnexpected` -> `exitIsDie` | ||
- `resultVoid` -> `exitVoid` | ||
- `DelayFn` -> `MicroSchedule` | ||
- `delayExponential` -> `scheduleExponential` | ||
- `delaySpaced` -> `scheduleSpaced` | ||
- `delayWithMax` -> `scheduleWithMaxDelay` | ||
- `delayWithMaxElapsed` -> `scheduleWithMaxElapsed` | ||
- `delayWithRecurs` -> `scheduleRecurs` and make it a constructor | ||
- add `scheduleAddDelay` combinator | ||
- add `scheduleUnion` combinator | ||
- add `scheduleIntersect` combinator | ||
- `Handle` | ||
- `abort` -> `interrupt` | ||
- `unsafeAbort` -> `unsafeInterrupt` | ||
- `provideServiceMicro` -> `provideServiceEffect` | ||
- `fromResult` -> `fromExit` | ||
- `fromResultSync` -> `fromExitSync` | ||
- `failWith` -> `failCause` | ||
- `failWithSync` -> `failCauseSync` | ||
- `asResult` -> `exit` | ||
- `filterOrFailWith` -> `filterOrFailCause` | ||
- `repeatResult` -> `repeatExit` | ||
- `catchFailure` -> `catchAllCause` | ||
- `catchFailureIf` -> `catchCauseIf` | ||
- `catchExpected` -> `catchAll` | ||
- `catchUnexpected` -> `catchAllDefect` | ||
- `tapFailure` -> `tapErrorCause` | ||
- `tapFailureIf` -> `tapErrorCauseIf` | ||
- `tapExpected` -> `tapError` | ||
- `tapUnexpected` -> `tapDefect` | ||
- `mapFailure` -> `mapErrorCause` | ||
- `matchFailureMicro` -> `matchCauseEffect` | ||
- `matchFailure` -> `matchCause` | ||
- `matchMicro` -> `matchEffect` | ||
- `onResult` -> `onExit` | ||
- `onResultIf` -> `onExitIf` | ||
- `onFailure` -> `onError` | ||
- `onAbort` -> `onInterrupt` | ||
- `abort` -> `interrupt` | ||
- `runPromiseResult` -> `runPromiseExit` | ||
- `runSyncResult` -> `runSyncExit` | ||
- rename `delay` option to `schedule` |
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": patch | ||
--- | ||
|
||
Micro: rename `timeout` to `timeoutOption`, and add a `timeout` that fails with a `TimeoutException` |
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": patch | ||
--- | ||
|
||
Micro: move MicroExit types to a namespace |
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 @@ | ||
import { hole, Micro } from "effect" | ||
|
||
// ------------------------------------------------------------------------------------- | ||
// catchCauseIf | ||
// ------------------------------------------------------------------------------------- | ||
|
||
// $ExpectType Micro<number | Date, number | boolean, "a" | "b"> | ||
hole<Micro.Micro<number, string | number, "a">>().pipe(Micro.catchCauseIf( | ||
(cause): cause is Micro.MicroCause<string> => true, | ||
( | ||
_cause // $ExpectType MicroCause<string> | ||
) => hole<Micro.Micro<Date, boolean, "b">>() | ||
)) | ||
|
||
// $ExpectType Micro<number | Date, number | boolean, "a" | "b"> | ||
Micro.catchCauseIf( | ||
hole<Micro.Micro<number, string | number, "a">>(), | ||
(cause): cause is Micro.MicroCause<string> => true, | ||
( | ||
_cause // $ExpectType MicroCause<string> | ||
) => hole<Micro.Micro<Date, boolean, "b">>() | ||
) |
Oops, something went wrong.