Skip to Content
Get Programming with Haskell
book

Get Programming with Haskell

by Will Kurt
March 2018
Beginner
616 pages
16h 53m
English
Manning Publications
Content preview from Get Programming with Haskell

Lesson 17. Design by composition—Semigroups and Monoids

After reading lesson 17, you’ll be able to

  • Create new functions with function composition
  • Use Semigroup to mix colors
  • Learn how to use guards in code
  • Solve probability problems with Monoid

In the preceding lesson, you looked at how sum types allow you to think outside the typical hierarchical design patterns present in most programming languages. Another important way that Haskell diverges from traditional software design is with the idea of composability. Composability means that you create something new by combining two like things.

What does it mean to combine two things? Here are some examples: you can concatenate two lists and get a new list, you can combine two documents and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Get Programming with Go

Get Programming with Go

Nathan Youngman, Roger Peppe
Effective Haskell

Effective Haskell

Rebecca Skinner

Publisher Resources

ISBN: 9781617293764Publisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link