Cover Material, Copyright, and License
Preface
- Requests from the Author
- Structure of the Book
- Code Examples
- Functional Programming Requires a Different Mind Set
- eBooks Are Living Documents
- Setting Up Your Development Environment
- Why Haskell?
- Enjoy Yourself
- Acknowledgements
Section 1 - Tutorial
Tutorial on Pure Haskell Programming
- Interactive GHCi Shell
- Introduction to Haskell Types
- Functions Are Pure
- Using Parenthesis or the Special $ Character and Operator Precedence
- Lazy Evaluation
- Understanding List Comprehensions
- Haskell Rules for Indenting Code
- Understanding let and where
- Conditional do Expressions and Anonymous Functions
- Maps
- Sets
- More on Functions
- Comments on Dealing With Immutable Data and How to Structure Programs
- Error Handling
- Testing Haskell Code
- Pure Haskell Wrap Up
- Optional Practice Problems
Tutorial on Impure Haskell Programming
- Hello IO () Monad
- A Note About >> and >>= Operators
- Console IO Example with Stack Configuration
- File IO
- Error Handling in Impure Code
- Network IO
- A Haskell Game Loop that Maintains State Functionally
- A More Detailed Look at Monads
- Using Applicative Operators <$> and <*>: Finding Common Words in Files
- List Comprehensions Using the do Notation
- Dealing With Time
- Using Debug.Trace
- Wrap Up
- Optional Practice Problems
Section 2 - Cookbook
Using the OpenAI Large Language Model APIs in Haskell
- Example Client Code
- Adding a Simple Application: Find Place Names in Input Text
- Optional Practice Problems
A Web Application For Using the Google Gemini APIs
- Web App Wrap Up and a Description of Scotty Web Framework
- Optional Practice Problems
Command Line Utility To Use the Google Gemini APIs
- Optional Practice Problems
Command Line Tool to Use Local Ollama LLM Server
- Optional Practice Problems
Using the Brave Search API
- Optional Practice Problems
Text Processing
- CSV Spreadsheet Files
- JSON Data
- Cleaning Natural Language Text
- Optional Practice Problems
Natural Language Processing Tools
- Resolve Entities in Text to DBPedia URIs
- Bag of Words Classification Model
- Text Summarization
- Part of Speech Tagging
- Natural Language Processing Wrap Up
- Optional Practice Problems
Linked Data and the Semantic Web
- The SPARQL Query Language
- A Haskell HTTP Based SPARQL Client
- Querying Remote SPARQL Endpoints
- Linked Data and Semantic Web Wrap Up
- Optional Practice Problems
Implementing a Simple RDF Datastore With Partial SPARQL Support
- In-memory Example Using a Pattern Matching Query Syntax
- In-memory Example Using a Simplified SPARQL Query Syntax
- Wrap Up
- Optional Practice Problems
Web Scraping
- Web Scraping Wrap Up
- Optional Practice Problems
Using Relational Databases
- Database Access for Sqlite
- Database Access for Postgres
- Optional Practice Problems
Data Analysis in Haskell with DataFrame
- Setup and Boilerplate
- Loading Data and Summary Statistics
- Deriving New Columns
- Filtering and Selection
- Sorting
- Grouping and Aggregation
- Writing Data to Files
- Optional Practice Problems
Haskell Program to Play the Blackjack Card Game
- Optional Practice Problems
Native macOS GUI Applications with WebKit and Haskell FFI
- The FFI Architecture
- The C Interface:
webkit_haskell.h - The Haskell FFI Wrapper:
WebKitHaskell.hs - Cabal Build System Configuration
- Example 1: Hello World
- Example 2: Stateful Counter App
- Example 3: Markdown Viewer
- Optional Practice Problems
Building a Rubber Bridge Game Engine and AI in Haskell
- Decoupled Architecture Design
- Domain Data Types:
Bridge.Types - Cards, Deck Shuffling, and Hand Analysis:
Bridge.Cards - AI Bidding Conventions & Rule Decisions:
Bridge.Bidding - Trick Play & Legal Rules:
Bridge.Play - Scoring Rules:
Bridge.Scoring - Core Game State Machine:
Bridge.Engine - Interactive Command Line Front-end:
app/Main.hs - Compilation and Running the Game
- Optional Practice Problems
Graphical WebKit Desktop Interface for Rubber Bridge in Haskell
- Architectural Overview
- The Backend FFI Dispatcher:
app/Main.hs - Frontend Layout & Design:
app/index.html - Game Loop Delay & Timing Flow
- Building and Running the Desktop Application
- Optional Practice Problems
Symbolic Mathematics in Haskell
- Project Structure
- Core Data Structures
- Symbolic Differentiation
- Symbolic Integration
- Running the Smoke Tests
- Design Notes
- Wrap Up
- Optional Practice Problems
Section 3 - Larger Projects
Knowledge Graph Creator
- Code Layout For the KGCreator Project and strategies for sharing Haskell code between projects
- The Main Event: Detecting Entities in Text
- Utility Code for Generating RDF
- Utility Code for Generating Cypher Input Data for Neo4J
- Top Level API Code for Handling Knowledge Graph Data Generation
- Wrap Up for Automating the Creation of Knowledge Graphs
- Optional Practice Problems
Hybrid Haskell and Python Natural Language Processing
- Example Use of the Haskell NLP Client
- Setting up the Python NLP Server
- Understanding the Haskell NLP Client Code
- Wrap Up for Using the Python SpaCy NLP Service
- Optional Practice Problems
Hybrid Haskell and Python For Coreference Resolution
- Installing the Python Coreference Server
- Understanding the Haskell Coreference Client Code
- Key Points
- Wrap Up for Using the Python Coreference NLP Service
- Optional Practice Problems
Resources for Learning and Experimentation
- Reactive Haskell notebooks: A gallery of Sabela notebooks
Book Wrap Up
- Using Haskell for Modern AI Applications
Appendix A - Haskell Tools Setup
- stack
- Emacs Setup
- Do you want more of an IDE-like Development Environment?
- Testing Haskell Programs
- hlint