Practical

intermediate6 of 6

Learn about practical in fp-ts task

Code Editor

06-practical.exercise.ts

💻
Loading editor...
Preparing Monaco Editor with TypeScript support

Test Results

Requirements

describe('Task practical examples', () => {
  it('batch fetches cache entries', async () => {
    const result = await batchFetchCache(['a', 'b', 'c'])()
    expect(result).toEqual([
      { key: 'a', value: 'cached-a' },
      { key: 'b', value: 'cached-b' },
      { key: 'c', value: 'cached-c' },
    ])
  })

  it('executes task (retry example)', async () => {
    let count = 0
    const task: T.Task<number> = () => Promise.resolve(++count)
    const result = await retryWithDelay(task, 10, 3)()
    expect(result).toBeGreaterThan(0)
  })
})
🧪

Ready to Test?

Click "Run Tests" to see how your code performs

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