Parallel
Learn about parallel in fp-ts readertaskeither
Code Editor
07-parallel.exercise.ts
💻
Loading editor...
Preparing Monaco Editor with TypeScript support
Test Results
Requirements
describe('ReaderTaskEither parallel', () => {
const config: Config = {
users: { 1: 'Alice', 2: 'Bob', 3: 'Charlie' },
}
it('fetches all users in parallel', async () => {
const result = await fetchAllUsers([1, 2, 3])(config)()
expect(E.isRight(result)).toBe(true)
if (E.isRight(result)) {
expect(result.right).toEqual(['Alice', 'Bob', 'Charlie'])
}
})
it('fetches three users as tuple', async () => {
const result = await fetchThreeUsers(1, 2, 3)(config)()
expect(E.isRight(result)).toBe(true)
if (E.isRight(result)) {
expect(result.right).toEqual(['Alice', 'Bob', 'Charlie'])
}
})
it('fails if any user not found', async () => {
const result = await fetchAllUsers([1, 999, 3])(config)()
expect(E.isLeft(result)).toBe(true)
})
})🧪
Ready to Test?
Click "Run Tests" to see how your code performs
Quick Tips
•Read the TODO comments in the code
•Use Reset to restore original code
•Check Solution if stuck
Pro Tips
💡 Stuck? Here's what to try:
- • Read the comments in the code carefully
- • Run tests frequently to get feedback
- • Check the fp-ts documentation
- • Use the solution if you need help
🚀 Learning Approach:
- • Focus on understanding, not just solving
- • Experiment with different approaches
- • Think about real-world applications
- • Build on previous exercises