A note on the digital index
A link in an index entry is displayed as the section title in which that entry appears. Because some sections have multiple index markers, it is not unusual for an entry to have several links to the same section. Clicking on any link will take you directly to the place in the text in which the marker appears.
Symbols
(,,) function, using with zip lists, Zip Lists
-> r as functor and monad, Reader? Ugh, Not This Joke Again
-> r, as functor and monad, Reader? Ugh, Not This Joke Again
0 flag, using in Heathrow to London example, Getting a Road System from the Input
3D vector type, implementing, Should We Parameterize Our Car?
:k command, identifying kinds with, Either a As a Functor , Either a As a Functor
<$>, using with applicative style, The Applicative Style
<*> function, The Applicative Style , Lists , Lists , Functions As Applicatives , Functions As Applicatives , Zip Lists , liftM and Friends
calling with applicative values, Functions As Applicatives
left-associative, Lists
specializing for IO, Lists
using with applicative style, The Applicative Style
using with liftM function, liftM and Friends
using with zip lists, Zip Lists
<-, using with I/O actions and functors, I/O Actions As Functors
<= operator, using with lists, Concatenation
>> function, replacing, Banana on a Wire
>>= (bind) function, A Knight’s Quest , A Knight’s Quest
in A Knight’s Quest, A Knight’s Quest
[Char] and String types, The Read Type Class , The Read Type Class , Any Day of the Week , Any Day of the Week
|| as Boolean operator disjunction, Starting Out , Product and Sum
“\n” (newline) character, adding, Grab the Handles!
A
accumulators, Lambdas , Lambdas , Right Folds with foldr , Folding Infinite Lists
using with folds, Lambdas
using with right folds, Right Folds with foldr
using with scanl and scanr, Folding Infinite Lists
addDrink function, Monoids to the Rescue
algebraic data structures, Let’s Plant a Tree
algebraic data types, Any Day of the Week , Recursive Data Structures
algebraic expressions, writing, Functionally Solving Problems
All type, using with monoids, Any and All
ampersands (&&), Starting Out , Starting Out , Another Way to Look at Folds
as Boolean operator conjunction, Starting Out
using with folds and lists, Another Way to Look at Folds
and function, Another Way to Look at Folds , Useful Functions for Applicatives , Useful Functions for Applicatives
using with applicative functors, Useful Functions for Applicatives
using with lists, Another Way to Look at Folds
any function, Needle in the Haystack
Any newtype constructor, using with monoids, Product and Sum
' (apostrophe), Baby’s First Functions , Baby’s First Functions , Trees Are Functors, Too
using with functions, Baby’s First Functions
using with types, Trees Are Functors, Too
apostrophe ('), Baby’s First Functions , Baby’s First Functions , Trees Are Functors, Too
using with functions, Baby’s First Functions
using with types, Trees Are Functors, Too
appendFile function, Grab the Handles! , Grab the Handles! , Grab the Handles!
in to-do list example, Grab the Handles!
using in I/O, Grab the Handles!
applicative functors, Using Applicative Functors , Using Applicative Functors , The Applicative Style , Functions As Applicatives , Zip Lists , Zip Lists , Zip Lists , Useful Functions for Applicatives , Monoids , A Fistful of Monads , Upgrading Our Applicative Functors , The List Monad , liftM and Friends
Applicative type class, Using Applicative Functors
functions as, Functions As Applicatives
liftA2 function, Zip Lists
lists as, The Applicative Style , Monoids , The List Monad
Maybe types as, Upgrading Our Applicative Functors
sequenceA function, Useful Functions for Applicatives
upgrading, A Fistful of Monads
zip lists, Zip Lists
applicative laws, Applicative Laws
applicative operators, vs. monads, I’ll Fly Away
applicative style, using on lists, Lists
Applicative type class, Using Applicative Functors , Say Hello to Applicative , Maybe the Applicative Functor
Maybe implementation, Say Hello to Applicative
style of pure, Maybe the Applicative Functor
applyLog function, Writer? I Hardly Knew Her! , Writer? I Hardly Knew Her! , Writer? I Hardly Knew Her!
using with monoids, Writer? I Hardly Knew Her!
using with Writer monad, Writer? I Hardly Knew Her!
arithmetic expressions, Starting Out
-> (arrow), Explicit Type Declaration , Curried Functions , Curried Functions , Mapping Functions with Multiple Parameters
in type signature, Curried Functions
using with functions, Explicit Type Declaration
using with lambdas, Mapping Functions with Multiple Parameters
arrow (->), Explicit Type Declaration , Curried Functions , Curried Functions , Mapping Functions with Multiple Parameters
in type signature, Curried Functions
using with functions, Explicit Type Declaration
using with lambdas, Mapping Functions with Multiple Parameters
as-pattern, As-patterns
askForNumber function, Randomness and I/O
association lists, Almost As Good: Association Lists
associativity, About Those Monoids , About Those Monoids , Right Identity
defined, About Those Monoids
using with monads, Right Identity
* (asterisk), Starting Out , Starting Out , Either a As a Functor
as multiplication function, Starting Out
using with kinds, Either a As a Functor
asterisk (*), Starting Out , Starting Out , Either a As a Functor
as multiplication function, Starting Out
using with kinds, Either a As a Functor
B
baby.hs file, Calling Functions , Baby’s First Functions , Baby’s First Functions
appending code to, Baby’s First Functions
saving, Calling Functions
\ (backslash), declaring lambdas with, Mapping Functions with Multiple Parameters
backslash (\), declaring lambdas with, Mapping Functions with Multiple Parameters
` (backticks) using with functions, Calling Functions
backticks (`) using with functions, Calling Functions
Banana on a Wire example, I’ll Fly Away
base case, reaching, Hello Recursion!
binary functions, Lambdas , About Those Monoids , About Those Monoids
using on values, About Those Monoids
using with folds, Lambdas
binary search tree, implementing, Improving Our List
>>= (bind) function, Upgrading Our Applicative Functors , The Monad Type Class , Walk the Line , Banana on a Wire , Pierre Returns , The List Monad , A Knight’s Quest , A Knight’s Quest , Monoids to the Rescue , Reader? Ugh, Not This Joke Again , The Reader Monad , The State Monad
in A Knight’s Quest, A Knight’s Quest
nested use of, Banana on a Wire
using with functions as monads, Reader? Ugh, Not This Joke Again
using with monads, Upgrading Our Applicative Functors , The Monad Type Class , Walk the Line , Pierre Returns , The List Monad
using with Reader monad, The Reader Monad
using with State monad, The State Monad
using with Writer type, Monoids to the Rescue
bind (>>=) function, Upgrading Our Applicative Functors , The Monad Type Class , Walk the Line , Banana on a Wire , Pierre Returns , The List Monad , Monoids to the Rescue , Reader? Ugh, Not This Joke Again , The Reader Monad , The State Monad
nested use of, Banana on a Wire
using with functions as monads, Reader? Ugh, Not This Joke Again
using with monads, Upgrading Our Applicative Functors , The Monad Type Class , Walk the Line , Pierre Returns , The List Monad
using with Reader monad, The Reader Monad
using with State monad, The State Monad
using with Writer type, Monoids to the Rescue
binding to variables, Pattern Matching with Lists and List Comprehensions
birds, Code, Code, Code , I’ll Fly Away , I’ll Fly Away
ignoring in Pierre example, I’ll Fly Away
representing in Pierre example, Code, Code, Code
BMI (body mass index), Guards, Guards! , Guards, Guards! , where?! , Pattern Matching with where
calculation of, Guards, Guards!
listing of, Pattern Matching with where
repeating calculations of, where?!
Bool type, Common Haskell Types , A Yes-No Type Class , Product and Sum
Boolean algebra, Starting Out
Boolean expressions, using with guards, Guards, Guards!
Boolean values, Randomness , Randomness , Tossing a Coin
for tossing coin, Tossing a Coin
generating randomly, Randomness
Bounded type class, The Read Type Class , Order in the Court!
bracket function, using in I/O, Using the withFile Function
bracketOnError function, Deleting Items
breadcrumbs, Taking a Walk , Focusing on Lists , Making a Zipper for Our Filesystem , Making a Zipper for Our Filesystem
in filesystem, Making a Zipper for Our Filesystem
representing in trees, Taking a Walk
using with lists and zippers, Focusing on Lists
bytestrings, Randomness and I/O , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings , Writer? I Hardly Knew Her! , Writer? I Hardly Knew Her!
as monoids, Writer? I Hardly Knew Her!
changing types of, Writer? I Hardly Knew Her!
copying files with, Strict and Lazy Bytestrings
module functions, Strict and Lazy Bytestrings
strict and lazy, Strict and Lazy Bytestrings
C
Caesar cipher, Needle in the Haystack
calculations, performing once, Guards, Guards!
capital letters, restriction of, Baby’s First Functions
capslocker.hs program, Input Redirection , Getting Strings from Input Streams , Getting Strings from Input Streams , Getting Strings from Input Streams
exiting, Getting Strings from Input Streams
getContents I/O action, Getting Strings from Input Streams
saving and compiling, Input Redirection
Car data type, Type Parameters
case expressions, case Expressions , case Expressions , case Expressions , case Expressions
syntax, case Expressions
vs. if else statements, case Expressions
vs. let expressions, case Expressions
cat program, Grab the Handles!
Char type, Common Haskell Types
characters, Caesar Cipher Salad , Let’s Find Some Cool Numbers , Let’s Find Some Cool Numbers
converting into numbers, Let’s Find Some Cool Numbers
shifting, Caesar Cipher Salad
CharList value constructor, Wrapping an Existing Type into a New Type , type vs. newtype vs. data
chessboard example, MonadPlus and the guard Function
circles, representing, Defining a New Data Type
class constraints, Subclassing , Parameterized Types As Instances of Type Classes
class declarations, A Traffic Light Data Type
code blocks, excluding, case Expressions
coin-toss function, Tossing a Coin
Collatz sequence, More Examples of map and filter
: (colon), An Intro to Lists , Improving Our List , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings , Zip Lists
as cons operator, An Intro to Lists , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings , Zip Lists
bytestring version of, Strict and Lazy Bytestrings
using with applicatives, Zip Lists
using with lists, An Intro to Lists
using with infix constructors, Improving Our List
colon (:), An Intro to Lists , Improving Our List , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings , Zip Lists
as cons operator, An Intro to Lists , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings , Zip Lists
bytestring version of, Strict and Lazy Bytestrings
using with applicatives, Zip Lists
using with lists, An Intro to Lists
using with infix constructors, Improving Our List
command-line arguments, Command-Line Arguments
compare function, The Ord Type Class , The Ord Type Class , Guards, Guards! , The Ordering Monoid
using Ordering type with, The Ord Type Class
using with guards, Guards, Guards!
using with monoids, The Ordering Monoid
computations, Hello Recursion! , Bytestrings , Bytestrings
deferred, Bytestrings
performing, Hello Recursion!
++ (concatenation) operator, An Intro to Lists , Pattern Matching with Lists and List Comprehensions , Pattern Matching with Lists and List Comprehensions
excluding from pattern matching, Pattern Matching with Lists and List Comprehensions
using with lists, An Intro to Lists
concatenation (++) operator, An Intro to Lists , Pattern Matching with Lists and List Comprehensions , Pattern Matching with Lists and List Comprehensions
excluding from pattern matching, Pattern Matching with Lists and List Comprehensions
using with lists, An Intro to Lists
concrete types, Kinds and Some Type-Foo
conditions, adding to list comprehensions, I’m a List Comprehension
conjunction (&&) Boolean operator, Starting Out
cons (:) operator, using with lists, An Intro to Lists
Cons constructor, Recursive Data Structures
context of failure, adding to values, Error Error on the Wall
Control.Exception bracketOnError, Deleting Items
copyFile function, Strict and Lazy Bytestrings
copying files with bytestrings, Strict and Lazy Bytestrings
Cube.hs file in Geometry module, Hierarchical Modules
Cuboid.hs file in Geometry module, A Geometry Module
curried functions, Higher-Order Functions , Curried Functions , Curried Functions , Printing Functions , Functions As Functors
max, Curried Functions
printing functions, Printing Functions
sections, Curried Functions
cycle function, using with lists, Texas Ranges
D
data keyword, Making Our Own Types and Type Classes , Wrapping an Existing Type into a New Type , On newtype Laziness , type vs. newtype vs. data
using, type vs. newtype vs. data
vs. newtype, Wrapping an Existing Type into a New Type , On newtype Laziness
data structures. See also zippers, Lambdas , Lambdas , Focusing on Lists
reducing to values, Lambdas
using zippers with, Focusing on Lists
data types. See also algebraic data types; concrete types; recursive data structures; type constructors; type parameters; types, Making Our Own Types and Type Classes , Exporting Our Shapes in a Module , Record Syntax , Should We Parameterize Our Car? , Should We Parameterize Our Car? , Vector von Doom , Derived Instances , Either a As a Functor , Either a As a Functor , Wrapping an Existing Type into a New Type , type vs. newtype vs. data
3D vector, Should We Parameterize Our Car?
applying to type constructors, Either a As a Functor
defining, Making Our Own Types and Type Classes , Vector von Doom
for describing people, Exporting Our Shapes in a Module , Derived Instances
identifying, Either a As a Functor
making, type vs. newtype vs. data
record syntax, Record Syntax
wrapping with newtype keywords, Wrapping an Existing Type into a New Type
Data.ByteString.Lazy module, Bytestrings
Data.Char module, Caesar Cipher Salad , Let’s Find Some Cool Numbers
Data.List module, Modules , Solving Problems with Module Functions , Solving Problems with Module Functions , Counting Words , Needle in the Haystack , Deleting Items , Deleting Items
!! function, Deleting Items
any function, Needle in the Haystack
delete function, Deleting Items
group function, Solving Problems with Module Functions
tails function, Counting Words
words function, Solving Problems with Module Functions
Data.Map module, Enter Data.Map , Enter Data.Map , Exporting Our Shapes in a Module , Should We Parameterize Our Car?
fromListWith function, Enter Data.Map
lookup function, Enter Data.Map
Map k v parameterized type, Should We Parameterize Our Car?
Data.Monoid module, Product and Sum , Product and Sum , Product and Sum
Product type, Product and Sum
Sum type, Product and Sum
Day type, Any Day of the Week
deferred computation, Bytestrings
definitions, functions as, Baby’s First Functions
deletetodo.hs program, saving and compiling, Deleting Items
derived instances, Vector von Doom , Derived Instances , Equating People , Equating People
equating people, Derived Instances
Read type class, Equating People
Show type class, Equating People
deriving keyword, using with newtype, Wrapping an Existing Type into a New Type
dictionaries, Almost As Good: Association Lists
difference lists, using, Inefficient List Construction
digitToInt function, Let’s Find Some Cool Numbers
disjunction (||) Boolean operator, Starting Out
div function, Calling Functions
/ (division), using with RPN functions, Writing an RPN Function
division (/), using with RPN functions, Writing an RPN Function
do expressions. See also monads, I/O Actions As Functors , I/O Actions As Functors , do Notation , do Notation , do Notation , Pierre Returns , Pierre Returns , The State Monad
actions of, I/O Actions As Functors
failure of pattern matching in, Pierre Returns
let lines in, do Notation
monadic expressions in, do Notation
monadic values in, do Notation
results of, The State Monad
writing, Pierre Returns
do notation, Gluing I/O Actions Together , Banana on a Wire , Pierre Returns , do Notation and List Comprehensions , MonadPlus and the guard Function , The Writer Type
and <-, Gluing I/O Actions Together
and list comprehensions, do Notation and List Comprehensions
pattern matching and failure, Pierre Returns
using with Writer monad, The Writer Type
.. (dots), using with value constructors, Improving Shape with the Point Data Type
dots (..), using with value constructors, Improving Shape with the Point Data Type
&& (double ampersand), Starting Out , Starting Out , Another Way to Look at Folds
as Boolean operator conjunction, Starting Out
using with folds and lists, Another Way to Look at Folds
:: (double colon), Explicit Type Declaration , The Read Type Class , Record Syntax , Record Syntax , Type Parameters
using in record syntax, Record Syntax
using with type annotations, The Read Type Class , Type Parameters
using with types, Explicit Type Declaration
double colon (::), Explicit Type Declaration , The Read Type Class , Record Syntax , Record Syntax , Type Parameters
using in record syntax, Record Syntax
using with type annotations, The Read Type Class , Type Parameters
using with types, Explicit Type Declaration
\== (double equal sign), Starting Out , Type Classes 101 , Inside the Eq Type Class
using with Eq type class, Type Classes 101
using with type instances, Inside the Eq Type Class
double equal sign (==), Starting Out , Type Classes 101 , Inside the Eq Type Class
using with Eq type class, Type Classes 101
using with type instances, Inside the Eq Type Class
!! (double exclamation point), Concatenation , Deleting Items , Deleting Items
in Data.List module, Deleting Items
using with lists, Concatenation
Double type, Common Haskell Types
drop function, using with lists, More List Operations
E
Either a b type, Parameterizing Type Synonyms , Trees Are Functors, Too
Either e a type, Error Error on the Wall
Either, kind of, Kinds and Some Type-Foo
elem function, More List Operations , take , take
using recursively, take
using with lists, More List Operations
end-of-file character, issuing, Input Redirection
Enum type class, The Read Type Class , Order in the Court!
Eq type class, Type Classes 101 , Vector von Doom , Type Classes 102 , Parameterized Types As Instances of Type Classes , type vs. newtype vs. data
\= (equal) sign, Calling Functions , Making Our Own Types and Type Classes , Making Our Own Types and Type Classes , Vector von Doom
using with data keyword, Making Our Own Types and Type Classes
using with data types, Vector von Doom
using with functions, Calling Functions
equal (=) sign, Calling Functions , Making Our Own Types and Type Classes , Making Our Own Types and Type Classes , Vector von Doom
using with data keyword, Making Our Own Types and Type Classes
using with data types, Vector von Doom
using with functions, Calling Functions
equality (== and /=) operators, Starting Out
equality testing, The Eq Type Class
erroneous computation, representing, Using newtype to Make Type Class Instances
error function, Pattern Matching with Lists and List Comprehensions , Using the withFile Function , Using the withFile Function
calling, Using the withFile Function
using in pattern matching, Pattern Matching with Lists and List Comprehensions
error messages, Starting Out
Euclid’s algorithm, Using do Notation with Writer
exceptions, raising, Using the withFile Function , Using newtype to Make Type Class Instances
** (exponentiation), using with RPN functions, Writing an RPN Function
exponentiation (**), using with RPN functions, Writing an RPN Function
exporting, Enter Data.Map , Making Our Own Modules , Improving Shape with the Point Data Type
functions, Making Our Own Modules
shapes in modules, Improving Shape with the Point Data Type
expressions, Starting Out , Explicit Type Declaration , Explicit Type Declaration , Mapping Functions with Multiple Parameters , Mapping Functions with Multiple Parameters
determining types of, Explicit Type Declaration
equivalent examples of, Mapping Functions with Multiple Parameters
lambdas as, Mapping Functions with Multiple Parameters
using operations in, Starting Out
F
factorial function, Explicit Type Declaration , Pattern Matching
failure, adding context of, Error Error on the Wall
False Boolean value, Starting Out
Fibonacci sequence, specifying recursively, Hello Recursion!
file contents vs. handles, Reading and Writing Files
files, Reading and Writing Files , Bytestrings , Strict and Lazy Bytestrings , Strict and Lazy Bytestrings
copying with bytestrings, Strict and Lazy Bytestrings
processing as strings, Bytestrings
reading and writing, Reading and Writing Files
filesystem, Focusing on Lists , Making a Zipper for Our Filesystem , Manipulating a Filesystem , Manipulating a Filesystem
manipulating, Manipulating a Filesystem
moving up and down in, Making a Zipper for Our Filesystem
representing via zippers, Focusing on Lists
filter function, The map Function , Some Fold Examples , Scans
using fold with, Some Fold Examples
vs. takeWhile, Scans
filtering over lists, Randomness and I/O
FilterM monadic function, The join Function
fixity declaration, Improving Our List
flip function, Implementing zipWith , Another Way to Look at Folds
Float type, Explicit Type Declaration
Floating type class, The Bounded Type Class
floating-point numbers, precision of, Making Monads
fmap function, Functions As Functors , Functions As Functors , Functions As Functors , Functions As Functors , Functions As Functors , Wrapping an Existing Type into a New Type , liftM and Friends
as function composition, Functions As Functors
as infix function, Functions As Functors
concept of, Functions As Functors
using over functions, Functions As Functors
using with newtype, Wrapping an Existing Type into a New Type
vs. liftM, liftM and Friends
fold pattern, example of, Almost As Good: Association Lists
folding function, Writing an RPN Function , Folding with Monoids , Folding with Monoids
using with monoids, Folding with Monoids
using with RPN, Writing an RPN Function
foldl function, Left Folds with foldl , Right Folds with foldr , Folding Infinite Lists , On Strict Left Folds
stack overflow errors, On Strict Left Folds
vs. scanl, Folding Infinite Lists
FoldM monadic function, filterM
foldr function, Right Folds with foldr , Another Way to Look at Folds , Folding Infinite Lists , Let’s Plant a Tree
using binary search tree with, Let’s Plant a Tree
vs. scanr, Folding Infinite Lists
folds, Lambdas , Lambdas , Lambdas , Right Folds with foldr , Right Folds with foldr , Some Fold Examples
accumulators, Lambdas
binary functions, Lambdas
concept of, Some Fold Examples
examples, Right Folds with foldr
left vs. right, Right Folds with foldr
for loops, Randomness and I/O
forever I/O function, sequence
forM I/O function, forM
fromListWith function, Enter Data.Map
fst function, Using Tuples , Type Variables , Type Variables
type of, Type Variables
using with pairs, Using Tuples
$ (function application operator), Scans , Function Composition
function application operator ($), Scans , Function Composition
function composition, Function Composition , Function Composition , Function Composition , Point-Free Style , Importing Modules , Counting Words , Functions As Functors
fmap as, Functions As Functors
module functions, Counting Words
performing, Importing Modules
point-free style, Point-Free Style
right-associative, Function Composition
with multiple parameters, Function Composition
function f, mapping over function g, Comparing Performance
function parameters, pattern matching on, case Expressions
functional programming, pattern in, Finding the Right Triangle
functions, Starting Out , Starting Out , Calling Functions , Calling Functions , Baby’s First Functions , Baby’s First Functions , Baby’s First Functions , Baby’s First Functions , Baby’s First Functions , Baby’s First Functions , Explicit Type Declaration , Type Variables , Syntax in Functions , Pattern Matching with where , let It Be , Curried Functions , Curried Functions , Printing Functions , Some Higher-Orderism Is in Order , Implementing flip , The map Function , The map Function , More Examples of map and filter , Mapping Functions with Multiple Parameters , Mapping Functions with Multiple Parameters , Modules , Modules , Importing Modules , Importing Modules , Importing Modules , Importing Modules , Enter Data.Map , Defining a New Data Type , Shaping Up , Shaping Up , Exporting Our Shapes in a Module , Record Syntax , Should We Parameterize Our Car? , Input and Output , Input and Output , Writing an RPN Function , Representing the Road System in Haskell , I/O Actions As Functors , Functions As Functors , Functions As Applicatives , Code, Code, Code , Comparing Performance , Reader? Ugh, Not This Joke Again , Functions As Monads , A Trail of Breadcrumbs
accessing, Modules
applying for monads, Code, Code, Code
applying to lists, Implementing flip
applying with - (minus) operator, A Trail of Breadcrumbs
as applicatives, Functions As Applicatives
as definitions, Baby’s First Functions
as functors, I/O Actions As Functors , Functions As Monads
as monads, Reader? Ugh, Not This Joke Again
behavior of, Input and Output
calling, Starting Out
combining, Baby’s First Functions
concept of, Curried Functions
creating, Calling Functions , Comparing Performance
defining, Syntax in Functions
exporting from modules, Enter Data.Map
filter, The map Function
for shapes, Shaping Up
for vectors, Should We Parameterize Our Car?
importing from modules, Importing Modules
in local scope, let It Be
in where blocks, Pattern Matching with where
infix, Calling Functions
lifting, Functions As Functors
loading, Baby’s First Functions
map, The map Function
mapping with multiple parameters, More Examples of map and filter
optimal path, Representing the Road System in Haskell
partially applied, Curried Functions , Some Higher-Orderism Is in Order , Mapping Functions with Multiple Parameters
. (period) symbol used with, Importing Modules
polymorphic, Type Variables
prefix, Starting Out
printing, Printing Functions
referencing from modules, Importing Modules
relating to people, Record Syntax
searching for, Modules
syntax, Baby’s First Functions
type declarations, Writing an RPN Function
types of, Explicit Type Declaration
using, Baby’s First Functions
using once, Mapping Functions with Multiple Parameters
value constructors as, Defining a New Data Type , Shaping Up , Exporting Our Shapes in a Module
values returned by, Baby’s First Functions
with side effects, Input and Output
functor laws, Functions As Functors , Functor Laws , Law 2
1 and 2, Functions As Functors
breaking, Law 2
Functor type class, The Functor Type Class , The Functor Type Class , Maybe As a Functor , Trees Are Functors, Too , Kinds and Some Type-Foo , Breaking the Law
definition of, Kinds and Some Type-Foo
Either a type constructor, Trees Are Functors, Too
Maybe type constructor, The Functor Type Class
Tree type constructor, Maybe As a Functor
functor values, functions in, Breaking the Law
functors, Trees Are Functors, Too , Applicative Functors , Applicative Functors , I/O Actions As Functors
converting maps into, Trees Are Functors, Too
functions as, I/O Actions As Functors
I/O actions as, Applicative Functors
G
gcd function, Using do Notation with Writer
gcdReverse function, efficiency of, Using Difference Lists
gen generator example, Tasteful Stateful Computations
generics vs. type variables, Type Variables
Geometry module, Enter Data.Map
get function, using with state, The State Monad
getContents I/O action, Getting Strings from Input Streams
getStdGen I/O action, More Random Functions
GHC compiler, invoking, Hello, World!
GHCi, let expressions in, let in List Comprehensions
ghci, typing, Starting Out
ghci> prompt, Starting Out
girlfriend.txt file, Transforming Input , Grab the Handles! , Grab the Handles!
caps-locked version of, Grab the Handles!
opening, Transforming Input
global generator, implementing, More Random Functions
> (greater-than) operator, using with lists, Concatenation
greater-than (>) operator, using with lists, Concatenation
greatest common divisor, calculating, Using do Notation with Writer
group function, using with words function, Solving Problems with Module Functions
guard function, using with monads, MonadPlus and the guard Function
guards. See also functions, Pattern Matching with Lists and List Comprehensions , Pattern Matching with Lists and List Comprehensions , Guards, Guards! , Guards, Guards! , Guards, Guards! , Guards, Guards!
otherwise, Guards, Guards!
using, Guards, Guards!
vs. if expressions, Pattern Matching with Lists and List Comprehensions
vs. if/else trees, Guards, Guards!
vs. patterns, Pattern Matching with Lists and List Comprehensions
H
haiku.txt input, Input Redirection
handles vs. file contents, Reading and Writing Files
Haskell, Using newtype to Make Type Class Instances , On newtype Laziness , Tasteful Stateful Computations
as pure language, Tasteful Stateful Computations
laziness of, Using newtype to Make Type Class Instances
haystack and needle lists, Counting Words
head function, using with lists, Comparing Lists
Heathrow to London example, Heathrow to London , Calculating the Quickest Path , Representing the Road System in Haskell , Representing the Road System in Haskell , Writing the Optimal Path Function , Getting a Road System from the Input
optimal path function, Representing the Road System in Haskell
quickest path, Heathrow to London
road system, Calculating the Quickest Path
road system from input, Writing the Optimal Path Function
stack overflow errors, Getting a Road System from the Input
Hello, world! program, Separating the Pure from the Impure , Separating the Pure from the Impure , Separating the Pure from the Impure , Hello, World! , Hello, World! , Hello, World!
compiling, Separating the Pure from the Impure
defining main, Separating the Pure from the Impure
function types, Hello, World!
printed output, Hello, World!
running, Hello, World!
hierarchical modules, Enter Data.Map
higher-order functions. See also functions, Higher-Order Functions , Higher-Order Functions , Some Higher-Orderism Is in Order , Implementing zipWith , Implementing zipWith , The map Function
curried functions, Higher-Order Functions
flip, Implementing zipWith
map, The map Function
type declaration, Some Higher-Orderism Is in Order
zipWith, Implementing zipWith
Hoogle search engine, Modules
I
I/O (input and output), More Input and More Output , Reading and Writing Files , Using the withFile Function , It’s Bracket Time , It’s Bracket Time , Grab the Handles! , Grab the Handles! , More Random Functions
and randomness, More Random Functions
appendFile function, Grab the Handles!
bracket function, Using the withFile Function
files and streams, More Input and More Output
readFile function, It’s Bracket Time
withFile function, Reading and Writing Files
writeFile function, It’s Bracket Time
I/O actions, Input and Output , Hello, World! , Gluing I/O Actions Together , Gluing I/O Actions Together , Gluing I/O Actions Together , Gluing I/O Actions Together , Gluing I/O Actions Together , Gluing I/O Actions Together , Gluing I/O Actions Together , Gluing I/O Actions Together , Gluing I/O Actions Together , Using let Inside I/O Actions , Using let Inside I/O Actions , Using let Inside I/O Actions , Putting It in Reverse , Putting It in Reverse , I/O Action Review , Getting Strings from Input Streams , Cleaning Up , Cleaning Up , Cleaning Up , Applicative Functors , I/O Actions As Functors , Useful Functions for Applicatives , Monad Laws
<- vs. let bindings, Using let Inside I/O Actions
as functors, Applicative Functors
binding names, Gluing I/O Actions Together
do blocks, I/O Actions As Functors
do notation, Gluing I/O Actions Together
getArgs, Cleaning Up
getContents, Getting Strings from Input Streams
getLine type, Gluing I/O Actions Together
getProgName, Cleaning Up
gluing together, Gluing I/O Actions Together
in System.Environment module, Cleaning Up
let syntax, Gluing I/O Actions Together
making from pure value, Putting It in Reverse
performing, Hello, World! , Gluing I/O Actions Together
results yielded by, Input and Output , Gluing I/O Actions Together
return function, Putting It in Reverse
reverseWords function, Using let Inside I/O Actions
review, I/O Action Review
tellFortune function, Gluing I/O Actions Together
using sequenceA function with, Useful Functions for Applicatives
using with monads, Monad Laws
vs. normal values, Gluing I/O Actions Together
I/O functions, putStr , putChar , putChar , print , sequence , sequence , sequence , mapM , forM
forever, sequence
forM, forM
mapM, mapM
print, putChar
putChar, putChar
putStr, putStr
sequence, sequence
when, print
id function, A Yes-No Type Class , Functions As Functors
if else statements vs. case expressions, case Expressions
if expressions, Pattern Matching with Lists and List Comprehensions , A Yes-No Type Class , A Yes-No Type Class
if statement, Baby’s First Functions
if/else trees vs. guards, Guards, Guards!
importing modules, Importing Modules
infinite lists, using, Texas Ranges
infix functions, Starting Out , More List Operations , Type Variables , Curried Functions , Recursive Data Structures
applying, Curried Functions
defining automatically, Recursive Data Structures
init function, using with lists, Comparing Lists
input redirection, Input Redirection
input streams, getting strings from, Getting Strings from Input Streams
input, transforming, Transforming Input
instance declarations, Parameterized Types As Instances of Type Classes
instance keyword, Inside the Eq Type Class
Int type, Explicit Type Declaration
Integer type, Explicit Type Declaration
Integral type class, The Integral Type Class
interactive mode, starting, Starting Out
IO instance of Applicative, Lists
isPrefixOf function, using with strings, Needle in the Haystack
I’ll Fly Away example, Code, Code, Code
J
join monadic function, liftM and Friends
K
key/value mappings, achieving, Let’s Find Some Cool Numbers
Knight’s Quest, A (example), MonadPlus and the guard Function
L
lambdas, Mapping Functions with Multiple Parameters , Mapping Functions with Multiple Parameters , Left Folds with foldl , Function Composition , Getting a Road System from the Input
declaring, Mapping Functions with Multiple Parameters
in function composition, Function Composition
in Heathrow to London example, Getting a Road System from the Input
using with folds, Left Folds with foldl
landLeft and landRight functions, Code, Code, Code
last function, using with lists, Comparing Lists
left fold function, Left Folds with foldl , Writing an RPN Function , Writing the Optimal Path Function
in Heathrow to London example, Writing the Optimal Path Function
using with RPN function, Writing an RPN Function
length function, using with lists, More List Operations , I’m a List Comprehension
< (less-than) operator, using with lists, Concatenation
less-than (<) operator, using with lists, Concatenation
let expressions, Pattern Matching with where , Pattern Matching with where , let It Be , let It Be , let in GHCi , case Expressions , case Expressions
in GHCi, let in GHCi
in list comprehensions, let It Be
pattern matching with, let It Be
using, Pattern Matching with where
vs. case expressions, case Expressions
vs. where bindings, Pattern Matching with where
let keyword, An Intro to Lists , I’m a List Comprehension , I’m a List Comprehension
using with lists, I’m a List Comprehension
using with names, An Intro to Lists
liftA2 function, using with applicative functors, Zip Lists
list comprehensions, I’m a List Comprehension , Using Pairs , Pattern Matching with Tuples , do Notation and List Comprehensions
and do notation, do Notation and List Comprehensions
pattern matching with, Pattern Matching with Tuples
using with tuples, Using Pairs
list monad, Pattern Matching and Failure
list operations, Comparing Lists , Comparing Lists , Comparing Lists , Comparing Lists , More List Operations , More List Operations , More List Operations , More List Operations , More List Operations , More List Operations , More List Operations , More List Operations , Texas Ranges , Texas Ranges , Texas Ranges , Texas Ranges , I’m a List Comprehension
cycle function, Texas Ranges
drop function, More List Operations
elem function, More List Operations
head function, Comparing Lists
init function, Comparing Lists
last function, Comparing Lists
length function, More List Operations
maximum function, More List Operations
null function, More List Operations
odd function, I’m a List Comprehension
repeat function, Texas Ranges
replicate function, Texas Ranges
reverse function, More List Operations
sum function, More List Operations
tail function, Comparing Lists
take function, More List Operations
list ranges, using Enum type in, The Ord Type Class
lists. See also association lists; bytestrings; Data.List module; task list program; zip lists, Baby’s First Functions , An Intro to Lists , An Intro to Lists , Concatenation , Concatenation , Concatenation , Concatenation , More List Operations , Texas Ranges , Texas Ranges , Texas Ranges , Texas Ranges , Texas Ranges , Texas Ranges , Texas Ranges , I’m a List Comprehension , I’m a List Comprehension , I’m a List Comprehension , Using Tuples , Explicit Type Declaration , Pattern Matching with Tuples , Quick, Sort! , Implementing flip , The map Function , Lambdas , Some Fold Examples , Another Way to Look at Folds , Counting Words , Almost As Good: Association Lists , Randomness and I/O , Randomness and I/O , Bytestrings , Writing an RPN Function , The Applicative Style , Lists , Lists , Zip Lists , Monoids , The Monoid Type Class , Folding with Monoids , The List Monad , Writer? I Hardly Knew Her! , Adding Logging to Programs , Adding Logging to Programs , Focusing on Lists
accessing elements of, Concatenation
adding to, An Intro to Lists
and function, Another Way to Look at Folds
applying functions to, Implementing flip
as applicative functors, The Applicative Style , Zip Lists , Monoids , The List Monad
as monoids, The Monoid Type Class , Writer? I Hardly Knew Her!
as nondeterministic computations, Lists
binding elements from, Texas Ranges
checking empty status of, More List Operations
combining, Texas Ranges
comparing, Concatenation
concatenation, An Intro to Lists
construction of, Adding Logging to Programs
converting trees to, Folding with Monoids
drawing elements from, Texas Ranges
efficiency of, Adding Logging to Programs
filtering, Texas Ranges , Randomness and I/O
folding, Lambdas
getting last elements of, Some Fold Examples
including predicates in, I’m a List Comprehension
infinite, Texas Ranges
inside lists, Concatenation
managing via module functions, Counting Words
mapping over, Randomness and I/O
number ranges in, Texas Ranges
pattern matching with, Pattern Matching with Tuples
promise of, Bytestrings
recursive functions on, Almost As Good: Association Lists
replacing odd numbers in, I’m a List Comprehension
sorting, Quick, Sort!
square brackets ([]) used with, Baby’s First Functions
transforming, Texas Ranges
using applicative style on, Lists
using with filter function, The map Function
using with RPN functions, Writing an RPN Function
using zippers with, Focusing on Lists
vs. tuples, I’m a List Comprehension , Using Tuples , Explicit Type Declaration
locker codes, looking up, Go Left, Then Right
log type, changing type of, Writer? I Hardly Knew Her!
log values. See also values, For a Few Monads More , Writer? I Hardly Knew Her! , Writer? I Hardly Knew Her! , Adding Logging to Programs
applyLog function, Writer? I Hardly Knew Her!
implementing, Adding Logging to Programs
using Writer monad for, For a Few Monads More
logging, adding to programs, Using do Notation with Writer
logical or (||), using with monoids, Product and Sum
M
main, Separating the Pure from the Impure , Separating the Pure from the Impure , More Fun with To-Do Lists
defining for Hello, world!, Separating the Pure from the Impure
defining for task list, More Fun with To-Do Lists
map function, Implementing flip , Lambdas , Right Folds with foldr
mapM I/O function, sequence
mappend function, The Monoid Type Class , Lists Are Monoids , The Ordering Monoid , The Ordering Monoid , Folding with Monoids , Folding with Monoids , Writer? I Hardly Knew Her! , The Writer Type
using with folds and monoids, Folding with Monoids
using with Maybe and Monoid, The Ordering Monoid
using with Monoid type class, The Monoid Type Class , Lists Are Monoids
using with Ordering values, The Ordering Monoid
using with Writer monad, Writer? I Hardly Knew Her!
using with Writer type, The Writer Type
mapping over lists, Randomness and I/O
maps. See also Data.Map module, Enter Data.Map , Enter Data.Map , Enter Data.Map , Should We Parameterize Our Car? , Trees Are Functors, Too
converting association lists to, Enter Data.Map
converting into functors, Trees Are Functors, Too
type of keys in, Should We Parameterize Our Car?
vs. association lists, Enter Data.Map
max function, curried, Curried Functions
max prefix function, calling, Calling Functions
maxBound function, using with Bounded type, The Read Type Class
maximum function, More List Operations , Hello Recursion! , Hello Recursion!
in recursion example, Hello Recursion!
using with lists, More List Operations
Maybe instance, using with Monad type class, The Monad Type Class
Maybe monad, Writer? I Hardly Knew Her! , Manipulating a Filesystem , Manipulating a Filesystem
using with trees, Manipulating a Filesystem
vs. Writer monad, Writer? I Hardly Knew Her!
Maybe type, Type Parameters , The Functor Type Class , Kinds and Some Type-Foo , Say Hello to Applicative , The Ordering Monoid , Maybe the Monoid , Folding with Monoids , Upgrading Our Applicative Functors , Banana on a Wire
Applicative implementation, Say Hello to Applicative
as functor, The Functor Type Class
as instance of Monoid, The Ordering Monoid
as monad, Upgrading Our Applicative Functors
for folds and monoids, Folding with Monoids
identifying, Kinds and Some Type-Foo
implementation of >>=, Banana on a Wire
wrapping with newtype, Maybe the Monoid
mconcat function, using with Monoid type class, The Monoid Type Class , Maybe the Monoid
mempty function, The Monoid Type Class , The Monoid Type Class , Lists Are Monoids , Lists Are Monoids , do Notation and List Comprehensions , The Writer Type
using with Monoid type class, The Monoid Type Class , Lists Are Monoids
using with Writer type, The Writer Type
vs. mzero, do Notation and List Comprehensions
messages, Caesar Cipher Salad , Caesar Cipher Salad , Caesar Cipher Salad
decoding, Caesar Cipher Salad
encoding, Caesar Cipher Salad
min prefix function, calling, Calling Functions
minBound function, using with Bounded type, The Read Type Class
- (minus) operator, using with sections, Curried Functions
minus (-) operator, using with sections, Curried Functions
module functions, Solving Problems with Module Functions , Counting Words , Caesar Cipher Salad , Caesar Cipher Salad , Caesar Cipher Salad , On Strict Left Folds
Caesar cipher, Caesar Cipher Salad
counting words, Solving Problems with Module Functions
finding numbers, On Strict Left Folds
list management, Counting Words
on strict left folds, Caesar Cipher Salad
modules. See also functions, Modules , Modules , Modules , Modules , Importing Modules , Importing Modules , Importing Modules , Importing Modules , Enter Data.Map , Enter Data.Map , Hierarchical Modules , Improving Shape with the Point Data Type
accessing from GHCi, Modules
advantages of, Modules
exporting functions, Enter Data.Map
exporting shapes in, Improving Shape with the Point Data Type
geometry, Enter Data.Map
hierarchical, Hierarchical Modules
importing, Importing Modules
loosely coupled, Modules
qualified imports of, Importing Modules
reading source code for, Importing Modules
referencing functions from, Importing Modules
Monad instance, Reader? Ugh, Not This Joke Again
monad laws, A Knight’s Quest , Making Monads
Monad type class, The Monad Type Class , The Monad Type Class , The Monad Type Class , The Monad Type Class , The Monad Type Class , The Monad Type Class , I’ll Fly Away , Banana on a Wire , Banana on a Wire , Pierre Returns
>> function, The Monad Type Class , Banana on a Wire
>>= (bind) function, The Monad Type Class
fail function, The Monad Type Class , I’ll Fly Away , Pierre Returns
Maybe instance, The Monad Type Class
return function, The Monad Type Class
monadic functions, liftM and Friends , The join Function , filterM , Composing Monadic Functions , Composing Monadic Functions
composing, Composing Monadic Functions
FilterM, The join Function
FoldM, filterM
join, liftM and Friends
MonadPlus type class, do Notation and List Comprehensions
monads, Upgrading Our Applicative Functors , Upgrading Our Applicative Functors , Code, Code, Code , Banana on a Wire , Banana on a Wire , The List Monad , MonadPlus and the guard Function , MonadPlus and the guard Function , Monad Laws , Right Identity , Right Identity , For a Few Monads More , Reader? Ugh, Not This Joke Again , liftM and Friends , Composing Monadic Functions , Manipulating a Filesystem
applying functions, Code, Code, Code
as monoids, MonadPlus and the guard Function
associativity, Right Identity
do notation, Banana on a Wire
functions as, Reader? Ugh, Not This Joke Again
guard function, MonadPlus and the guard Function
in mtl package, For a Few Monads More
left identity, Monad Laws
making, Composing Monadic Functions
Maybe types as, Upgrading Our Applicative Functors
nested use of >>=, Banana on a Wire
nondeterministic values, The List Monad
purpose of, Upgrading Our Applicative Functors
right identity, Right Identity
using with trees, Manipulating a Filesystem
MonadState type class, The State Monad
Monoid type class, Monoids , The Monoid Type Class , The Monoid Type Class , The Monoid Type Class , The Monoid Type Class , The Monoid Type Class , Lists Are Monoids , Lists Are Monoids , Maybe the Monoid , Folding with Monoids
defining, The Monoid Type Class
mappend function, The Monoid Type Class , Lists Are Monoids , Folding with Monoids
mconcat function, The Monoid Type Class , Maybe the Monoid
mempty function, The Monoid Type Class , Lists Are Monoids
newtype keyword, Monoids
monoid values, including, Using do Notation with Writer
monoids. See also monads, Monoids , The Monoid Type Class , The Monoid Type Class , The Monoid Type Class , The Monoid Type Class , The Monoid Laws , Lists Are Monoids , Product and Sum , Product and Sum , Product and Sum , Product and Sum , Any and All , Any and All , Any and All , The Ordering Monoid , Folding with Monoids , do Notation and List Comprehensions , Writer? I Hardly Knew Her! , Writer? I Hardly Knew Her! , Monoids to the Rescue , Adding Logging to Programs
All type, Any and All
Any newtype constructor, Product and Sum
attaching to values, Monoids to the Rescue
Bool type, Product and Sum
bytestrings as, Writer? I Hardly Knew Her!
comparing strings, The Ordering Monoid
composition of, The Monoid Type Class
Data.Monoid module, Product and Sum
defined, The Monoid Type Class
folding with, Folding with Monoids
laws, The Monoid Laws , Product and Sum
lists as, The Monoid Type Class , Writer? I Hardly Knew Her!
monads as, do Notation and List Comprehensions
newtype keyword, Monoids
numbers as, Lists Are Monoids
Ordering type, Any and All
type class, The Monoid Type Class
using with Writer monad, Adding Logging to Programs
mtl package, monads in, For a Few Monads More
multiplication (*) function, Starting Out
mzero vs. mempty, do Notation and List Comprehensions
N
names, Baby’s First Functions , An Intro to Lists , An Intro to Lists
defining, An Intro to Lists
functions as, Baby’s First Functions
needle and haystack lists, Counting Words
negative number constants, Starting Out
newline (“\n”) character, adding, Grab the Handles!
newStdGen action, Randomness and I/O
newtype declarations, using record syntax in, type vs. newtype vs. data
newtype keyword, Monoids , Wrapping an Existing Type into a New Type , Wrapping an Existing Type into a New Type , Using newtype to Make Type Class Instances , On newtype Laziness , On newtype Laziness , Product and Sum , Maybe the Monoid , Monoids to the Rescue
using, Using newtype to Make Type Class Instances
using with monoids, Monoids
using with Product and Sum types, Product and Sum
using with type class instances, Wrapping an Existing Type into a New Type
using with Writer type, Monoids to the Rescue
vs. data keyword, Wrapping an Existing Type into a New Type , On newtype Laziness
wrapping Maybe with, Maybe the Monoid
newtype wrapper, using with State monad, The State Monad
NO! alert, A Yes-No Type Class , A Yes-No Type Class
nondeterministic values, Pattern Matching and Failure , Composing Monadic Functions , Making Monads
representing, Composing Monadic Functions
using with monads, Pattern Matching and Failure
not Boolean operator, Starting Out
/= (not-equal-to) operator, Starting Out , Type Classes 101
not-equal-to (/=) operator, Starting Out , Type Classes 101
Nothing value, I’ll Fly Away , do Notation , do Notation , Pierre Returns
in do notation, do Notation
in pattern matching, Pierre Returns
producing in Banana on a Wire, I’ll Fly Away
null function, using with lists, More List Operations
Num type class, The Bounded Type Class , A Traffic Light Data Type
number constants, negative, Starting Out
number ranges, listing, Texas Ranges
numbers. See also random generators; RPN expressions, More Examples of map and filter , On Strict Left Folds , Let’s Find Some Cool Numbers , Let’s Find Some Cool Numbers , Enter Data.Map , Randomness and I/O , Lists Are Monoids , MonadPlus and the guard Function
as monoids, Lists Are Monoids
converting characters into, Let’s Find Some Cool Numbers
filtering, MonadPlus and the guard Function
finding via modules, On Strict Left Folds
getting chain of, More Examples of map and filter
guessing, Randomness and I/O
inserting in phoneBook, Enter Data.Map
O
odd function, using with lists, I’m a List Comprehension
operations, Starting Out , Calling Functions , Calling Functions
precedence of, Calling Functions
using in expressions, Starting Out
or (||) Boolean operator, Starting Out
Ord type class, Type Classes 101 , Show Me How to Read , type vs. newtype vs. data
order of operations, specifying, Starting Out
Ordering type, using with monoids, Any and All
otherwise guards, Guards, Guards!
output, filtering via list comprehensions, do Notation and List Comprehensions
P
package, defined, For a Few Monads More
pairs, storing data in, Using Tuples
parameterized types, Should We Parameterize Our Car?
parameters, using = operator with, Calling Functions
() (parentheses), Starting Out , Calling Functions , Baby’s First Functions , Curried Functions , Function Application with $ , Function Application with $ , Function Composition , Function Composition
minimizing use of, Function Application with $ , Function Composition
placement with functions, Baby’s First Functions
using with operations, Starting Out , Calling Functions
using with sections, Curried Functions
parentheses, (), Starting Out , Calling Functions , Baby’s First Functions , Curried Functions , Function Application with $ , Function Application with $ , Function Composition , Function Composition
minimizing use of, Function Application with $ , Function Composition
placement with functions, Baby’s First Functions
using with operations, Starting Out , Calling Functions
using with sections, Curried Functions
pattern matching, Pattern Matching , Pattern Matching , Pattern Matching , Pattern Matching with Tuples , Pattern Matching with Tuples , Pattern Matching with Tuples , Pattern Matching with Lists and List Comprehensions , Pattern Matching with Lists and List Comprehensions , As-patterns , where’s Scope , let It Be , case Expressions , Shaping Up , A Traffic Light Data Type , Using newtype to Make Type Class Instances , Pierre Returns , Making Monads
as-pattern, As-patterns
error function, Pattern Matching with Lists and List Comprehensions
failure in do notation, Pierre Returns
failure of, Pattern Matching
on function parameters, case Expressions
tell function, Pattern Matching with Lists and List Comprehensions
using with constructors, Shaping Up
using with monads, Making Monads
using with newtype keywords, Using newtype to Make Type Class Instances
using with type class instances, A Traffic Light Data Type
with let expressions, let It Be
with list comprehensions, Pattern Matching with Tuples
with lists, Pattern Matching with Tuples
with tuples, Pattern Matching
with where keyword, where’s Scope
x:xs pattern, Pattern Matching with Tuples
patterns, Pattern Matching with Lists and List Comprehensions , Pattern Matching with Lists and List Comprehensions , Writing an RPN Function
using with RPN functions, Writing an RPN Function
vs. guards, Pattern Matching with Lists and List Comprehensions
people, describing via data types, Derived Instances
performance, Copying Files with Bytestrings , Using Difference Lists , Comparing Performance
comparing via Writer monad, Using Difference Lists
enhancing via bytestrings, Copying Files with Bytestrings
. (period), using with functions, Importing Modules
period (.), using with functions, Importing Modules
phoneBook, Almost As Good: Association Lists , Almost As Good: Association Lists , Enter Data.Map , Enter Data.Map , Type Synonyms
association list, Almost As Good: Association Lists , Enter Data.Map
using type synonyms with, Type Synonyms
Pierre example, Walk the Line , do Notation , do Notation
of do notation, do Notation
of monads, Walk the Line
+ (plus) operator, Starting Out , Calling Functions
plus (+) operator, Starting Out , Calling Functions
Point data type, using with shapes, Shaping Up
point-free style, Point-Free Style , Writing an RPN Function , Writing an RPN Function
converting function to, Writing an RPN Function
defining functions in, Point-Free Style
pole, representing in Pierre example, Walk the Line
polymorphic functions, Type Variables
pop function, using with stacks, Stateful Computations , The State Monad
powerset, getting, filterM
predicates, I’m a List Comprehension , I’m a List Comprehension , The map Function
adding to list comprehensions, I’m a List Comprehension
using with filter function, The map Function
prefix functions, calling, Starting Out
Prelude> prompt, Starting Out
print I/O function, putStr
printing, Printing Functions , Printing Functions , Grab the Handles!
functions, Printing Functions
text files to terminal, Grab the Handles!
probabilities, expressing, Making Monads
problems, implementing solutions to, Writing an RPN Function
Product type, using with monoids, Product and Sum
programs, Modules , Transforming Input , Using do Notation with Writer
adding logging to, Using do Notation with Writer
exiting, Transforming Input
prompt, changing, Starting Out
pure method, Using Applicative Functors , Using Applicative Functors , The Applicative Style , The Applicative Style , Zip Lists
using with applicative functors, Using Applicative Functors , The Applicative Style
using with zip lists, Zip Lists
push function, using with stacks, Stateful Computations
put function, using with state, The State Monad
putChar I/O function, putStr
putStr I/O function, Putting It in Reverse
putStrLn function, type of, Hello, World!
Q
quicksort algorithm, zip
R
random data, getting, Dealing with Bad Input
random function, Randomness , Randomness , Randomness , Randomness , Randomness , Randomness and the State Monad
Random type class, Randomness
RandomGen type class, Randomness
StdGen type, Randomness
type signature, Randomness
using, Randomness
random generators, Randomness , Randomness and I/O , Tasteful Stateful Computations
making, Randomness
regenerating, Randomness and I/O
random string, generating, More Random Functions
randomness and I/O, More Random Functions
randoms function, More Random Functions
ranges. See also list ranges, Texas Ranges , Texas Ranges , Texas Ranges
using with floating-point numbers, Texas Ranges
using with lists, Texas Ranges
Rational data type, Making Monads
Read type class, The Ord Type Class
readability, improving via where keyword, where?!
Reader monad, The Reader Monad
readFile function, It’s Bracket Time
reading files, Transforming Input
record syntax, Record Syntax , type vs. newtype vs. data , type vs. newtype vs. data
using in newtype declarations, type vs. newtype vs. data
using to create data types, Record Syntax
rectangles, representing, Defining a New Data Type
recursion, Hello Recursion! , Hello Recursion! , Hello Recursion! , The Code , Maybe As a Functor , Writing the Optimal Path Function , Useful Functions for Applicatives
approaching, The Code
base case, Hello Recursion!
in Heathrow to London example, Writing the Optimal Path Function
in mathematics, Hello Recursion!
using with applicative functors, Useful Functions for Applicatives
using with Functor type class, Maybe As a Functor
recursive data structures, Go Left, Then Right , Go Left, Then Right , Recursive Data Structures , Improving Our List
algebraic data types, Go Left, Then Right
binary search tree, Improving Our List
infix functions, Recursive Data Structures
recursive definition, More Random Functions
recursive functions, Pattern Matching , Pattern Matching with Lists and List Comprehensions , Hello Recursion! , Hello Recursion! , Hello Recursion! , replicate , take , reverse , reverse , repeat , zip , Almost As Good: Association Lists
defining, Hello Recursion!
elem, reverse
maximum, Hello Recursion!
operating on lists, Almost As Good: Association Lists
repeat, repeat
replicate, replicate
reverse, reverse
take, take
writing, Hello Recursion!
zip, zip
repeat function, Texas Ranges , take , take
using recursively, take
using with lists, Texas Ranges
replicate function, Texas Ranges , Maximum Awesome , Maximum Awesome
using recursively, Maximum Awesome
using with lists, Texas Ranges
return function, The Monad Type Class , The Monad Type Class , The Writer Type
in Monad type class, The Monad Type Class
using with Writer type, The Writer Type
reverse function, More List Operations , take , Right Folds with foldr , Right Folds with foldr
using fold with, Right Folds with foldr
using recursively, take
using with lists, More List Operations
reverse polish notation (RPN), Functionally Solving Problems
right fold function, Right Folds with foldr
right triangle, finding, Using Pairs
road system, Calculating the Quickest Path , Writing the Optimal Path Function , Writing the Optimal Path Function
getting from input, Writing the Optimal Path Function
representing, Calculating the Quickest Path
RPN (reverse polish notation), Functionally Solving Problems
RPN calculator, foldM , Making a Safe RPN Calculator , Making a Safe RPN Calculator , Making a Safe RPN Calculator , Making a Safe RPN Calculator
failures, Making a Safe RPN Calculator
folding function, Making a Safe RPN Calculator
making safe, foldM
reads function, Making a Safe RPN Calculator
RPN expressions, calculating, Reverse Polish Notation Calculator
RPN functions. See also functions, Writing an RPN Function , Writing an RPN Function , Writing an RPN Function
sketching, Writing an RPN Function
writing, Writing an RPN Function
RPN operators, Writing an RPN Function
S
scanl function, Folding Infinite Lists
scanr function, Folding Infinite Lists
sections, using with infix functions, Curried Functions
; (semicolon), using with let expressions, let It Be
semicolon (;), using with let expressions, let It Be
sequence I/O function, when
sequenceA function, using with applicative functors, Useful Functions for Applicatives
set comprehensions, I’m a List Comprehension
shapes, Defining a New Data Type , Shaping Up , Improving Shape with the Point Data Type , Improving Shape with the Point Data Type
exporting in modules, Improving Shape with the Point Data Type
improving with Point data type, Shaping Up
representing, Defining a New Data Type
shortlines.txt file, Getting Strings from Input Streams , Getting Strings from Input Streams , Getting Strings from Input Streams
redirecting contents of, Getting Strings from Input Streams
saving, Getting Strings from Input Streams
shortlinesonly.hs program, compiling, Getting Strings from Input Streams
Show type class, The Ord Type Class
side effects, Input and Output
snd function, using with pairs, Using Tuples
sorting lists, Quick, Sort!
source code, reading for modules, Importing Modules
Sphere.hs file, in Geometry module, A Geometry Module
[] (square brackets), using with lists, Baby’s First Functions , Explicit Type Declaration
square brackets ([]), using with lists, Baby’s First Functions , Explicit Type Declaration
square roots, getting for natural numbers, Scans
stack overflow errors, On Strict Left Folds , Getting a Road System from the Input
stacks, Writing an RPN Function , Writing an RPN Function , Stateful Computations , Stateful Computations , Stateful Computations
keeping for RPN functions, Writing an RPN Function
modeling for stateful computations, Stateful Computations
popping elements from, Stateful Computations
pushing elements to, Stateful Computations
State monad. See also monads, Stacks and Stones , Randomness and the State Monad , Randomness and the State Monad
and randomness, Randomness and the State Monad
using, Stacks and Stones
state, getting and setting, The State Monad
stateful computations, Tasteful Stateful Computations , Stateful Computations , Stateful Computations
assigning types to, Stateful Computations
stack modeling, Stateful Computations
steps, using with ranges in lists, Texas Ranges
String and [Char] type, The Read Type Class , Any Day of the Week
String type, using with type synonyms, Making Our Phonebook Prettier , Go Left, Then Right
strings, An Intro to Lists , The Ord Type Class , Needle in the Haystack , Caesar Cipher Salad , Type Synonyms , Getting Strings from Input Streams , Randomness and I/O , Bytestrings , The Ordering Monoid
comparing via monoids, The Ordering Monoid
converting to uppercase, Type Synonyms
encoding, Caesar Cipher Salad
getting, Randomness and I/O
getting from input streams, Getting Strings from Input Streams
isPrefixOf function, Needle in the Haystack
processing files as, Bytestrings
representing values as, The Ord Type Class
subclassing type classes, A Traffic Light Data Type
subtrees, focusing on, Taking a Walk
succ: function, calling, Calling Functions
sum function, More List Operations , I’m a List Comprehension , Left Folds with foldl , Left Folds with foldl
using with fold, Left Folds with foldl
using with lists, More List Operations , I’m a List Comprehension
Sum type, using with monoids, Product and Sum
System.Environment module, Cleaning Up , Cleaning Up , Cleaning Up
getArgs I/O action, Cleaning Up
getProgName I/O action, Cleaning Up
System.IO, openTempFile function, Deleting Items
System.Random module, Randomness , Randomness , More Random Functions , More Random Functions
getStdGen I/O action, More Random Functions
mkStdGen function, Randomness
random function, Randomness
T
tail function, using with lists, Comparing Lists
tails function, Counting Words
take function, More List Operations , replicate , replicate
using recursively, replicate
using with lists, More List Operations
takeWhile function, More Examples of map and filter , Scans
task list program, More Fun with To-Do Lists , More Fun with To-Do Lists , More Fun with To-Do Lists , A Multitasking Task List , A Multitasking Task List , A Multitasking Task List , A Multitasking Task List , A Multitasking Task List , A Multitasking Task List , Dealing with Bad Input , Dealing with Bad Input
add function, More Fun with To-Do Lists , Dealing with Bad Input
bad input, Dealing with Bad Input
calling, More Fun with To-Do Lists
dispatch function, A Multitasking Task List
implementing functions, More Fun with To-Do Lists
list-viewing functionality, A Multitasking Task List
remove function, A Multitasking Task List
running, A Multitasking Task List
view function, A Multitasking Task List
tasks. See to-do list, Adding Logging to Programs
tell function, using with log values, Adding Logging to Programs
terminal, Reading and Writing Files , Reading and Writing Files , Grab the Handles! , Grab the Handles!
printing text files to, Grab the Handles!
reading from, Reading and Writing Files
writing to, Reading and Writing Files
text files, printing to terminal, Grab the Handles!
threeCoins stateful computation, Randomness and the State Monad
thunk, defined, Bytestrings
to-do list, Grab the Handles! , To-Do Lists , Deleting Items , Deleting Items , Command-Line Arguments , Command-Line Arguments , Command-Line Arguments , More Fun with To-Do Lists , More Fun with To-Do Lists
adding tasks to, Command-Line Arguments
appendFile function, Grab the Handles!
bracketOnError function, Deleting Items
cleaning up, Deleting Items
deleting items from, To-Do Lists
functionality, Command-Line Arguments
removing tasks from, More Fun with To-Do Lists
viewing tasks, More Fun with To-Do Lists
traffic light, defining states of, Inside the Eq Type Class , A Yes-No Type Class
Tree type constructor, as instance of Functor, Maybe As a Functor
trees. See also zippers, Improving Our List , Improving Our List , Trees Are Functors, Too , Folding with Monoids , Folding with Monoids , Folding with Monoids , Folding with Monoids , Zippers , Taking a Walk , Taking a Walk , Going Back Up , Going Back Up , Manipulating Trees Under Focus , Manipulating a Filesystem , Manipulating a Filesystem
balancing, Improving Our List
converting to lists, Folding with Monoids
going to tops of, Manipulating Trees Under Focus
in zippers example, Zippers
manipulating under focus, Going Back Up
mapping, Trees Are Functors, Too
moving up in, Going Back Up
nodes for monoids, Folding with Monoids
nonempty node for monoids, Folding with Monoids
providing safety nets for, Manipulating a Filesystem
representing breadcrumbs, Taking a Walk
subtrees of, Taking a Walk
using monads with, Manipulating a Filesystem
using with folds and monoids, Folding with Monoids
triangle, right, Using Pairs
triples, Pattern Matching with Tuples , Pattern Matching with Tuples , Representing the Road System in Haskell
pattern matching, Pattern Matching with Tuples
using with road system, Representing the Road System in Haskell
True Boolean value, Starting Out
tuples, I’m a List Comprehension , Tuples , Tuples , Tuples , Tuples , Tuples , Tuples , Using Tuples , Using Tuples , Using Tuples , Using Pairs , Finding the Right Triangle , Explicit Type Declaration , Common Haskell Types , Pattern Matching , Defining a New Data Type , Representing the Road System in Haskell
as types, Common Haskell Types
changing vectors to, Tuples
fixed size of, Tuples
pairs, Using Tuples
pattern matching with, Pattern Matching
triples, Using Tuples , Finding the Right Triangle
using, Tuples
using commas with, Tuples
using parentheses with, Tuples
using with list comprehensions, Using Pairs
using with road system, Representing the Road System in Haskell
using with shapes, Defining a New Data Type
vs. lists, I’m a List Comprehension , Using Tuples , Explicit Type Declaration
two-dimensional vector, representing, Tuples
:t (type) command, Explicit Type Declaration , Common Haskell Types , Implementing zipWith
type annotations, The Ord Type Class
type class constraints, Should We Parameterize Our Car?
type class instances, using newtype with, Wrapping an Existing Type into a New Type
type classes, Type Variables , Type Classes 101 , Type Classes 101 , The Ord Type Class , The Ord Type Class , The Read Type Class , The Read Type Class , The Bounded Type Class , The Bounded Type Class , The Integral Type Class , Some Final Notes on Type Classes , Vector von Doom , Derived Instances , Equating People , Equating People , Show Me How to Read , Order in the Court! , Order in the Court! , Type Classes 102 , Type Classes 102 , Inside the Eq Type Class , A Traffic Light Data Type , Parameterized Types As Instances of Type Classes , Parameterized Types As Instances of Type Classes , Parameterized Types As Instances of Type Classes , A Yes-No Type Class , The Functor Type Class , Applicative Functors , type vs. newtype vs. data , The Monad Type Class
Bounded, The Read Type Class , Order in the Court!
displaying instances of, Parameterized Types As Instances of Type Classes
Enum, The Read Type Class , Order in the Court!
Eq, Type Classes 101 , Derived Instances , Type Classes 102 , Parameterized Types As Instances of Type Classes
Floating, The Bounded Type Class
Functor, The Functor Type Class
instances of, Parameterized Types As Instances of Type Classes
Integral, The Integral Type Class
minimum complete definition of, Inside the Eq Type Class
Monad, The Monad Type Class
Num, The Bounded Type Class
open quality of, Applicative Functors
Ord, Type Classes 101 , Show Me How to Read
Read, The Ord Type Class , Equating People
reviewing, Type Classes 102
Show, The Ord Type Class , Equating People
subclassing, A Traffic Light Data Type
using, type vs. newtype vs. data
YesNo, A Yes-No Type Class
type constructors, Type Parameters , Vector von Doom , Parameterizing Type Synonyms , Parameterized Types As Instances of Type Classes , Either a As a Functor , Either a As a Functor , Applicative Functors , Law 2
applying types to, Either a As a Functor
as instances of Functor type class, Applicative Functors , Law 2
parameters, Either a As a Functor
type parameters for, Parameterized Types As Instances of Type Classes
vs. value constructors, Vector von Doom , Parameterizing Type Synonyms
type declarations, Explicit Type Declaration , Printing Functions , Some Higher-Orderism Is in Order , Writing an RPN Function
for zipWith function, Some Higher-Orderism Is in Order
in higher-order functions, Printing Functions
type inference, Believe the Type
type instances, making, Inside the Eq Type Class
type keyword, Type Synonyms , On newtype Laziness
type names, capitalization of, Explicit Type Declaration , Common Haskell Types
type parameters, Explicit Type Declaration , Explicit Type Declaration , Explicit Type Declaration , Explicit Type Declaration , Common Haskell Types , Common Haskell Types , Common Haskell Types , Common Haskell Types , Type Parameters , Type Parameters , Should We Parameterize Our Car?
Bool, Common Haskell Types
Char, Common Haskell Types
Double, Common Haskell Types
Float, Explicit Type Declaration
Int, Explicit Type Declaration
Integer, Explicit Type Declaration
of functions, Explicit Type Declaration
passing types as, Type Parameters
tuples as, Common Haskell Types
using, Should We Parameterize Our Car?
type signatures, Shaping Up
type synonyms, Type Synonyms , Making Our Phonebook Prettier , Parameterizing Type Synonyms , type vs. newtype vs. data , MonadPlus and the guard Function , Making a Zipper for Our Filesystem
Either a b type, Parameterizing Type Synonyms
for knight’s position, MonadPlus and the guard Function
for zipper in filesystem, Making a Zipper for Our Filesystem
parameterizing, Making Our Phonebook Prettier
type system, Believe the Type
type variables, Common Haskell Types , The Applicative Style
U
undefined value, Using newtype to Make Type Class Instances
_ (underscore), I’m a List Comprehension , Pattern Matching with Tuples , Pattern Matching with Lists and List Comprehensions
in pattern matching, Pattern Matching with Lists and List Comprehensions
using with lists, I’m a List Comprehension
underscore (_), I’m a List Comprehension , Pattern Matching with Tuples , Pattern Matching with Lists and List Comprehensions
in pattern matching, Pattern Matching with Lists and List Comprehensions
using with lists, I’m a List Comprehension
V
value constructors, Defining a New Data Type , Defining a New Data Type , Shaping Up , Improving Shape with the Point Data Type , Improving Shape with the Point Data Type , Exporting Our Shapes in a Module , Type Parameters , Vector von Doom , Parameterizing Type Synonyms , Parameterizing Type Synonyms , Parameterizing Type Synonyms
as functions, Defining a New Data Type , Shaping Up , Exporting Our Shapes in a Module
exporting, Improving Shape with the Point Data Type
for Either a b type, Parameterizing Type Synonyms
parameters, Type Parameters
using .. (dots) with, Improving Shape with the Point Data Type
using with shapes, Defining a New Data Type
vs. type constructors, Vector von Doom , Parameterizing Type Synonyms
values with contexts, using monads with, Upgrading Our Applicative Functors
values. See also log values, Starting Out , Baby’s First Functions , Type Classes 101 , The Ord Type Class , Lambdas , Let’s Find Some Cool Numbers , Monoids to the Rescue , Error Error on the Wall , Error Error on the Wall , Zippers , A Trail of Breadcrumbs
adding context of failure to, Error Error on the Wall
applying functions to, A Trail of Breadcrumbs
attaching monoids to, Monoids to the Rescue
concept of, Zippers
expressing as strings, The Ord Type Class
mapping keys to, Let’s Find Some Cool Numbers
reducing data structures to, Lambdas
returning in functions, Baby’s First Functions
testing for equality, Starting Out
using Ord type class with, Type Classes 101
variables, Pattern Matching with Lists and List Comprehensions , Pattern Matching with Lists and List Comprehensions , Pattern Matching with where
binding to, Pattern Matching with Lists and List Comprehensions
binding via let expressions, Pattern Matching with where
vectors, Tuples , Tuples , Should We Parameterize Our Car?
changing to tuples, Tuples
implementing types for, Should We Parameterize Our Car?
| (vertical pipe), Guards, Guards! , Making Our Own Types and Type Classes , Making Our Own Types and Type Classes , Vector von Doom
using with data keyword, Making Our Own Types and Type Classes
using with data types, Vector von Doom
using with guards, Guards, Guards!
vertical pipe (|), Guards, Guards! , Making Our Own Types and Type Classes , Making Our Own Types and Type Classes , Vector von Doom
using with data keyword, Making Our Own Types and Type Classes
using with data types, Vector von Doom
using with guards, Guards, Guards!
W
when I/O function, print
where bindings vs. let expressions, Pattern Matching with where
where blocks, functions in, Pattern Matching with where
where keyword, Guards, Guards! , where’s Scope , where’s Scope
pattern matching with, where’s Scope
scope of, where’s Scope
while loops, Randomness and I/O
withFile function, using in I/O, Reading and Writing Files
words, counting, Solving Problems with Module Functions
words.txt file, creating and saving, Transforming Input
writeFile function, It’s Bracket Time
Writer monad, For a Few Monads More , Writer? I Hardly Knew Her! , Writer? I Hardly Knew Her! , Writer? I Hardly Knew Her! , The Writer Type , Using do Notation with Writer , Adding Logging to Programs , Adding Logging to Programs , Inefficient List Construction , Using Difference Lists , The State Monad
adding logging to programs, Using do Notation with Writer
applyLog function, Writer? I Hardly Knew Her!
changing log type, Writer? I Hardly Knew Her!
comparing performance, Using Difference Lists
difference lists, Inefficient List Construction
inefficient list construction, Adding Logging to Programs
using do notation with, The Writer Type
using monoids with, Writer? I Hardly Knew Her! , Adding Logging to Programs
vs. State monad, The State Monad
Writer type, Monoids to the Rescue
writing files, Reading and Writing Files
X
x:xs pattern, using, Pattern Matching with Tuples
Y
YEAH! alert, A Yes-No Type Class , A Yes-No Type Class
YesNo type class, A Yes-No Type Class
Z
zip function, Using Tuples , take , take
using recursively, take
using with pairs, Using Tuples
zip lists, Zip Lists , Wrapping an Existing Type into a New Type
zippers. See also data structures; trees, Going Back Up , Going Back Up , Going Back Up , Focusing on Lists , Focusing on Lists , Focusing on Lists
defined, Going Back Up
filesystem example, Focusing on Lists
focus of, Going Back Up
for lists, Focusing on Lists
using with data structures, Focusing on Lists
zipWith function, Some Higher-Orderism Is in Order , Lambdas