Online Book Reader

Home Category

Learn You a Haskell for Great Good! - Miran Lipovaca [185]

By Root 533 0
of the Week

Type Synonyms

Making Our Phonebook Prettier

Parameterizing Type Synonyms

Go Left, Then Right

Recursive Data Structures

Improving Our List

Let's Plant a Tree

Type Classes 102

Inside the Eq Type Class

A Traffic Light Data Type

Subclassing

Parameterized Types As Instances of Type Classes

A Yes-No Type Class

The Functor Type Class

Maybe As a Functor

Trees Are Functors, Too

Either a As a Functor

Kinds and Some Type-Foo

8. Input and Output

Separating the Pure from the Impure

Hello, World!

Gluing I/O Actions Together

Using let Inside I/O Actions

Putting It in Reverse

Some Useful I/O Functions

putStr

putChar

print

when

sequence

mapM

forever

forM

I/O Action Review

9. More Input and More Output

Files and Streams

Input Redirection

Getting Strings from Input Streams

Transforming Input

Reading and Writing Files

Using the withFile Function

It's Bracket Time

Grab the Handles!

To-Do Lists

Deleting Items

Cleaning Up

Command-Line Arguments

More Fun with To-Do Lists

A Multitasking Task List

Dealing with Bad Input

Randomness

Tossing a Coin

More Random Functions

Randomness and I/O

Bytestrings

Strict and Lazy Bytestrings

Copying Files with Bytestrings

10. Functionally Solving Problems

Reverse Polish Notation Calculator

Calculating RPN Expressions

Writing an RPN Function

Adding More Operators

Heathrow to London

Calculating the Quickest Path

Representing the Road System in Haskell

Writing the Optimal Path Function

Getting a Road System from the Input

11. Applicative Functors

Functors Redux

I/O Actions As Functors

Functions As Functors

Functor Laws

Law 1

Law 2

Breaking the Law

Using Applicative Functors

Say Hello to Applicative

Maybe the Applicative Functor

The Applicative Style

Lists

IO Is An Applicative Functor, Too

Functions As Applicatives

Zip Lists

Applicative Laws

Useful Functions for Applicatives

12. Monoids

Wrapping an Existing Type into a New Type

Using newtype to Make Type Class Instances

On newtype Laziness

type vs. newtype vs. data

About Those Monoids

The Monoid Type Class

The Monoid Laws

Meet Some Monoids

Lists Are Monoids

Product and Sum

Any and All

The Ordering Monoid

Maybe the Monoid

Folding with Monoids

13. A Fistful of Monads

Upgrading Our Applicative Functors

Getting Your Feet Wet with Maybe

The Monad Type Class

Walk the Line

Code, Code, Code

I'll Fly Away

Banana on a Wire

do Notation

Do As I Do

Pierre Returns

Pattern Matching and Failure

The List Monad

do Notation and List Comprehensions

MonadPlus and the guard Function

A Knight's Quest

Monad Laws

Left Identity

Right Identity

Associativity

14. For a Few Monads More

Writer? I Hardly Knew Her!

Monoids to the Rescue

The Writer Type

Using do Notation with Writer

Adding Logging to Programs

Inefficient List Construction

Using Difference Lists

Comparing Performance

Reader? Ugh, Not This Joke Again

Functions As Monads

The Reader Monad

Tasteful Stateful Computations

Stateful Computations

Stacks and Stones

The State Monad

Getting and Setting State

Randomness and the State Monad

Error Error on the Wall

Some Useful Monadic Functions

liftM and Friends

The join Function

filterM

foldM

Making a Safe RPN Calculator

Composing Monadic Functions

Making Monads

15. Zippers

Taking a Walk

A Trail of Breadcrumbs

Going Back Up

Manipulating Trees Under Focus

Going Straight to the Top, Where the Air Is Fresh and Clean!

Focusing on Lists

A Very Simple

Return Main Page Previous Page Next Page

®Online Book Reader