O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

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

How it works...

Prism represents a traversal for a sum type. For a sum type, different alternatives are available for creating the data type. The Prism explores these alternatives. It also allows us to traverse to internals. Note the use of *_* for using makePrisms template. The generated prism will create a tupled representation (as we have the sum of product types). One can combine Prism and lens as Prism is a valid traversal. Similarly, we can also use over to change the internals of the data.

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