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

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 Laz...

Descripción completa

Detalles Bibliográficos
Otros Autores: Lemmer, Ryan, author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham : Packt Publishing 2015.
Edición:1st edition
Colección:Community experience distilled.
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009629984306719
Tabla de Contenidos:
  • Cover; Copyright; Credits; About the Author; About the Reviewer; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Functional Patterns - the Building Blocks; Higher-order functions; Functions as first-class citizens; Composing functions; Currying functions; Currying and composability; Decoupling with currying; Recursion; Non-tail recursion; Tail recursion; Folding abstracts recursion; Types, pattern matching, and polymorphism; Algebraic types and pattern matching; Recursive types; Polymorphism; Parametric polymorphism; Ad-hoc polymorphism; Functions, types, and patterns
  • The strategy patternThe template pattern; The iterator pattern; Decoupling behavior and modularizing code; Lazy evaluation; Streams; Modeling change with streams; Lazy evil; Monads; Composing monads and structuring programs; Summary; Chapter 2: Patterns for I/O; I/O as a first class citizen; I/O as a functor, applicative, and monad; Imperative I/O; Lazy I/O; The problems with lazy I/O; Resource management with bracket; Iteratee I/O; Iteratee; Enumerator; Generalized iteratees, enumerators, and enumeratees; The iteratee I/O libraries; Comparing the three styles of I/O; Summary
  • Chapter 3: Patterns of CompositionFunctor; Applicative functor; Monad; Monad as functor; Monad as applicative; Sequencing actions with monad and applicative; Monads and the bind chain; Composing with monads; Monad transformers; IO in monad stacks; Sequence of stack composition; Arrows; Implementing an arrow; Arrow operators; Kleisli arrows and monad arrows; Why arrows?; Summary; Chapter 4: Patterns of Folding and Traversing; Folding over lists; Folding with monadic functions; Folding with monoids; Foldable; Mapping over lists; Traversable; A Traversable Tree
  • The traversal and the Iterator patternModernizing Haskell 98; Lenses; Deriving Lens; Writing a Lens; Composable getters and setters; Lens Traversal; Lens.Fold; The Lens library; Summary; Chapter 5: Patterns of Type Abstraction; Abstracting function types: RankNTypes; Abstracting datatypes; Universal quantification; Existential quantification and abstract datatypes; Phantom types; Generalized algebraic datatypes; Typecase pattern; Dynamic types; Heterogeneous lists; Abstracting type-classes; Multiparameter type-classes; Functional dependencies; Summary
  • Chapter 6: Patterns of Generic ProgrammingPatterns of generic programming; Patterns 1 and 2 - functions; Pattern 3 - polymorphic types and functions; Pattern 4 - type-class polymorphism; Pattern 5 - meta-programming; The Derivable type-classes; Generalized newtype deriving; Pattern 6 - type laws; Pattern 7 - datatype generic programming; The sum of products style; The sum of products type representation; Translating between the type and representation; Writing a datatype-generic function; Adding a new datatype; GHC.Generics - a generic deriving mechanism; Origami programming
  • Tying the recursive knot