MCPcopy Create free account

hub / github.com/antoine-coulon/effect-introduction / functions

Functions48 in github.com/antoine-coulon/effect-introduction

↓ 2 callersFunctionasMillis
(duration: DurationValue)
src/03-resilience.ts:408
↓ 2 callersFunctionfetchUser
(id: number)
src/05-concurrency.ts:12
↓ 2 callersFunctionrun
(program: Effect.Effect<R, E, A>)
src/06-runtime.ts:202
↓ 1 callersFunctionbackgroundJobWithCancellationWithNoLeaks
* However we are still leaking something now that we added a listener to the * "abort" event. The listener will be kept in memory until the signal is
src/03-resilience.ts:275
↓ 1 callersFunctioncancellableTimeout1
()
src/03-resilience.ts:201
↓ 1 callersFunctioncancellableTimeout2
()
src/03-resilience.ts:207
↓ 1 callersFunctiondoSomethingAsync
* ---------------------------- * 1. Asynchronous computations * ---------------------------- * * Asynchronous computations are usually modeled in
src/01-explicitness.ts:142
↓ 1 callersFunctionisSomeErrorException
(exception: unknown)
src/01-explicitness.ts:88
↓ 1 callersFunctionisSomeOtherErrorException
( exception: unknown )
src/01-explicitness.ts:92
↓ 1 callersFunctionretry
( computation: () => Promise<void>, times = 1 )
src/03-resilience.ts:31
↓ 1 callersFunctionretryUntil
( computation: () => Promise<void>, times = 1, shouldRetry: (e: unknown) => boolean )
src/03-resilience.ts:65
↓ 1 callersFunctiontest
* Let's just add some boilerplate to emulate a test runner
src/02-testing.ts:21
FunctionbackgroundJob
()
src/03-resilience.ts:219
FunctionbackgroundJobProgram
()
src/03-resilience.ts:311
FunctionbackgroundJobWithCancellation
* What about being able to cancel the background job from the outside?
src/03-resilience.ts:236
FunctionblindlyCatch
()
src/01-explicitness.ts:98
FunctionbusinessUseCase
* Retrying is a core part of resilience and it is a very common pattern to recover * from errors. However, each system has its own set of constraints
src/03-resilience.ts:27
FunctionbusinessUseCaseWithFailureVariants
* Great, we are able to retry the computation as many times as we want! But what * if we want to retry both X times but also on a specific condition?
src/03-resilience.ts:57
FunctioncomputeEffect
()
src/06-runtime.ts:6
FunctioncomputePromise
()
src/06-runtime.ts:12
Methodconstructor
(readonly id: number)
src/04-composability.ts:13
Methodconstructor
(readonly id: number)
src/04-composability.ts:18
Methodconstructor
()
src/01-explicitness.ts:76
Methodconstructor
()
src/01-explicitness.ts:82
FunctiondefensiveMultiplyNumber
* This behavior can be the root cause of many problems including defensive coding, * for instance:
src/01-explicitness.ts:59
FunctionfindUserById
(id: number)
src/01-explicitness.ts:290
FunctiongenerateRandomNumber
()
src/01-explicitness.ts:24
FunctiongenerateRandomNumberWithImplementation
()
src/01-explicitness.ts:44
FunctionleakingRace
()
src/03-resilience.ts:186
FunctionlongRunningPromise
()
src/05-concurrency.ts:38
FunctionmainFeatureFlagProgram
()
src/01-explicitness.ts:662
FunctionmainProgram
()
src/01-explicitness.ts:637
Functionmain_1
()
src/01-explicitness.ts:29
Functionmain_2
()
src/01-explicitness.ts:150
FunctionmakeRace
* One better way of doing that would be to use the `AbortController` Web API * that allows us to provide signal to asynchronous computations, and sig
src/03-resilience.ts:197
FunctionmultiplyNumberWhenDealingWithError
()
src/01-explicitness.ts:355
FunctionmultiplyNumberWithExhaustivePatternMatching
* Now that we have failures represented as a union, it allows us to pattern match * and recover from either specific failures or all failures. Depend
src/01-explicitness.ts:478
FunctionmultiplyNumberWithPartialPatternMatching
()
src/01-explicitness.ts:494
FunctionmultiplyNumberWithoutDealingWithError
* In the following function, see how we write the return type of the function as * an Effect that can't fail with an expected error (modeled by the `
src/01-explicitness.ts:345
Functionprogram
(ids: number[])
src/04-composability.ts:44
FunctionprogramWithRetryUntil
()
src/03-resilience.ts:86
FunctionprogramWithSimpleRetry
()
src/03-resilience.ts:45
FunctionquickRunningPromise
* RESOURCE MANAGEMENT
src/05-concurrency.ts:32
FunctionregisterUser
()
src/01-explicitness.ts:538
FunctionretrieveAllUsers
()
src/05-concurrency.ts:16
FunctionrunCallback
const result = run(simpleProgram); console.log({ syncResult: result });
src/06-runtime.ts:231
FunctionrunPromise
runCallback(simpleProgram, (result) => { console.log({ cbResult: result }); });
src/06-runtime.ts:244
FunctionuserProgram
()
src/01-explicitness.ts:588