[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-135842-en":3,"doc-seo-135842-105":30,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":27,"seo_description":14,"update_tm":28,"read_time":29},135842,2336475401981,"Chumphorn","https://ap-avatar.wpscdn.com/avatar/22000c94efd8d5204d?x-image-process=image/resize,m_fixed,w_180,h_180&k=1786935347598174694",6,"Technology","Scala with Cats - A Practical Introduction to Type Classes, Functors, Monoids, and Monads","Scala with Cats presents an in-depth, practical introduction to core functional programming abstractions using the Cats library. The material builds from the anatomy of type classes and implicit mechanisms, then develops algebraic structures such as monoids and semigroups. It proceeds to functors (including higher-kinded concepts and variance), and advances to monads with Cats implementations and key monadic patterns. Exercises and examples reinforce instance definitions, syntax, and instance selection for real Scala code design.","Scala with Cats  \nNovember 2017  \nCopyright 2014-17 Noel Welsh and Dave Gurnell. CC-BY-SA 3 .0.  \nArtwork by Jenny Clements.  \nPublished by Underscore Consulঞng LLP, Brighton, UK.  \nContents  \nPreface 1  \nVersions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2  \nTemplate Projects . . . . . . . . . . . . . . . . . . . . . . . 2  \nConvenঞons Used in This Book . . . . . . . . . . . . . . . . . . . 3  \nTypographical Convenঞons . . . . . . . . . . . . . . . . . . 3  \nSource Code . . . . . . . . . . . . . . . . . . . . . . . . . . 3  \nCallout Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . 4  \nAcknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . 4  \nBackers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5  \nPart I. Theory 7  \n1 Introducঞon 9  \n1. 1 Anatomy of a Type Class . . . . . . . . . . . . . . . . . . . . 10  \n1.1. 1 The Type Class . . . . . . . . . . . . . . . . . . . . . 10  \n1.1.2 Type Class Instances . . . . . . . . . . . . . . . . . . 10  \n1.1.3 Type Class Interfaces . . . . . . . . . . . . . . . . . . 11  \n1.2 Working with Implicits . . . . . . . . . . . . . . . . . . . . . 13  \n1.2. 1 Packaging Implicits . . . . . . . . . . . . . . . . . . . 13  \n1.2.2 Implicit Scope . . . . . . . . . . . . . . . . . . . . . . 14  \n1.2.3 Recursive Implicit Resoluঞon . . . . . . . . . . . . . . 15  \n1.3 Exercise: Printable Library . . . . . . . . . . . . . . . . . . . 18  \n1.4 Meet Cats . . . . . . . . . . . . . . . . . . . . . . . . . . . 20  \n1.4. 1 Imporঞng Type Classes . . . . . . . . . . . . . . . . . 20  \n1.4.2 Imporঞng Default Instances . . . . . . . . . . . . . . 21  \n1.4.3 Imporঞng Interface Syntax . . . . . . . . . . . . . . . 22  \n1.4.4 Imporঞng All The Things! . . . . . . . . . . . . . . . . 22  \n1.4. 5 Deﬁning Custom Instances . . . . . . . . . . . . . . . 23  \n1.4. 6 Exercise: Cat Show . . . . . . . . . . . . . . . . . . . 24  \n1. 5 Example: Eq . . . . . . . . . . . . . . . . . . . . . . . . . . 24  \n1.5. 1 Equality, Liberty, and Fraternity . . . . . . . . . . . . 25  \n1.5.2 Comparing Ints . . . . . . . . . . . . . . . . . . . . . 25  \n1.5.3 Comparing Opঞons . . . . . . . . . . . . . . . . . . . 26  \n1.5.4 Comparing Custom Types . . . . . . . . . . . . . . . 28  \n1.5. 5 Exercise: Equality, Liberty, and Felinity . . . . . . . . . 28  \n1. 6 Controlling Instance Selecঞon . . . . . . . . . . . . . . . . . 29  \n1.6. 1 Variance . . . . . . . . . . . . . . . . . . . . . . . . 29  \n1. 7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32  \n2 Monoids and Semigroups 35  \n2. 1 Deﬁniঞon of a Monoid . . . . . . . . . . . . . . . . . . . . . 37  \n2.2 Deﬁniঞon of a Semigroup . . . . . . . . . . . . . . . . . . . 38  \n2.3 Exercise: The Truth About Monoids . . . . . . . . . . . . . . 39  \n2.4 Exercise: All Set for Monoids . . . . . . . . . . . . . . . . . . 40  \n2. 5 Monoids in Cats . . . . . . . . . . . . . . . . . . . . . . . . 40  \n2.5. 1 The Monoid Type Class . . . . . . . . . . . . . . . . . 40  \n2.5.2 Monoid Instances . . . . . . . . . . . . . . . . . . . . 41  \n2.5.3 Monoid Syntax . . . . . . . . . . . . . . . . . . . . . 42  \n2.5.4 Exercise: Adding All The Things . . . . . . . . . . . . 43  \n2. 6 Applicaঞons of Monoids . . . . . . . . . . . . . . . . . . . . 43  \n2.6. 1 Big Data . . . . . . . . . . . . . . . . . . . . . . . . 44  \n2.6.2 Distributed Systems . . . . . . . . . . . . . . . . . . 44  \n2.6.3 Monoids in the Small . . . . . . . . . . . . . . . . . . 45  \n2. 7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45  \n3 Functors 47  \n3. 1 Examples of Functors . . . . . . . . . . . . . . . . . . . . . 47  \n3.2 More Examples of Functors . . . . . . . . . . . . . . . . . . 49  \n3.3 Deﬁniঞon of a Functor . . . . . . . . . . . . . . . . . . . . . 54  \n3.4 Aside: Higher Kinds and Type Constructors . . . . . . . . . . 55  \n3. 5 Functors in Cats . . . . . . . . . . . . . . . . . . . . . . . . 57  \n3.5. 1 The Functor Type Class . . . . . . . . . . . . . . . ","cbCaimpX2sfeIJcE","https://ap.wps.com/l/cbCaimpX2sfeIJcE","pdf",4676729,1,325,"English","en",105,"# Preface\n## Versions\n## Template Projects\n## Conventions Used in This Book\n## Typographical Conventions\n## Source Code\n## Callout Boxes\n## Acknowledgements\n## Backers\n# Part I. Theory\n## 1 Introduction\n## 2 Monoids and Semigroups\n## 3 Functors\n## 4 Monads","[{\"question\":\"What does the book teach about Scala type classes and implicits?\",\"answer\":\"It explains the structure of a type class, how instances and interfaces work, and how implicits are packaged and resolved through implicit scope and recursive implicit resolution.\"},{\"question\":\"How are monoids and semigroups used in Cats?\",\"answer\":\"The book defines monoids and semigroups, shows how corresponding type classes and syntax appear in Cats, and discusses applications including data aggregation and distributed systems.\"},{\"question\":\"What are functors and monads in this context?\",\"answer\":\"Functors are introduced with examples, formal definitions, and Cats-specific syntax, including contravariant and invariant variants. Monads are then presented with their definition and Cats implementations such as identity monad and Either for error handling and transformation.\"}]","Scala with Cats - A Practical Introduction to Type Classes, Functors, Monoids, and Monads | PDF",1787323774,819,{"code":4,"msg":31,"data":32},"ok",{"site_id":24,"language":23,"slug":33,"title":13,"keywords":34,"description":14,"schema_data":35,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":28},"scala-with-cats-a-practical-introduction-to-type-classes-functors-monoids-and-monads","",{"@graph":36,"@context":85},[37,54,68],{"@type":38,"itemListElement":39},"BreadcrumbList",[40,44,48,51],{"item":41,"name":42,"@type":43,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":45,"name":46,"@type":43,"position":47},"https://docshare.wps.com/document/","Document",2,{"item":49,"name":12,"@type":43,"position":50},"https://docshare.wps.com/document/technology/",3,{"item":52,"name":13,"@type":43,"position":53},"https://docshare.wps.com/document/scala-with-cats-a-practical-introduction-to-type-classes-functors-monoids-and-monads/135842/",4,{"url":52,"name":13,"@type":55,"author":56,"headline":13,"publisher":58,"fileFormat":61,"inLanguage":23,"description":14,"dateModified":62,"datePublished":62,"encodingFormat":61,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":57},"Person",{"url":41,"name":59,"@type":60},"DocShare","Organization","application/pdf","2026-08-21",true,{"@type":65,"interactionType":66,"userInteractionCount":4},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"What does the book teach about Scala type classes and implicits?","Question",{"text":75,"@type":76},"It explains the structure of a type class, how instances and interfaces work, and how implicits are packaged and resolved through implicit scope and recursive implicit resolution.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How are monoids and semigroups used in Cats?",{"text":80,"@type":76},"The book defines monoids and semigroups, shows how corresponding type classes and syntax appear in Cats, and discusses applications including data aggregation and distributed systems.",{"name":82,"@type":73,"acceptedAnswer":83},"What are functors and monads in this context?",{"text":84,"@type":76},"Functors are introduced with examples, formal definitions, and Cats-specific syntax, including contravariant and invariant variants. Monads are then presented with their definition and Cats implementations such as identity monad and Either for error handling and transformation.","https://schema.org",{"og:url":52,"og:type":87,"og:title":13,"og:site_name":59,"og:description":14},"article",{"robots":89,"canonical":52},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,113,118,123,128,131,135],{"id":20,"doc_module":4,"doc_module_name":46,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":47,"doc_module":4,"doc_module_name":46,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":53,"doc_module":4,"doc_module_name":46,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":46,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":11,"doc_module":4,"doc_module_name":46,"category_name":12,"show_sort_weight":111,"slug":112},50,"technology",{"id":114,"doc_module":4,"doc_module_name":46,"category_name":115,"show_sort_weight":116,"slug":117},7,"Healthcare",40,"healthcare",{"id":119,"doc_module":4,"doc_module_name":46,"category_name":120,"show_sort_weight":121,"slug":122},8,"Research & Report",30,"research-report",{"id":124,"doc_module":4,"doc_module_name":46,"category_name":125,"show_sort_weight":126,"slug":127},9,"Religion & Spirituality",20,"religion-spirituality",{"id":126,"doc_module":4,"doc_module_name":46,"category_name":129,"show_sort_weight":126,"slug":130},"World Cup","world-cup",{"id":132,"doc_module":4,"doc_module_name":46,"category_name":133,"show_sort_weight":132,"slug":134},10,"Lifestyle","lifestyle",{"id":136,"doc_module":4,"doc_module_name":46,"category_name":137,"show_sort_weight":106,"slug":138},19,"General","general"]