klequis / zz-haskell-notebook

Notes from learning Haskell
1 stars 0 forks source link

Pattern matching #62

Open klequis opened 2 years ago

klequis commented 2 years ago

Pattern matching is a syntactic way of deconstructing product and sum types to get at their inhabitants.

With respect to products, pattern matching gives you the means for destructuring and exposing the contents of products, binding one or more values contained therein to names.

With sums, pattern matching lets you discriminate which inhabitant of a sum you mean to handle in that match.

See page 270 for more on this subject

klequis commented 2 years ago

Improvement needed: