Haskell Design Patterns
暫譯: Haskell 設計模式

Ryan Lemmer

商品描述

Take your Haskell and functional programming skills to the next level by exploring new idioms and design patterns

About This Book

  • Explore Haskell on a higher level through idioms and patterns
  • Get an in-depth look into the three strongholds of Haskell: higher-order functions, the Type system, and Lazy evaluation
  • Expand your understanding of Haskell and functional programming, one line of executable code at a time

Who This Book Is For

If you're a Haskell programmer with a firm grasp of the basics and ready to move more deeply into modern idiomatic Haskell programming, then this book is for you.

What You Will Learn

  • Understand the relationship between the “Gang of Four” OOP Design Patterns and Haskell
  • Try out three ways of Streaming I/O: imperative, Lazy, and Iteratee based
  • Explore the pervasive pattern of Composition: from function composition through to high-level composition with Lenses
  • Synthesize Functor, Applicative, Arrow and Monad in a single conceptual framework
  • Follow the grand arc of Fold and Map on lists all the way to their culmination in Lenses and Generic Programming
  • Get a taste of Type-level programming in Haskell and how this relates to dependently-typed programming
  • Retrace the evolution, one key language extension at a time, of the Haskell Type and Kind systems
  • Place the elements of modern Haskell in a historical framework

In Detail

Design patterns and idioms can widen our perspective by showing us where to look, what to look at, and ultimately how to see what we are looking at. At their best, patterns are a shorthand method of communicating better ways to code (writing less, more maintainable, and more efficient code).

This book starts with Haskell 98 and through the lens of patterns and idioms investigates the key advances and programming styles that together make "modern Haskell". Your journey begins with the three pillars of Haskell. Then you'll experience the problem with Lazy I/O, together with a solution. You'll also trace the hierarchy formed by Functor, Applicative, Arrow, and Monad. Next you'll explore how Fold and Map are generalized by Foldable and Traversable, which in turn is unified in a broader context by functional Lenses. You'll delve more deeply into the Type system, which will prepare you for an overview of Generic programming. In conclusion you go to the edge of Haskell by investigating the Kind system and how this relates to Dependently-typed programming.

Style and approach

Using short pieces of executable code, this guide gradually explores the broad pattern landscape of modern Haskell. Ideas are presented in their historical context and arrived at through intuitive derivations, always with a focus on the problems they solve.

商品描述(中文翻譯)

提升您的 Haskell 和函數式程式設計技能,探索新的慣用法和設計模式

本書介紹



  • 透過慣用法和模式在更高層次上探索 Haskell

  • 深入了解 Haskell 的三大支柱:高階函數、類型系統和懶惰評估

  • 逐行擴展您對 Haskell 和函數式程式設計的理解

本書適合誰


如果您是一位對基礎有堅實掌握的 Haskell 程式設計師,並準備更深入地進入現代慣用 Haskell 程式設計,那麼這本書就是為您而寫。

您將學到什麼



  • 理解「四人幫」物件導向設計模式與 Haskell 之間的關係

  • 嘗試三種流式 I/O 的方式:命令式、懶惰和基於 Iteratee

  • 探索組合的普遍模式:從函數組合到使用 Lenses 的高階組合

  • 在單一概念框架中綜合 Functor、Applicative、Arrow 和 Monad

  • 追隨 Fold 和 Map 在列表上的宏觀弧線,直到它們在 Lenses 和泛型程式設計中的巔峰

  • 體驗 Haskell 中的類型層級程式設計,以及這與依賴類型程式設計的關係

  • 逐步回顧 Haskell 類型和類別系統的演變,每次一個關鍵的語言擴展

  • 將現代 Haskell 的元素置於歷史框架中

詳細內容


設計模式和慣用法可以擴大我們的視野,告訴我們該看什麼、如何看,最終如何理解我們所看到的。在最佳情況下,模式是一種更好地溝通編碼方法的簡寫(寫得更少、更易於維護和更高效的代碼)。


本書從 Haskell 98 開始,透過模式和慣用法的視角調查共同構成「現代 Haskell」的關鍵進展和程式設計風格。您的旅程從 Haskell 的三大支柱開始。接著,您將體驗懶惰 I/O 的問題及其解決方案。您還將追溯 Functor、Applicative、Arrow 和 Monad 形成的層次結構。接下來,您將探索如何通過 Foldable 和 Traversable 將 Fold 和 Map 一般化,這又在更廣泛的背景下由函數 Lenses 統一。您將更深入地研究類型系統,這將為您提供泛型程式設計的概述。最後,您將通過調查類別系統及其與依賴類型程式設計的關係,走到 Haskell 的邊緣。

風格與方法


本指南使用短小的可執行代碼,逐步探索現代 Haskell 的廣泛模式景觀。思想在其歷史背景中呈現,並通過直觀的推導得出,始終專注於它們解決的問題。