Write Yourself a Scheme in 48 Hours starts off with
command-line arguments and parsing, and progresses to writing a
fully-functional Scheme interpreter that implements a good-sized subset
of R5RS Scheme. Along the way, the reader learns Haskell's I/O, mutable
state, dynamic typing, error handling, and parsing features. By the end
of the book, the reader should be fairly fluent in both
Haskell and Scheme.
Chapters cover:
Overview
First Steps: Compiling and running
Parsing
A Simple Parser - using the Parsec library
Whitespace - add
a series of improvements to the simple parser that will let it
recognize progressively more complicated expressions
Literal Numbers and Strings: Return Values - learn
how to define a data type, and how to modify our parser so that it
returns this data type
Lists, Dotted Lists, and Quoted Data: Recursive
Parsers - add a few more parser actions to the interpreter
Evaluation, Part 1
Displaying Values: Show and Typeclasses - the first
steps towards a working Scheme
interpreter: assigning values to program fragments
Evaluation, Part 2 - additional primitives: partial
application, conditionals: pattern matching 2, list primitives: car,
cdr, and cons, equal? and weak typing: heterogenous lists
Building a REPL: Basic I/O - build a system
that can execute multiple statements without exiting the program
Adding Variables and Assignment: Mutable State in
Haskell
Defining Scheme Functions: Closures and Environments
- define your own functions within Scheme and use them from other
functions
Creating IO Primitives: File I/O
Towards a Standard Library: Fold and Unfold
- implement two primitive recursion operators
(fold and unfold) and then define our whole library based on
those
Conclusion & Further Resources
5. The Haskell School of Music -- From Signals
to Symphonies
The Haskell School of Music -- From Signals
to Symphonies (a work in progress) is a book that describes Euterpea,
a computer music library developed in Haskell. The library allows
programming computer music applications both at the note level and the
signal level.
An Overview of Computer Music, Euterpea, and Haskell
- introduces some of the fundamental ideas of functional programming in
Haskell
Simple Music - reveals the actual
definitions of Euterpea’s functions and operators, such as note,
rest,(:+:),(:=:), and
trans. In addition, a number of other musical ideas are developed, and
in the process more Haskell features are introduced
Polymorphic and Higher-Order Functions - covers
abstraction over recursive definitions, append, fold, reversing a list,
currying, and errors
A Musical Interlude - an existing composition is
transcribed into Euterpea. Then a simple form
of algorithmic composition is presented
Syntactic Magic - introduces several more of
Haskell’s syntactic devices that facilitate writing concise and
intuitive programs. It covers sections, anonymous functions, list
comprehensions, function composition, higher-order thinking, and infix
function application
More Music - explores a number of simple
musical ideas, and contributes to a growing collection of Euterpea
functions for expressing those ideas
Qualified Types - introduces the notions of qualified
types and type classes
Interpretation and Performance - abstract
performance, players, and putting it all together
Self-Similar Music - explores the notion of
self-similar music — i.e. musical structures that have patterns that
repeat themselves recursively in interesting ways
Proof by Induction - studies a powerful proof
technique based on mathematical induction
An Algebra of Music - explores a number of properties
of the Music data type and functions defined on it, properties that
collectively form an algebra of music
Musical L-Systems - generative grammars, a simple
implementation, grammars in Haskell, and an L-System grammar for music
Random Numbers, Probability Distributions, and Markov
Chains - explores several sources of random numbers and how to use them
in generating simple melodies
From Performance to MIDI - describes how to convert
an abstract performance into a standard Midi file that can be played on
any modern PC with a standard sound card
Basic Input/Output - expands on the play function
Musical User Interface - describes an elegant way to
do IO involving a "musical user interface," or MUI
Sound and Signals - studies the fundamental nature of
sound and its basic mathematical representation as a signal. The
chapter also discusses discrete digital
representations of a signal
Euterpea’s Signal Functions - shows how the
theoretical concepts involving sound and signals studied in the last
chapter are manifested in Euterpea
Spectrum Analysis - discusses the theory as well as
the pragmatics for doing spectrum analysis in Euterpea
Additive Synthesis - add signals (usually sine waves
of differing amplitudes, frequencies and phases) together to form a
sound of interes
Yet Another Haskell Tutorial provides a complete
introduction to the Haskell programming language. It assumes
no knowledge of the Haskell language or familiarity with functional
programming in general.
Chapters cover:
Introduction
Getting Started
Language Basics - presents the basic concepts
of Haskell and the basic syntax of Haskell
Type Basics - uses a system of static type
checking. This means that every expression in Haskell is assigned a type
Basic Input/Output
Modules - program subcomponents are divided
into modules
Advanced Features - examines sections and infix
operators, local declarations, partial application, pattern matching,
guards, instance declarations, datatypes revisited, more lists, arrays,
maps, layout, and the final word on lists
Advanced Types - type synonyms, newtypes, datatypes,
classes, instances, kinds, class hierarchies, and default
Monads - program subcomponents are divided
into modules