Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Haskell Design Patterns

You're reading from   Haskell Design Patterns Take your Haskell and functional programming skills to the next level by exploring new idioms and design patterns

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781783988723
Length 166 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ryan Lemmer Ryan Lemmer
Author Profile Icon Ryan Lemmer
Ryan Lemmer
Arrow right icon
View More author details
Toc

Chapter 2. Patterns for I/O

 

"I believe that the monadic approach to programming, in which actions are first class values, is itself interesting, beautiful and modular. In short, Haskell is the world's finest imperative programming language"

 
 --Tackling the Awkward Squad, Simon Peyton Jones

It is remarkable that we can do side-effecting I/O in a pure functional language!

We start this chapter by establishing I/O as a first-class citizen of Haskell. A the bulk of this chapter is concerned with exploring three styles of I/O programming in Haskell.

We start with the most naïve style: imperative style. From there, we move on to the elegant and concise "lazy I/O", only to run into its severe limitations. The way out is the third and last style we explore: iteratee I/O.

As a binding thread, we carry a simple I/O example through all three styles. We will cover the following topics:

  • I/O as a first-class citizen
  • Imperative I/O
  • Lazy I/O
  • The problem with...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime