Antich Anton / Антич Антон - Magical Haskell / Волшебный Хаскелл [2025, PDF, ENG]
Главная »
Литература
» Книги FB2 » Учебно-техническая литература
|
| Статистика раздачи | |
| Размер: 6.58 MB | Зарегистрирован: 6 месяца 4 дня | Скачано: 180 раза | |
| Список скачавших: Нет | |
| Работает мультитрекерная раздача | |
|
Полного источника не было: Никогда |
|
|
| Автор | Сообщение | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MAGNAT ®
|
Magical Haskell / Волшебный Хаскелл
Год издания: 2025 Автор: Antich Anton / Антич Антон Издательство: Apress Media LLC ISBN: 979-8-8688-1282-8 Язык: Английский Формат: PDF Качество: Издательский макет или текст (eBook) Количество страниц: 428 Описание: Discover a unique and fun approach to adopting modern typed functions programming patterns. This book uses playful metaphors and examples to help you learn Haskell through imagination, building on math without relying on imperative crutches or technical complexity. You’ll use math to build completely different Typed Functional patterns from the ground up and understand the link between building Mathematics through Types and constructing Haskell as a programming language. Intended for working with various applications, especially AI-powered apps, the book gently builds up to what are normally considered complex and difficult concepts all without needing a PhD to understand them. Illustrative explanations will guide you to tackle monads, using monad transformer stacks to structure real programs, foldable and traversable structures, as well as other Type classes. This book will also help you structure programs efficiently and apply your own abstractions to real-life problem domains. Next, you’ll explore exciting advancements in AI, including building with OpenAI APIs, creating a terminal chatbot, adding web functionality, and enhancing with retrieval-augmented generation. Finally, you’ll delve into AI multi-agents and future directions using Arrows abstraction, reinforcing Haskell’s design. Magical Haskell is a solution for programmers who feel limited by imperative programming languages but are also put off by excessively mathematical approaches. What You Will Learn Grasp a solid math foundation without complex technicalities for Types and Typeclasses. Solve problems via a typed functional approach and understand why it’s superior to what’s available in the imperative language world (“if it compiles, it runs”). Build your own abstractions to efficiently resolve problems in any given domain. Develop AI frameworks in Haskell, including chatbots, web functionality, and retrieval-augmented generation. Who This Book Is For Haskell programmers of all levels and those interested in Type Theory. Откройте для себя уникальный и увлекательный подход к внедрению современных шаблонов программирования типизированных функций. В этой книге используются игривые метафоры и примеры, которые помогут вам изучать Haskell с помощью воображения, опираясь на математику, не полагаясь на обязательные "костыли" или технические сложности. Вы будете использовать математику для создания совершенно разных типизированных функциональных шаблонов с нуля и поймете связь между построением математики с помощью типов и построением Haskell как языка программирования. Предназначенная для работы с различными приложениями, особенно с приложениями на базе искусственного интеллекта, книга мягко раскрывает то, что обычно считается сложными концепциями, и для понимания этого не требуется докторская степень. Наглядные объяснения помогут вам разобраться с монадами, используя стеки преобразований монад для структурирования реальных программ, складываемые и перемещаемые структуры, а также другие классы типов. Эта книга также поможет вам эффективно структурировать программы и применять ваши собственные абстракции к реальным проблемным областям. Далее вы познакомитесь с захватывающими достижениями в области искусственного интеллекта, включая разработку с использованием API OpenAI, создание чат-бота на терминале, добавление веб-функциональности и усовершенствование с помощью генерации с дополненным поиском. Наконец, вы познакомитесь с мультиагентным искусственным интеллектом и будущими направлениями, используя абстракцию Arrows, которая усиливает дизайн Haskell. Magical Haskell - это решение для программистов, которые чувствуют себя ограниченными в императивных языках программирования, но которых также отталкивают чрезмерно математические подходы. Что вы узнаете Получите прочную математическую основу без сложных технических знаний о типах и классах типов. Решайте проблемы с помощью типизированного функционального подхода и поймите, почему он превосходит то, что доступно в мире императивных языков (“если он компилируется, он запускается”). Создавайте свои собственные абстракции для эффективного решения проблем в любой предметной области. Разрабатывайте фреймворки искусственного интеллекта на Haskell, включая чат-ботов, веб-функционал и генерацию с расширением поиска. Для кого предназначена эта книга Программисты на Haskell всех уровней и те, кто интересуется теорией типов. ОглавлениеAbout the Author ................................................................................................xiAbout the Technical Reviewer ...............................................................................xiii Acknowledgments ...............................................................................................xv Introduction .......................................................................................................xvii How This Book Came to Be: Instead of an Introduction ............................................xix Chapter 1: Wizards, Types, and Functions ..............................................................1 Solving Problems As Wizards Do ...........................................................................3 Let’s Fall in Love with Types! ................................................................................7 A Char and an Int Walk into a Bar and Make a Function ...........................................8 How FunTypical! ..................................................................................................12 Curry and Recurse! .............................................................................................15 Conclusion ..........................................................................................................19 Chapter 2: Type Construction ................................................................................21 House of Cards with a Little Help from Algebra ........................................................22 Algebraic Data Types ...........................................................................................25 Records .............................................................................................................27 Type Functions Are Functions, Maybe? ...............................................................30 Advanced: On Data Constructors and Types ........................................................37 List, Recursion on Types and Patterns ................................................................39 Length of a List ..............................................................................................42 Map a Function Over a List of Values .................................................................44 Conclusion ........................................................................................................50 Chapter 3: Very Gentle Type Theory and Category Theory Intro ...............................51 Types and Functions ...........................................................................................52 Maybe and Advanced Generalized Functions .......................................................54 Dependent Function Types (Pi-Types) .................................................................59 Sum, Product, and Dependent Pair (Sigma) Types ..............................................61 Very Gentle Category Theory Introduction ..........................................................63 Typeclasses .........................................................................................................66 Conclusion ..........................................................................................................70 Chapter 4: Basic Typeclasses or “Show Me a Monoid” ...............................................71 Show Typeclass ...................................................................................................72 Algebra Is Cool ....................................................................................................73 Typeclass Hierarchy in Haskell ................................................................................76 Lift Me Up! ..........................................................................................................79 Conclusion ..........................................................................................................83 Chapter 5: Functor, Bifunctor, and Applicative Functor Enter an Elevator … ...................................................................................................85 Functor Typeclass Definition ...............................................................................86 Three-Dimensional Vector Example ....................................................................89 Tracking Players in Our Game .............................................................................91 You Are Either Functor or a Bifunctor ..................................................................92 We Need a Bigger Lift ....................................................................................98 Action! Apply! Cut! .......................................................................................104 Applicative Typeclass .....................................................................................107 Conclusion ...................................................................................................111 Chapter 6: O, Monad, Help Me Compose! ..........................................................113 Can We Play Cards in This State? .....................................................................117 Monad Typeclass and Basic Monads ..................................................................128 Reader–Writer–State Triple ...............................................................................132 The State Monad ...............................................................................................132 The Reader Monad ............................................................................................135 The Writer Monad ..............................................................................................140 Conclusion ........................................................................................................145 Chapter 7: Input, Transformer Stack, Output .........................................................147 Do Notation .......................................................................................................153 Monad Transformer Stacks ..................................................................................158 Conclusion ........................................................................................................169 Chapter 8: Blackjack: Full Haskell Program ............................................................171 Preparation .......................................................................................................174 Initial “Pure” Design ..........................................................................................177 Building the First Floor: IO .................................................................................183 Building the Top Floor: StateT IO .......................................................................188 Final Game and Recap ......................................................................................197 Conclusion ........................................................................................................201 Chapter 9: Let’s AI ........................................................................................203 Agentic AI and Large Language Models ............................................................203 LLMs in a Nutshell .......................................................................................205 Haskell and LLMs ..............................................................................................210 Big Picture of the Haskell AI Framework .....................................................211 Terminal Chatbot .........................................................................................212 Conclusion ........................................................................................................231 Conclusion ........................................................................................................234 Chapter 10: Terminal AI Chat Agent ............................................................237 Terminal UI Skeleton .........................................................................................238 Adding a Nicer Response Function ..............................................................239 Initialization .................................................................................................241 Building the Monad Transformer Stack .......................................................242 Main Program ..............................................................................................245 Building Muscles ...............................................................................................248 Logging ........................................................................................................248 Usage Stats in the Writer Monad .................................................................253 Chat History .................................................................................................255 Conclusion ........................................................................................................263 Chapter 11: Web-Enabled AI Framework and GHC “Guts” ...............................265 Terminal UI Improvements ................................................................................265 Example Jarvis Scenarios ...........................................................................270 “M” Subchapter: Under the Hood of GHC ..........................................................278 Adding a Web API ..............................................................................................283 Mutable Variables .............................................................................................294 IORef: Simple Mutable Variables in the IO Monad .......................................295 MVar: Mutable Variables with Concurrency Control .....................................296 TVar: The Power of Software Transactional Memory (STM) .........................298 Conclusion ........................................................................................................300 Chapter 12: Down the Rabbit Hole ..................................................................303 MongoDB as a Persistence Layer .....................................................................304 MongoDB Initialization .................................................................................308 Adding a System Prompts Collection ..........................................................310 Redesigning Architecture: MRWST Monad Transformer ...................................313 Vectors and Type Families ................................................................................321 Type Synonym Families ...............................................................................322 Data Families ...............................................................................................323 Associated Type and Data Families .............................................................325 Vectors As Arrays in Haskell ........................................................................330 More AI: Vector RAG ..........................................................................................340 In-Memory Vector Engine ............................................................................344 Conclusion ........................................................................................................358 Chapter 13: AI Multi-agents, Arrows, and the Future .............................................359 Arrows: The Last Abstraction ............................................................................361 Arrows Definition and Basic Examples ........................................................364 Arrows Interface ..........................................................................................367 AI Multi-agents and Arrows ..............................................................................373 AI Multi-agents Examples ............................................................................377 Arrows to Support Quick AI Multi-agent Creation ........................................379 Final Improvements for the AI Framework ........................................................390 Web Authentication with JWTs ....................................................................390 Error Handling: Embracing the Try–Catch Approach ....................................396 Multiple LLMs and Agents Support ..............................................................399 Conclusion ..............................................................................................404 Index .....................................................................................................407
|
|||||||||||||||||||||
Главная »
Литература
» Книги FB2 » Учебно-техническая литература
|
Текущее время: 05-Дек 16:22
Часовой пояс: UTC + 5
Вы не можете начинать темы
Вы не можете отвечать на сообщения Вы не можете редактировать свои сообщения Вы не можете удалять свои сообщения Вы не можете голосовать в опросах Вы не можете прикреплять файлы к сообщениям Вы можете скачивать файлы |






