pregleda

Real World Haskell


Cena:
2.000 din
Želi ovaj predmet: 3
Stanje: Polovan bez oštećenja
Garancija: Ne
Isporuka: Pošta
Post Express
Lično preuzimanje
Plaćanje: Tekući račun (pre slanja)
Lično
Grad: Beograd-Zvezdara,
Beograd-Zvezdara
Prodavac

ljilja_bgd (1038)

100% pozitivnih ocena

Pozitivne: 5542

  Pošalji poruku

Svi predmeti člana


Kupindo zaštita

ISBN: 0596514980
Godina izdanja: 2008
Jezik: Engleski
Oblast: Programski jezici
Autor: Strani

Bryan O`Sullivan, John Goerzen, Don Stewart - Real World Haskell
O`Reilly Media, 2008
670
meki povez
stanje: vrlo dobro

This easy-to-use, fast-moving tutorial introduces you to functional programming with Haskell. You`ll learn how to use Haskell in a variety of practical ways, from short scripts to large and demanding applications. Real World Haskell takes you through the basics of functional programming at a brisk pace, and then helps you increase your understanding of Haskell in real-world issues like I/O, performance, dealing with data, concurrency, and more as you move through each chapter. With this book, you will:
Understand the differences between procedural and functional programming:

Learn the features of Haskell, and how to use it to develop useful programs
Interact with filesystems, databases, and network services
Write solid code with automated tests, code coverage, and error handling
Harness the power of multicore systems via concurrent and parallel programming

You`ll find plenty of hands-on exercises, along with examples of real Haskell programs that you can modify, compile, and run. Whether or not you`ve used a functional language before, if you want to understand why Haskell is coming into its own as a practical language in so many major organizations, Real World Haskell is the best place to start.

Contents:
Preface xxiii
Getting Started
Your Haskell Environment
Getting Started with ghci, the Interpreter
Basic Interaction: Using ghci as a Calculator
Simple Arithmetic
An Arithmetic Quirk: Writing Negative Numbers
Boolean Logic, Operators, and Value Comparisons
Operator Precedence and Associativity
Undefined Values, and Introducing Variables
Dealing with Precedence and Associativity Rules
Command-Line Editing in ghci
Lists
Operators on Lists
Strings and Characters
First Steps with Types
A Simple Program
Types and Functions
Why Care About Types?
Haskell`s Type System
Strong Types
Static Types
Type Inference
What to Expect from the Type System
Some Common Basic Types
Function Application
Useful Composite Data Types: Lists and Tuples
Functions over Lists and Tuples
Passing an Expression to a Function
Function Types and Purity
Haskell Source Files, and Writing Simple Functions
Just What Is a Variable, Anyway?
Conditional Evaluation
Understanding Evaluation by Example
Lazy Evaluation
A More Involved Example
Recursion
Ending the Recursion
Returning from the Recursion
What Have We Learned?
Polymorphism in Haskell
Reasoning About Polymorphic Functions
Further Reading
The Type of a Function of More Than One Argument
Why the Fuss over Purity?
Conclusion
Defining Types, Streamlining Functions
Defining a New Data Type
41 (2)
Naming Types and Values
43 (1)
Type Synonyms
43 (1)
Algebraic Data Types
44 (6)
Tuples, Algebraic Data Types, and When to Use Each
45 (2)
Analogues to Algebraic Data Types in Other Languages
47 (3)
Pattern Matching
50 (5)
Construction and Deconstruction
51 (1)
Further Adventures
52 (1)
Variable Naming in Patterns
53 (1)
The Wild Card Pattern
53 (1)
Exhaustive Patterns and Wild Cards
54 (1)
Record Syntax
55 (2)
Parameterized Types
57 (1)
Recursive Types
58 (2)
Reporting Errors
60 (1)
A More Controlled Approach
61 (1)
Introducing Local Variables
61 (3)
Shadowing
62 (1)
The where Clause
63 (1)
Local Functions, Global Variables
63 (1)
The Offside Rule and Whitespace in an Expression
64 (2)
A Note About Tabs Versus Spaces
66 (1)
The Offside Rule Is Not Mandatory
66 (1)
The case Expression
66 (1)
Common Beginner Mistakes with Patterns
67 (1)
Incorrectly Matching Against a Variable
67 (1)
Incorrectly Trying to Compare for Equality
68 (1)
Conditional Evaluation with Guards
68 (3)
Functional Programming
71 (40)
Thinking in Haskell
71 (1)
A Simple Command-Line Framework
71 (1)
Warming Up: Portably Splitting Lines of Text
72 (4)
A Line-Ending Conversion Program
75 (1)
Infix Functions
76 (1)
Working with Lists
77 (7)
Basic List Manipulation
78 (1)
Safely and Sanely Working with Crashy Functions
79 (1)
Partial and Total Functions
79 (1)
More Simple List Manipulations
80 (1)
Working with Sublists
81 (1)
Searching Lists
82 (1)
Working with Several Lists at Once
83 (1)
Special String-Handling Functions
84 (1)
How to Think About Loops
84 (15)
Explicit Recursion
85 (2)
Transforming Every Piece of Input
87 (1)
Mapping over a List
88 (2)
Selecting Pieces of Input
90 (1)
Computing One Answer over a Collection
90 (2)
The Left Fold
92 (1)
Why Use Folds, Maps, and Filters?
93 (1)
Folding from the Right
94 (2)
Left Folds, Laziness, and Space Leaks
96 (3)
Further Reading
99 (1)
Anonymous (lambda) Functions
99 (1)
Partial Function Application and Currying
100 (3)
Sections
102 (1)
As-patterns
103 (1)
Code Reuse Through Composition
104 (3)
Use Your Head Wisely
107 (1)
Tips for Writing Readable Code
107 (1)
Space Leaks and Strict Evaluation
108 (3)
Avoiding Space Leaks with seq
108 (1)
Learning to Use seq
109 (2)
Writing a Library: Working with JSON Data
111 (24)
A Whirlwind Tour of JSON
111 (1)
Representing JSON Data in Haskell
111 (2)
The Anatomy of a Haskell Module
113 (1)
Compiling Haskell Source
114 (1)
Generating a Haskell Program and Importing Modules
114 (1)
Printing JSON Data
115 (2)
Type Inference Is a Double-Edged Sword
117 (1)
A More General Look at Rendering
118 (1)
Developing Haskell Code Without Going Nuts
119 (1)
Pretty Printing a String
120 (2)
Arrays and Objects, and the Module Header
122 (1)
Writing a Module Header
123 (1)
Fleshing Out the Pretty-Printing Library
124 (7)
Compact Rendering
127 (1)
True Pretty Printing
128 (1)
Following the Pretty Printer
129 (2)
Creating a Package
131 (3)
Writing a Package Description
131 (2)
GHC`s Package Manager
133 (1)
Setting Up, Building, and Installing
133 (1)
Practical Pointers and Further Reading
134 (1)
Using Typedasses
135 (30)
The Need for Typeclasses
135 (1)
What Are Typeclasses?
136 (3)
Declaring Typeclass Instances
139 (1)
Important Built-in Typeclasses
139 (9)
Show
139 (2)
Read
141 (2)
Serialization with read and show
143 (1)
Numeric Types
144 (4)
Equality, Ordering, and Comparisons
148 (1)
Automatic Derivation
148 (1)
Typeclasses at Work: Making JSON Easier to Use
149 (3)
More Helpful Errors
151 (1)
Making an Instance with a Type Synonym
151 (1)
Living in an Open World
152 (3)
When Do Overlapping Instances Cause Problems?
153 (1)
Relaxing Some Restrictions on Typeclasses
154 (1)
How Does Show Work for Strings?
155 (1)
How to Give a Type a New Identity
155 (4)
Differences Between Data and Newtype Declarations
157 (1)
Summary: The Three Ways of Naming Types
158 (1)
JSON Typeclasses Without Overlapping Instances
159 (3)
The Dreaded Monomorphism Restriction
162 (1)
Conclusion
163 (2)
I/O
165 (28)
Classic I/O in Haskell
165 (4)
Pure Versus I/O
168 (1)
Why Purity Matters
169 (1)
Working with Files and Handles
169 (6)
More on openFile
171 (1)
Closing Handles
172 (1)
Seek and Tell
172 (1)
Standard Input, Output, and Error
173 (1)
Deleting and Renaming Files
174 (1)
Temporary Files
174 (1)
Extended Example: Functional I/O and Temporary Files
175 (3)
Lazy I/O
178 (5)
hGetContents
178 (2)
readFile and writeFile
180 (1)
A Word on Lazy Output
181 (1)
interact
181 (2)
The IO Monad
183 (5)
Actions
183 (3)
Sequencing
186 (1)
The True Nature of Return
187 (1)
Is Haskell Really Imperative?
188 (1)
Side Effects with Lazy I/O
188 (1)
Buffering
189 (1)
Buffering Modes
189 (1)
Flushing The Buffer
190 (1)
Reading Command-Line Arguments
190 (1)
Environment Variables
191 (2)
Efficient File Processing, Regular Expressions, and Filename Matching
193 (20)
Efficient File Processing
193 (4)
Binary I/O and Qualified Imports
194 (1)
Text I/O
195 (2)
Filename Matching
197 (1)
Regular Expressions in Haskell
198 (2)
The Many Types of Result
198 (2)
More About Regular Expressions
200 (2)
Mixing and Matching String Types
200 (1)
Other Things You Should Know
201 (1)
Translating a glob Pattern into a Regular Expression
202 (3)
An important Aside: Writing Lazy Functions
205 (1)
Making Use of Our Pattern Matcher
206 (4)
Handling Errors Through API Design
210 (1)
Putting Our Code to Work
211 (2)
I/O Case Study: A Library for Searching the Filesystem
213 (22)
The find Command
213 (1)
Starting Simple: Recursively Listing a Directory
213 (2)
Revisiting Anonymous and Named Functions
214 (1)
Why Provide Both mapM and forM?
215 (1)
A Naive Finding Function
215 (2)
Predicates: From Poverty to Riches, While Remaining Pure
217 (2)
Sizing a File Safely
219 (2)
The Acquire-Use-Release Cycle
221 (1)
A Domain-Specific Language for Predicates
221 (5)
Avoiding Boilerplate with Lifting
223 (1)
Gluing Predicates Together
224 (1)
Defining and Using New Operators
225 (1)
Controlling Traversal
226 (2)
Density, Readability, and the Learning Process
228 (1)
Another Way of Looking at Traversal
229 (3)
Useful Coding Guidelines
232 (3)
Common Layout Styles
233 (2)
Code Case Study: Parsing a Binary Data Format
235 (20)
Grayscale Files
235 (1)
Parsing a Raw PGM File
236 (2)
Getting Rid of Boilerplate Code
238 (1)
Implicit State
239 (5)
The Identity Parser
240 (1)
Record Syntax, Updates, and Pattern Matching
241 (1)
A More Interesting Parser
242 (1)
Obtaining and Modifying the Parse State
242 (1)
Reporting Parse Errors
243 (1)
Chaining Parsers Together
243 (1)
Introducing Functors
244 (6)
Constraints on Type Definitions Are Bad
247 (1)
Infix Use of fmap
248 (1)
Flexible Instances
248 (1)
Thinking More About Functors
249 (1)
Writing a Functor Instance for Parse
250 (1)
Using Functors for Parsing
251 (1)
Rewriting Our PGM Parser
252 (2)
Future Directions
254 (1)
Testing and Quality Assurance
255 (14)
QuickCheck: Type-Based Testing
256 (3)
Testing for Properties
257 (2)
Testing Against a Model
259 (1)
Testing Case Study: Specifying a Pretty Printer
259 (6)
Generating Test Data
259 (3)
Testing Document Construction
262 (1)
Using Lists as a Model
263 (1)
Putting It All Together
264 (1)
Measuring Test Coverage with HPC
265 (4)
Barcode Recognition
269 (30)
A Little Bit About Barcodes
269 (1)
EAN-13 Encoding
270 (1)
Introducing Arrays
270 (5)
Arrays and Laziness
273 (1)
Folding over Arrays
273 (1)
Modifying Array Elements
274 (1)
Encoding an EAN-13 Barcode
275 (1)
Constraints on Our Decoder
275 (1)
Divide and Conquer
276 (2)
Turning a Color Image into Something Tractable
278 (2)
Parsing a Color Image
278 (1)
Grayscale Conversion
279 (1)
Grayscale to Binary and Type Safety
279 (1)
What Have We Done to Our Image?
280 (2)
Finding Matching Digits
282 (6)
Run Length Encoding
282 (1)
Scaling Run Lengths, and Finding Approximate Matches
283 (1)
List Comprehensions
284 (1)
Remembering a Match`s Parity
285 (2)
Chunking a List
287 (1)
Generating a List of Candidate Digits
287 (1)
Life Without Arrays or Hash Tables
288 (4)
A Forest of Solutions
288 (1)
A Brief Introduction to Maps
289 (3)
Further Reading
292 (1)
Turning Digit Soup into an Answer
292 (3)
Solving for Check Digits in Parallel
292 (2)
Completing the Solution Map with the First Digit
294 (1)
Finding the Correct Sequence
295 (1)
Working with Row Data
295 (1)
Pulling It All Together
296 (1)
A Few Comments on Development Style
297 (2)
Data Structures
299 (26)
Association Lists
299 (2)
Maps
301 (2)
Functions Are Data, Too
303 (1)
Extended Example: /etc/passwd
304 (3)
Extended Example: Numeric Types
307 (10)
First Steps
309 (2)
Completed Code
311 (6)
Taking Advantage of Functions as Data
317 (5)
Turning Difference Lists into a Proper Library
318 (2)
Lists, Difference Lists, and Monoids
320 (2)
General-Purpose Sequences
322 (3)
Monads
325 (34)
Revisiting Earlier Code Examples
325 (2)
Maybe Chaining
325 (1)
Implicit State
326 (1)
Looking for Shared Patterns
327 (2)
The Monad Typeclass
329 (1)
And Now, a Jargon Moment
330 (1)
Using a New Monad: Show Your Work!
331 (3)
Information Hiding
331 (1)
Controlled Escape
332 (1)
Leaving a Trace
332 (1)
Using the Logger Monad
333 (1)
Mixing Pure and Monadic Code
334 (2)
Putting a Few Misconceptions to Rest
336 (1)
Building the Logger Monad
336 (2)
Sequential Logging, Not Sequential Evaluation
337 (1)
The Writer Monad
337 (1)
The Maybe Monad
338 (2)
Executing the Maybe Monad
338 (1)
Maybe at Work, and Good API Design
338 (2)
The List Monad
340 (4)
Understanding the List Monad
342 (1)
Putting the List Monad to Work
343 (1)
Desugaring of do Blocks
344 (2)
Monads as a Programmable Semicolon
345 (1)
Why Go Sugar-Free?
346 (1)
The State Monad
346 (8)
Almost a State Monad
347 (1)
Reading and Modifying the State
348 (1)
Will the Real State Monad Please Stand Up?
348 (1)
Using the State Monad: Generating Random Values
349 (1)
A First Attempt at Purity
350 (1)
Random Values in the State Monad
351 (1)
Running the State Monad
352 (1)
What About a Bit More State?
352 (2)
Monads and Functors
354 (5)
Another Way of Looking at Monads
354 (1)
The Monad Laws and Good Coding Style
355 (4)
Programming with Monads
359 (24)
Golfing Practice: Association Lists
359 (1)
Generalized Lifting
360 (2)
Looking for Alternatives
362 (3)
The Name mplus Does Not Imply Addition
364 (1)
Rules for Working with MonadPlus
364 (1)
Failing Safely with MonadPlus
364 (1)
Adventures in Hiding the Plumbing
365 (4)
Supplying Random Numbers
368 (1)
Another Round of Golf
369 (1)
Separating Interface from Implementation
369 (4)
Multiparameter Typeclasses
370 (1)
Functional Dependencies
370 (1)
Rounding Out Our Module
371 (1)
Programming to a Monad`s Interface
372 (1)
The Reader Monad
373 (1)
A Return to Automated Deriving
374 (1)
Hiding the IO Monad
375 (8)
Using a newtype
376 (1)
Designing for Unexpected Uses
377 (1)
Using Typeclasses
378 (1)
Isolation and Testing
379 (1)
The Writer Monad and Lists
380 (1)
Arbitrary I/O Revisited
381 (2)
Using Parsec
383 (22)
First Steps with Parsec: Simple CSV Parsing
383 (3)
The sepBy and endBy Combinators
386 (1)
Choices and Errors
387 (4)
Lookahead
389 (1)
Error Handling
390 (1)
Extended Example: Full CSV Parser
391 (2)
Parsec and MonadPlus
393 (1)
Parsing a URL-Encoded Query String
393 (2)
Supplanting Regular Expressions for Casual Parsing
395 (1)
Parsing Without Variables
395 (1)
Applicative Functors for Parsing
395 (1)
Applicative Parsing by Example
396 (2)
Parsing JSON Data
398 (3)
Parsing a HTTP Request
401 (4)
Backtracking and Its Discontents
402 (1)
Parsing Headers
402 (3)
Interfacing with C: The FFI
405 (24)
Foreign Language Bindings: The Basics
406 (3)
Be Careful of Side Effects
407 (1)
A High-Level Wrapper
408 (1)
Regular Expressions for Haskell: A Binding for PCRE
409 (5)
Simple Tasks: Using the C Preprocessor
410 (1)
Binding Haskell to C with hsc2hs
411 (1)
Adding Type Safety to PCRE
411 (1)
Binding to Constants
412 (1)
Automating the Binding
413 (1)
Passing String Data Between Haskell and C
414 (8)
Typed Pointers
416 (1)
Memory Management: Let the Garbage Collector Do the Work
417 (1)
A High-Level Interface: Marshaling Data
418 (1)
Marshaling ByteStrings
419 (1)
Allocating Local C Data: The Storable Class
419 (1)
Putting It All Together
420 (2)
Matching on Strings
422 (7)
Extracting Information About the Pattern
423 (1)
Pattern Matching with Substrings
424 (2)
The Real Deal: Compiling and Matching Regular Expressions
426 (3)
Monad Transformers
429 (18)
Motivation: Boilerplate Avoidance
429 (1)
A Simple Monad Transformer Example
430 (1)
Common Patterns in Monads and Monad Transformers
431 (2)
Stacking Multiple Monad Transformers
433 (3)
Hiding Our Work
435 (1)
Moving Down the Stack
436 (2)
When Explicit Lifting Is Necessary
437 (1)
Understanding Monad Transformers by Building One
438 (3)
Creating a Monad Transformer
439 (1)
More Typeclass Instances
440 (1)
Replacing the Parse Type with a Monad Stack
440 (1)
Transformer Stacking Order Is Important
441 (2)
Putting Monads and Monad Transformers into Perspective
443 (4)
Interference with Pure Code
443 (1)
Overdetermined Ordering
444 (1)
Runtime Overhead
444 (1)
Unwieldy Interfaces
444 (1)
Pulling It All Together
445 (2)
Error Handling
447 (20)
Error Handling with Data Types
447 (7)
Use of Maybe
448 (4)
Use of Either
452 (2)
Exceptions
454 (8)
First Steps with Exceptions
454 (1)
Laziness and Exception Handling
455 (1)
Using handle
456 (1)
Selective Handling of Exceptions
456 (1)
I/O Exceptions
457 (2)
Throwing Exceptions
459 (1)
Dynamic Exceptions
459 (3)
Error Handling in Monads
462 (5)
A Tiny Parsing Framework
463 (4)
Systems Programming in Haskell
467 (26)
Running External Programs
467 (1)
Directory and File Information
468 (1)
Program Termination
469 (1)
Dates and Times
470 (6)
ClockTime and CalendarTime
470 (5)
File Modification Times
475 (1)
Extended Example: Piping
476 (17)
Using Pipes for Redirection
477 (6)
Better Piping
483 (8)
Final Words on Pipes
491 (2)
Using Databases
493 (12)
Overview of HDBC
493 (1)
Installing HDBC and Drivers
494 (1)
Connecting to Databases
495 (1)
Transactions
495 (1)
Simple Queries
496 (1)
SqlValue
497 (1)
Query Parameters
Prepared Statements
Reading Results
Reading with Statements
Lazy Reading
Database Metadata
Error Handling
Extended Example: Web Client Programming
Basic Types
The Database
The Parser
Downloading
Main Program
GUI Programming with gtk2hs
Installing gtk2hs
Overview of the GTK+ Stack
User Interface Design with Glade
Glade Concepts
Event-Driven Programming
Initializing the GUI
The Add Podcast Window
Long-Running Tasks
Using Cabal
Concurrent and Multicore Programming
Defining Concurrency and Parallelism
Concurrent Programming with Threads
Threads Are Nondeterministic
Hiding Latency
Simple Communication Between Threads
The Main Thread and Waiting for Other Threads
Safely Modifying an MVar
Safe Resource Management: A Good Idea, and Easy Besides
Finding the Status of a Thread
Writing Tighter Code
Communicating over Channels
Useful Things to Know About
MVar and Chan Are Nonstrict
Chan Is Unbounded
Shared-State Concurrency Is Still Hard
Deadlock
Starvation
Is There Any Hope?
Using Multiple Cores with GHC
Runtime Options
Finding the Number of Available Cores from Haskell
Choosing the Right Runtime
Parallel Programming in Haskell
Normal Form and Head Normal Form
Sequential Sorting
Transforming Our Code into Parallel Code
Knowing What to Evaluate in Parallel
What Promises Does par Make?
Running Our Code and Measuring Performance
Tuning for Performance
Parallel Strategies and MapReduce
Separating Algorithm from Evaluation
Separating Algorithm from Strategy
Writing a Simple MapReduce Definition
MapReduce and Strategies
Sizing Work Appropriately
Efficiently Finding Line-Aligned Chunks
Counting Lines
Finding the Most Popular URLs
Conclusions
Profiling and Optimization
Profiling Haskell Programs
Collecting Runtime Statistics
Time Profiling
Space Profiling
Controlling Evaluation
Strictness and Tail Recursion
Adding Strictness
Understanding Core
Advanced Techniques: Fusion
Tuning the Generated Assembly
Conclusions
Advanced Library Design: Building a Bloom Filter
Introducing the Bloom Filter
Use Cases and Package Layout
Basic Design
Unboxing, Lifting, and Bottom
The ST Monad
Designing an API for Qualified Import
Creating a Mutable Bloom Filter
The Immutable API
Creating a Friendly Interface
Re-Exporting Names for Convenience
Hashing Values
Turning Two Hashes into Many
Implementing the Easy Creation Function
Creating a Cabal Package
Dealing with Different Build Setups
Compilation Options and Interfacing to C
Testing with QuickCheck
Polymorphic Testing
Writing Arbitrary Instances for ByteStrings
Are Suggested Sizes Correct?
Performance Analysis and Tuning
Profile-Driven Performance Tuning
Sockets and Syslog
Basic Networking
Communicating with UDP
UDP Client Example: syslog
UDP Syslog Server
Communicating with TCP
Handling Multiple TCP Streams
TCP Syslog Server
TCP Syslog Client
Software Transactional Memory
The Basics
Some Simple Examples
STM and Safety
Retrying a Transaction
What Happens When We Retry?
Choosing Between Alternatives
Using Higher Order Code with Transactions
I/O and STM
Communication Between Threads
A Concurrent Web Link Checker
Checking a Link
Worker Threads
Finding Links
Command-Line Parsing
Pattern Guards
Practical Aspects of STM
Getting Comfortable with Giving Up Control
Using Invariants
Installing GHC and Haskell Libraries
Characters, Strings, and Escaping Rules
Index


Nonfiction, 0596514980

Za kupovinu više knjiga i/ili cd-a u ukupnoj vrednosti većoj od 3000din. poštarina je besplatna (odnosi se na slanje preporučenom tiskovinom/pismom i CC paketom).

Plaćanje pouzećem i postnetom za sada nisu opcija.

Lično preuzimanje je isključivo na Konjarniku uz prethodni dogovor.

Hvala na razumevanju.

Predmet: 75256693
Bryan O`Sullivan, John Goerzen, Don Stewart - Real World Haskell
O`Reilly Media, 2008
670
meki povez
stanje: vrlo dobro

This easy-to-use, fast-moving tutorial introduces you to functional programming with Haskell. You`ll learn how to use Haskell in a variety of practical ways, from short scripts to large and demanding applications. Real World Haskell takes you through the basics of functional programming at a brisk pace, and then helps you increase your understanding of Haskell in real-world issues like I/O, performance, dealing with data, concurrency, and more as you move through each chapter. With this book, you will:
Understand the differences between procedural and functional programming:

Learn the features of Haskell, and how to use it to develop useful programs
Interact with filesystems, databases, and network services
Write solid code with automated tests, code coverage, and error handling
Harness the power of multicore systems via concurrent and parallel programming

You`ll find plenty of hands-on exercises, along with examples of real Haskell programs that you can modify, compile, and run. Whether or not you`ve used a functional language before, if you want to understand why Haskell is coming into its own as a practical language in so many major organizations, Real World Haskell is the best place to start.

Contents:
Preface xxiii
Getting Started
Your Haskell Environment
Getting Started with ghci, the Interpreter
Basic Interaction: Using ghci as a Calculator
Simple Arithmetic
An Arithmetic Quirk: Writing Negative Numbers
Boolean Logic, Operators, and Value Comparisons
Operator Precedence and Associativity
Undefined Values, and Introducing Variables
Dealing with Precedence and Associativity Rules
Command-Line Editing in ghci
Lists
Operators on Lists
Strings and Characters
First Steps with Types
A Simple Program
Types and Functions
Why Care About Types?
Haskell`s Type System
Strong Types
Static Types
Type Inference
What to Expect from the Type System
Some Common Basic Types
Function Application
Useful Composite Data Types: Lists and Tuples
Functions over Lists and Tuples
Passing an Expression to a Function
Function Types and Purity
Haskell Source Files, and Writing Simple Functions
Just What Is a Variable, Anyway?
Conditional Evaluation
Understanding Evaluation by Example
Lazy Evaluation
A More Involved Example
Recursion
Ending the Recursion
Returning from the Recursion
What Have We Learned?
Polymorphism in Haskell
Reasoning About Polymorphic Functions
Further Reading
The Type of a Function of More Than One Argument
Why the Fuss over Purity?
Conclusion
Defining Types, Streamlining Functions
Defining a New Data Type
41 (2)
Naming Types and Values
43 (1)
Type Synonyms
43 (1)
Algebraic Data Types
44 (6)
Tuples, Algebraic Data Types, and When to Use Each
45 (2)
Analogues to Algebraic Data Types in Other Languages
47 (3)
Pattern Matching
50 (5)
Construction and Deconstruction
51 (1)
Further Adventures
52 (1)
Variable Naming in Patterns
53 (1)
The Wild Card Pattern
53 (1)
Exhaustive Patterns and Wild Cards
54 (1)
Record Syntax
55 (2)
Parameterized Types
57 (1)
Recursive Types
58 (2)
Reporting Errors
60 (1)
A More Controlled Approach
61 (1)
Introducing Local Variables
61 (3)
Shadowing
62 (1)
The where Clause
63 (1)
Local Functions, Global Variables
63 (1)
The Offside Rule and Whitespace in an Expression
64 (2)
A Note About Tabs Versus Spaces
66 (1)
The Offside Rule Is Not Mandatory
66 (1)
The case Expression
66 (1)
Common Beginner Mistakes with Patterns
67 (1)
Incorrectly Matching Against a Variable
67 (1)
Incorrectly Trying to Compare for Equality
68 (1)
Conditional Evaluation with Guards
68 (3)
Functional Programming
71 (40)
Thinking in Haskell
71 (1)
A Simple Command-Line Framework
71 (1)
Warming Up: Portably Splitting Lines of Text
72 (4)
A Line-Ending Conversion Program
75 (1)
Infix Functions
76 (1)
Working with Lists
77 (7)
Basic List Manipulation
78 (1)
Safely and Sanely Working with Crashy Functions
79 (1)
Partial and Total Functions
79 (1)
More Simple List Manipulations
80 (1)
Working with Sublists
81 (1)
Searching Lists
82 (1)
Working with Several Lists at Once
83 (1)
Special String-Handling Functions
84 (1)
How to Think About Loops
84 (15)
Explicit Recursion
85 (2)
Transforming Every Piece of Input
87 (1)
Mapping over a List
88 (2)
Selecting Pieces of Input
90 (1)
Computing One Answer over a Collection
90 (2)
The Left Fold
92 (1)
Why Use Folds, Maps, and Filters?
93 (1)
Folding from the Right
94 (2)
Left Folds, Laziness, and Space Leaks
96 (3)
Further Reading
99 (1)
Anonymous (lambda) Functions
99 (1)
Partial Function Application and Currying
100 (3)
Sections
102 (1)
As-patterns
103 (1)
Code Reuse Through Composition
104 (3)
Use Your Head Wisely
107 (1)
Tips for Writing Readable Code
107 (1)
Space Leaks and Strict Evaluation
108 (3)
Avoiding Space Leaks with seq
108 (1)
Learning to Use seq
109 (2)
Writing a Library: Working with JSON Data
111 (24)
A Whirlwind Tour of JSON
111 (1)
Representing JSON Data in Haskell
111 (2)
The Anatomy of a Haskell Module
113 (1)
Compiling Haskell Source
114 (1)
Generating a Haskell Program and Importing Modules
114 (1)
Printing JSON Data
115 (2)
Type Inference Is a Double-Edged Sword
117 (1)
A More General Look at Rendering
118 (1)
Developing Haskell Code Without Going Nuts
119 (1)
Pretty Printing a String
120 (2)
Arrays and Objects, and the Module Header
122 (1)
Writing a Module Header
123 (1)
Fleshing Out the Pretty-Printing Library
124 (7)
Compact Rendering
127 (1)
True Pretty Printing
128 (1)
Following the Pretty Printer
129 (2)
Creating a Package
131 (3)
Writing a Package Description
131 (2)
GHC`s Package Manager
133 (1)
Setting Up, Building, and Installing
133 (1)
Practical Pointers and Further Reading
134 (1)
Using Typedasses
135 (30)
The Need for Typeclasses
135 (1)
What Are Typeclasses?
136 (3)
Declaring Typeclass Instances
139 (1)
Important Built-in Typeclasses
139 (9)
Show
139 (2)
Read
141 (2)
Serialization with read and show
143 (1)
Numeric Types
144 (4)
Equality, Ordering, and Comparisons
148 (1)
Automatic Derivation
148 (1)
Typeclasses at Work: Making JSON Easier to Use
149 (3)
More Helpful Errors
151 (1)
Making an Instance with a Type Synonym
151 (1)
Living in an Open World
152 (3)
When Do Overlapping Instances Cause Problems?
153 (1)
Relaxing Some Restrictions on Typeclasses
154 (1)
How Does Show Work for Strings?
155 (1)
How to Give a Type a New Identity
155 (4)
Differences Between Data and Newtype Declarations
157 (1)
Summary: The Three Ways of Naming Types
158 (1)
JSON Typeclasses Without Overlapping Instances
159 (3)
The Dreaded Monomorphism Restriction
162 (1)
Conclusion
163 (2)
I/O
165 (28)
Classic I/O in Haskell
165 (4)
Pure Versus I/O
168 (1)
Why Purity Matters
169 (1)
Working with Files and Handles
169 (6)
More on openFile
171 (1)
Closing Handles
172 (1)
Seek and Tell
172 (1)
Standard Input, Output, and Error
173 (1)
Deleting and Renaming Files
174 (1)
Temporary Files
174 (1)
Extended Example: Functional I/O and Temporary Files
175 (3)
Lazy I/O
178 (5)
hGetContents
178 (2)
readFile and writeFile
180 (1)
A Word on Lazy Output
181 (1)
interact
181 (2)
The IO Monad
183 (5)
Actions
183 (3)
Sequencing
186 (1)
The True Nature of Return
187 (1)
Is Haskell Really Imperative?
188 (1)
Side Effects with Lazy I/O
188 (1)
Buffering
189 (1)
Buffering Modes
189 (1)
Flushing The Buffer
190 (1)
Reading Command-Line Arguments
190 (1)
Environment Variables
191 (2)
Efficient File Processing, Regular Expressions, and Filename Matching
193 (20)
Efficient File Processing
193 (4)
Binary I/O and Qualified Imports
194 (1)
Text I/O
195 (2)
Filename Matching
197 (1)
Regular Expressions in Haskell
198 (2)
The Many Types of Result
198 (2)
More About Regular Expressions
200 (2)
Mixing and Matching String Types
200 (1)
Other Things You Should Know
201 (1)
Translating a glob Pattern into a Regular Expression
202 (3)
An important Aside: Writing Lazy Functions
205 (1)
Making Use of Our Pattern Matcher
206 (4)
Handling Errors Through API Design
210 (1)
Putting Our Code to Work
211 (2)
I/O Case Study: A Library for Searching the Filesystem
213 (22)
The find Command
213 (1)
Starting Simple: Recursively Listing a Directory
213 (2)
Revisiting Anonymous and Named Functions
214 (1)
Why Provide Both mapM and forM?
215 (1)
A Naive Finding Function
215 (2)
Predicates: From Poverty to Riches, While Remaining Pure
217 (2)
Sizing a File Safely
219 (2)
The Acquire-Use-Release Cycle
221 (1)
A Domain-Specific Language for Predicates
221 (5)
Avoiding Boilerplate with Lifting
223 (1)
Gluing Predicates Together
224 (1)
Defining and Using New Operators
225 (1)
Controlling Traversal
226 (2)
Density, Readability, and the Learning Process
228 (1)
Another Way of Looking at Traversal
229 (3)
Useful Coding Guidelines
232 (3)
Common Layout Styles
233 (2)
Code Case Study: Parsing a Binary Data Format
235 (20)
Grayscale Files
235 (1)
Parsing a Raw PGM File
236 (2)
Getting Rid of Boilerplate Code
238 (1)
Implicit State
239 (5)
The Identity Parser
240 (1)
Record Syntax, Updates, and Pattern Matching
241 (1)
A More Interesting Parser
242 (1)
Obtaining and Modifying the Parse State
242 (1)
Reporting Parse Errors
243 (1)
Chaining Parsers Together
243 (1)
Introducing Functors
244 (6)
Constraints on Type Definitions Are Bad
247 (1)
Infix Use of fmap
248 (1)
Flexible Instances
248 (1)
Thinking More About Functors
249 (1)
Writing a Functor Instance for Parse
250 (1)
Using Functors for Parsing
251 (1)
Rewriting Our PGM Parser
252 (2)
Future Directions
254 (1)
Testing and Quality Assurance
255 (14)
QuickCheck: Type-Based Testing
256 (3)
Testing for Properties
257 (2)
Testing Against a Model
259 (1)
Testing Case Study: Specifying a Pretty Printer
259 (6)
Generating Test Data
259 (3)
Testing Document Construction
262 (1)
Using Lists as a Model
263 (1)
Putting It All Together
264 (1)
Measuring Test Coverage with HPC
265 (4)
Barcode Recognition
269 (30)
A Little Bit About Barcodes
269 (1)
EAN-13 Encoding
270 (1)
Introducing Arrays
270 (5)
Arrays and Laziness
273 (1)
Folding over Arrays
273 (1)
Modifying Array Elements
274 (1)
Encoding an EAN-13 Barcode
275 (1)
Constraints on Our Decoder
275 (1)
Divide and Conquer
276 (2)
Turning a Color Image into Something Tractable
278 (2)
Parsing a Color Image
278 (1)
Grayscale Conversion
279 (1)
Grayscale to Binary and Type Safety
279 (1)
What Have We Done to Our Image?
280 (2)
Finding Matching Digits
282 (6)
Run Length Encoding
282 (1)
Scaling Run Lengths, and Finding Approximate Matches
283 (1)
List Comprehensions
284 (1)
Remembering a Match`s Parity
285 (2)
Chunking a List
287 (1)
Generating a List of Candidate Digits
287 (1)
Life Without Arrays or Hash Tables
288 (4)
A Forest of Solutions
288 (1)
A Brief Introduction to Maps
289 (3)
Further Reading
292 (1)
Turning Digit Soup into an Answer
292 (3)
Solving for Check Digits in Parallel
292 (2)
Completing the Solution Map with the First Digit
294 (1)
Finding the Correct Sequence
295 (1)
Working with Row Data
295 (1)
Pulling It All Together
296 (1)
A Few Comments on Development Style
297 (2)
Data Structures
299 (26)
Association Lists
299 (2)
Maps
301 (2)
Functions Are Data, Too
303 (1)
Extended Example: /etc/passwd
304 (3)
Extended Example: Numeric Types
307 (10)
First Steps
309 (2)
Completed Code
311 (6)
Taking Advantage of Functions as Data
317 (5)
Turning Difference Lists into a Proper Library
318 (2)
Lists, Difference Lists, and Monoids
320 (2)
General-Purpose Sequences
322 (3)
Monads
325 (34)
Revisiting Earlier Code Examples
325 (2)
Maybe Chaining
325 (1)
Implicit State
326 (1)
Looking for Shared Patterns
327 (2)
The Monad Typeclass
329 (1)
And Now, a Jargon Moment
330 (1)
Using a New Monad: Show Your Work!
331 (3)
Information Hiding
331 (1)
Controlled Escape
332 (1)
Leaving a Trace
332 (1)
Using the Logger Monad
333 (1)
Mixing Pure and Monadic Code
334 (2)
Putting a Few Misconceptions to Rest
336 (1)
Building the Logger Monad
336 (2)
Sequential Logging, Not Sequential Evaluation
337 (1)
The Writer Monad
337 (1)
The Maybe Monad
338 (2)
Executing the Maybe Monad
338 (1)
Maybe at Work, and Good API Design
338 (2)
The List Monad
340 (4)
Understanding the List Monad
342 (1)
Putting the List Monad to Work
343 (1)
Desugaring of do Blocks
344 (2)
Monads as a Programmable Semicolon
345 (1)
Why Go Sugar-Free?
346 (1)
The State Monad
346 (8)
Almost a State Monad
347 (1)
Reading and Modifying the State
348 (1)
Will the Real State Monad Please Stand Up?
348 (1)
Using the State Monad: Generating Random Values
349 (1)
A First Attempt at Purity
350 (1)
Random Values in the State Monad
351 (1)
Running the State Monad
352 (1)
What About a Bit More State?
352 (2)
Monads and Functors
354 (5)
Another Way of Looking at Monads
354 (1)
The Monad Laws and Good Coding Style
355 (4)
Programming with Monads
359 (24)
Golfing Practice: Association Lists
359 (1)
Generalized Lifting
360 (2)
Looking for Alternatives
362 (3)
The Name mplus Does Not Imply Addition
364 (1)
Rules for Working with MonadPlus
364 (1)
Failing Safely with MonadPlus
364 (1)
Adventures in Hiding the Plumbing
365 (4)
Supplying Random Numbers
368 (1)
Another Round of Golf
369 (1)
Separating Interface from Implementation
369 (4)
Multiparameter Typeclasses
370 (1)
Functional Dependencies
370 (1)
Rounding Out Our Module
371 (1)
Programming to a Monad`s Interface
372 (1)
The Reader Monad
373 (1)
A Return to Automated Deriving
374 (1)
Hiding the IO Monad
375 (8)
Using a newtype
376 (1)
Designing for Unexpected Uses
377 (1)
Using Typeclasses
378 (1)
Isolation and Testing
379 (1)
The Writer Monad and Lists
380 (1)
Arbitrary I/O Revisited
381 (2)
Using Parsec
383 (22)
First Steps with Parsec: Simple CSV Parsing
383 (3)
The sepBy and endBy Combinators
386 (1)
Choices and Errors
387 (4)
Lookahead
389 (1)
Error Handling
390 (1)
Extended Example: Full CSV Parser
391 (2)
Parsec and MonadPlus
393 (1)
Parsing a URL-Encoded Query String
393 (2)
Supplanting Regular Expressions for Casual Parsing
395 (1)
Parsing Without Variables
395 (1)
Applicative Functors for Parsing
395 (1)
Applicative Parsing by Example
396 (2)
Parsing JSON Data
398 (3)
Parsing a HTTP Request
401 (4)
Backtracking and Its Discontents
402 (1)
Parsing Headers
402 (3)
Interfacing with C: The FFI
405 (24)
Foreign Language Bindings: The Basics
406 (3)
Be Careful of Side Effects
407 (1)
A High-Level Wrapper
408 (1)
Regular Expressions for Haskell: A Binding for PCRE
409 (5)
Simple Tasks: Using the C Preprocessor
410 (1)
Binding Haskell to C with hsc2hs
411 (1)
Adding Type Safety to PCRE
411 (1)
Binding to Constants
412 (1)
Automating the Binding
413 (1)
Passing String Data Between Haskell and C
414 (8)
Typed Pointers
416 (1)
Memory Management: Let the Garbage Collector Do the Work
417 (1)
A High-Level Interface: Marshaling Data
418 (1)
Marshaling ByteStrings
419 (1)
Allocating Local C Data: The Storable Class
419 (1)
Putting It All Together
420 (2)
Matching on Strings
422 (7)
Extracting Information About the Pattern
423 (1)
Pattern Matching with Substrings
424 (2)
The Real Deal: Compiling and Matching Regular Expressions
426 (3)
Monad Transformers
429 (18)
Motivation: Boilerplate Avoidance
429 (1)
A Simple Monad Transformer Example
430 (1)
Common Patterns in Monads and Monad Transformers
431 (2)
Stacking Multiple Monad Transformers
433 (3)
Hiding Our Work
435 (1)
Moving Down the Stack
436 (2)
When Explicit Lifting Is Necessary
437 (1)
Understanding Monad Transformers by Building One
438 (3)
Creating a Monad Transformer
439 (1)
More Typeclass Instances
440 (1)
Replacing the Parse Type with a Monad Stack
440 (1)
Transformer Stacking Order Is Important
441 (2)
Putting Monads and Monad Transformers into Perspective
443 (4)
Interference with Pure Code
443 (1)
Overdetermined Ordering
444 (1)
Runtime Overhead
444 (1)
Unwieldy Interfaces
444 (1)
Pulling It All Together
445 (2)
Error Handling
447 (20)
Error Handling with Data Types
447 (7)
Use of Maybe
448 (4)
Use of Either
452 (2)
Exceptions
454 (8)
First Steps with Exceptions
454 (1)
Laziness and Exception Handling
455 (1)
Using handle
456 (1)
Selective Handling of Exceptions
456 (1)
I/O Exceptions
457 (2)
Throwing Exceptions
459 (1)
Dynamic Exceptions
459 (3)
Error Handling in Monads
462 (5)
A Tiny Parsing Framework
463 (4)
Systems Programming in Haskell
467 (26)
Running External Programs
467 (1)
Directory and File Information
468 (1)
Program Termination
469 (1)
Dates and Times
470 (6)
ClockTime and CalendarTime
470 (5)
File Modification Times
475 (1)
Extended Example: Piping
476 (17)
Using Pipes for Redirection
477 (6)
Better Piping
483 (8)
Final Words on Pipes
491 (2)
Using Databases
493 (12)
Overview of HDBC
493 (1)
Installing HDBC and Drivers
494 (1)
Connecting to Databases
495 (1)
Transactions
495 (1)
Simple Queries
496 (1)
SqlValue
497 (1)
Query Parameters
Prepared Statements
Reading Results
Reading with Statements
Lazy Reading
Database Metadata
Error Handling
Extended Example: Web Client Programming
Basic Types
The Database
The Parser
Downloading
Main Program
GUI Programming with gtk2hs
Installing gtk2hs
Overview of the GTK+ Stack
User Interface Design with Glade
Glade Concepts
Event-Driven Programming
Initializing the GUI
The Add Podcast Window
Long-Running Tasks
Using Cabal
Concurrent and Multicore Programming
Defining Concurrency and Parallelism
Concurrent Programming with Threads
Threads Are Nondeterministic
Hiding Latency
Simple Communication Between Threads
The Main Thread and Waiting for Other Threads
Safely Modifying an MVar
Safe Resource Management: A Good Idea, and Easy Besides
Finding the Status of a Thread
Writing Tighter Code
Communicating over Channels
Useful Things to Know About
MVar and Chan Are Nonstrict
Chan Is Unbounded
Shared-State Concurrency Is Still Hard
Deadlock
Starvation
Is There Any Hope?
Using Multiple Cores with GHC
Runtime Options
Finding the Number of Available Cores from Haskell
Choosing the Right Runtime
Parallel Programming in Haskell
Normal Form and Head Normal Form
Sequential Sorting
Transforming Our Code into Parallel Code
Knowing What to Evaluate in Parallel
What Promises Does par Make?
Running Our Code and Measuring Performance
Tuning for Performance
Parallel Strategies and MapReduce
Separating Algorithm from Evaluation
Separating Algorithm from Strategy
Writing a Simple MapReduce Definition
MapReduce and Strategies
Sizing Work Appropriately
Efficiently Finding Line-Aligned Chunks
Counting Lines
Finding the Most Popular URLs
Conclusions
Profiling and Optimization
Profiling Haskell Programs
Collecting Runtime Statistics
Time Profiling
Space Profiling
Controlling Evaluation
Strictness and Tail Recursion
Adding Strictness
Understanding Core
Advanced Techniques: Fusion
Tuning the Generated Assembly
Conclusions
Advanced Library Design: Building a Bloom Filter
Introducing the Bloom Filter
Use Cases and Package Layout
Basic Design
Unboxing, Lifting, and Bottom
The ST Monad
Designing an API for Qualified Import
Creating a Mutable Bloom Filter
The Immutable API
Creating a Friendly Interface
Re-Exporting Names for Convenience
Hashing Values
Turning Two Hashes into Many
Implementing the Easy Creation Function
Creating a Cabal Package
Dealing with Different Build Setups
Compilation Options and Interfacing to C
Testing with QuickCheck
Polymorphic Testing
Writing Arbitrary Instances for ByteStrings
Are Suggested Sizes Correct?
Performance Analysis and Tuning
Profile-Driven Performance Tuning
Sockets and Syslog
Basic Networking
Communicating with UDP
UDP Client Example: syslog
UDP Syslog Server
Communicating with TCP
Handling Multiple TCP Streams
TCP Syslog Server
TCP Syslog Client
Software Transactional Memory
The Basics
Some Simple Examples
STM and Safety
Retrying a Transaction
What Happens When We Retry?
Choosing Between Alternatives
Using Higher Order Code with Transactions
I/O and STM
Communication Between Threads
A Concurrent Web Link Checker
Checking a Link
Worker Threads
Finding Links
Command-Line Parsing
Pattern Guards
Practical Aspects of STM
Getting Comfortable with Giving Up Control
Using Invariants
Installing GHC and Haskell Libraries
Characters, Strings, and Escaping Rules
Index


Nonfiction, 0596514980
75256693 Real World Haskell

LimundoGrad koristi kolačiće u statističke i marketinške svrhe. Nastavkom korišćenja sajta smatramo da ste pristali na upotrebu kolačića. Više informacija.