Effect.succeed
Create an Effect with a known value
This is a beginner-friendly course to get familiar with the Effect ecosystem. The aim of this course is to help you discover the most commonly used functions in the Effect libraries. The Effect docs are very thorough, but newcomers may find them overwhelming.
This course would make a great companion to other entry-level Effect courses. I really appreciated Sandro Maglione's course and Ethan Niser's workshop.
Effect consists of many libraries, each with many modules, each with many functions. In each lesson, we'll explore a single function. Thankfully, the most useful functions are often the simplest to understand.
Effect.succeed
Create an Effect with a known value
Effect.runSync
Execute an Effect synchronously, returning its value
Effect.sync
Create an Effect that defers execution
Effect.map
Transform the value inside an Effect
Effect.fail
Create an Effect that fails immediately
Effect.flatMap
Effectfully transform the value inside an Effect
pipe
Pass a value along a pipeline of functions
Effect.catchAll
Provide a fallback effect to use if something goes wrong
Effect.try
Attempt a synchronous operation that may fail
Effect.runPromise
Execute an Effect asynchronously, returning its value in a Promise
Effect.promise
Create an Effect that wraps an asynchronous computation
Effect.tryPromise
Wrap an asynchronous computation that may fail
Effect.catchTag
Handle a specific error based on tag
Data.TaggedError
Define a new type of error
Effect.gen
Use generator function syntax to write readable effect logic
Context.Tag
Define a tagged service for dependency injection
Effect.provideService
Provide a tagged service to the relevant effect
Effect.provideServiceEffect
Effectfully provide a tagged service to the relevant effect
Context.GenericTag
Define a Tag for use with Context
Context.add
Add a new item to an existing context
Context.get
Get a service from a context
Context.empty
Create an empty context
Context.make
Create a Context with one item
Context.merge
Combine two Contexts
Effect.provide
Provide multiple services with a single call
Layer.succeed
Construct a layer with a known value
Layer.effect
Construct a layer effectfully
Layer.succeedContext
Construct a layer from a Context
Layer.effectContext
Construct a layer effectfully from a whole context
Layer.fail
Construct a layer that will fail
Layer.map
Transform the context inside a Layer
Layer.merge
Combine layers to widen the input and output
Layer.provide
Combine layers by feeding outputs of one layer as inputs to another
Layer.empty
Combine layers by feeding outputs of one layer as inputs to another