I just purchased “Lenses for the Mere Mortal” and read the first few chapters. I’m interested in viewing and updating sum types, so I looked forward to reading Chapter 6 on prisms. However, chapter 6 appears to be blank. Not sure if that is an error or if the author just hasn’t gotten to them yet. In any case, I’ve been studying Data.Lens.Prism in Purescript, and I understand ‘review’ and ‘preview’. But what is a way to use prisms to update a sum type, something like an ‘over’ lens?
Yeah, you can use
over with a
Prism too! (virtually every (polymorphic) type of optic, excluding
Getter, will work with
Prisms chapter is partly done. Paying work has been getting in the way.
Thanks, Brian. You are a great writer! Much appreciated. It’s a good level for me… enough years of programming to be confident, usually – but not enough FP to feel confident in the slightest around the more esoteric Purescript/Haskell topics. I just think FP is cool and so I’ll keep trying.