Map

beginner3 of 8

Learn about map in fp-ts readertaskeither

Code Editor

03-map.exercise.ts

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

Test Results

Requirements

describe('ReaderTaskEither map', () => {
  const config: Config = { baseUrl: 'https://api.example.com' }

  it('builds API endpoint', async () => {
    const result = await buildApiEndpoint('/users')(config)()
    expect(E.isRight(result)).toBe(true)
    if (E.isRight(result)) {
      expect(result.right).toBe('https://api.example.com/users')
    }
  })

  it('gets URL length', async () => {
    const result = await getUrlLength()(config)()
    expect(E.isRight(result)).toBe(true)
    if (E.isRight(result)) {
      expect(result.right).toBe(23)
    }
  })
})
🧪

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