Skip to Content
Effective Haskell
book

Effective Haskell

by Rebecca Skinner
July 2023
Intermediate to advanced
670 pages
17h 13m
English
Pragmatic Bookshelf
Content preview from Effective Haskell

Exercises

Thinking About IO Types

  1. Write a function that returns a value of type IO (IO String). What happens if you try to use >>= with that? What if you want to print the string?

  2. Using your function from the previous example, create a function that has the type signature: IO (IO a) -> IO a.

  3. Write a function that returns a value of type [IO a], and a second function with the type [IO a] -> IO [a]. When might you use a function like that?

Building a Command Line Calculator

  1. Write a program that reads in numbers from the command line and prints the sum of the provided values.

  2. Modify your previous program so that the first argument is an operation (+, -, or *) and performs the supplied operation on the list of numbers.

Building a Word Replacement ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Grokking Functional Programming

Grokking Functional Programming

Michal Plachta
Grokking Algorithms

Grokking Algorithms

Aditya Bhargava
The Rust Programming Language, 2nd Edition

The Rust Programming Language, 2nd Edition

Steve Klabnik, Carol Nichols

Publisher Resources

ISBN: 9798888650400Errata Page