Basic Io

beginner1 of 7

Learn about basic io in fp-ts io

Code Editor

01-basic-io.exercise.ts

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

Test Results

Requirements

describe('IO basic', () => {
  it('gets current time', () => {
    const io = getCurrentTime()
    const time1 = io()
    const time2 = io()
    expect(typeof time1).toBe('number')
    expect(time2).toBeGreaterThanOrEqual(time1)
  })

  it('gets random number', () => {
    const io = getRandomNumber()
    const num = io()
    expect(typeof num).toBe('number')
    expect(num).toBeGreaterThanOrEqual(0)
    expect(num).toBeLessThan(1)
  })
})
🧪

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