O'Reilly logo

The Haskell School of Expression by Paul Hudak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER FOURTEEN

Programming With Streams

 

 

 

 

 

Recall that in Chapter 6 we used an infinite list to simulate a mathematical sequence used in the calculation of the perimeter of an ellipse. When a list is used in a context where it will always be infinite, it is commonly called a stream. Many problems can be elegantly, concisely, and efficiently expressed using streams, which we will explore in this chapter. With the power of streams there are also inherent dangers, which we will also explore. In the next chapter we will use streams in a central way in the implementation of a language for expressing reactive animations.

14.1 Lazy Evaluation

Because streams are never finite, it would seem natural to define a special polymorphic data type ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required