OSullivan - Real World Haskell
Here you can read online OSullivan - Real World Haskell full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. City: Farnham, year: 2009;2008, publisher: OReilly Media, genre: Home and family. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:
Romance novel
Science fiction
Adventure
Detective
Science
History
Home and family
Prose
Art
Politics
Computer
Non-fiction
Religion
Business
Children
Humor
Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.
Real World Haskell: summary, description and annotation
We offer to read an annotation, description, summary or preface (depends on what the author of the book "Real World Haskell" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.
Real World Haskell — read online for free the complete book (whole text) full work
Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Real World Haskell" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.
Font size:
Interval:
Bookmark:
Beijing Boston Farnham Sebastopol Tokyo
To Cian, Ruairi, and Shannon, for the love and joy they bring.
Bryan
For my wife, Terah, with thanks for all her love, encouragement, and support.
John
To Suzie, for her love and support.
Don
If you purchased this ebook directly from oreilly.com, you have the following benefits:
DRM-free ebooksuse your ebooks across devices without restrictions or limitations
Multiple formatsuse on your laptop, tablet, or phone
Lifetime access, with free updates
Dropbox syncingyour files, anywhere
If you purchased this ebook from another retailer, you can upgrade your ebook to take advantage of all these benefits for just $4.99. to access your ebook upgrade.
Please note that upgrade offers are not available from sample content.
Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780596514983/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Haskell is a deep language; we think learning it is a hugely rewarding experience. We will focus on three elements as we explain why. The first is novelty : we invite you to think about programming from a different and valuable perspective. The second is power : well show you how to create software that is short, fast, and safe. Lastly, we offer you a lot of enjoyment : the pleasure of applying beautiful programming techniques to solve real problems.
Haskell is most likely quite different from any language youve ever used before. Compared to the usual set of concepts in a programmers mental toolbox, functional programming offers us a profoundly different way to think about software.
In Haskell, we deemphasize code that modifies data. Instead, we focus on functions that take immutable values as input and produce new values as output. Given the same inputs, these functions always return the same results. This is a core idea behind functional programming.
Along with not modifying data, our Haskell functions usually dont talk to the external world; we call these functions pure . We make a strong distinction between pure code and the parts of our programs that read or write files, communicate over network connections, or make robot arms move. This makes it easier to organize, reason about, and test our programs.
We abandon some ideas that might seem fundamental, such as having a for
loop built into the language. We have other, more flexible, ways to perform repetitive tasks.
Even the way in which we evaluate expressions is different in Haskell. We defer every computation until its result is actually neededHaskell is a lazy language. Laziness is not merely a matter of moving work around, it profoundly affects how we write programs.
Throughout this book, we will show you how Haskells alternatives to the features of traditional languages are powerful and flexible and lead to reliable code. Haskell is positively crammed full of cutting-edge ideas about how to create great software.
Since pure code has no dealings with the outside world, and the data it works with is never modified, the kind of nasty surprise in which one piece of code invisibly corrupts data used by another is very rare. Whatever context we use a pure function in, the function will behave consistently.
Pure code is easier to test than code that deals with the outside world. When a function responds only to its visible inputs, we can easily state properties of its behavior that should always be true. We can automatically test that those properties hold for a huge body of random inputs, and when our tests pass, we move on. We still use traditional techniques to test code that must interact with files, networks, or exotic hardware. Since there is much less of this impure code than we would find in a traditional language, we gain much more assurance that our software is solid.
Lazy evaluation has some spooky effects. Lets say we want to find the k least-valued elements of an unsorted list. In a traditional language, the obvious approach would be to sort the list and take the first k elements, but this is expensive. For efficiency, we would instead write a special function that takes these values in one pass, and that would have to perform some moderately complex bookkeeping. In Haskell, the sort-then-take approach actually performs well: laziness ensures that the list will only be sorted enough to find the k minimal elements.
Better yet, our Haskell code that operates so efficiently is tiny and uses standard library functions:
-- file: ch00/KMinima.hs-- lines beginning with "--" are comments.minima k xs = take k (sort xs)It can take a while to develop an intuitive feel for when lazy evaluation is important, but when we exploit it, the resulting code is often clean, brief, and efficient.
As the preceding example shows, an important aspect of Haskells power lies in the compactness of the code we write. Compared to working in popular traditional languages, when we develop in Haskell we often write much less code, in substantially less time and with fewer bugs.
We believe that it is easy to pick up the basics of Haskell programming and that you will be able to successfully write small programs within a matter of hours or days.
Since effective programming in Haskell differs greatly from other languages, you should expect that mastering both the language itself and functional programming techniques will require plenty of thought and practice.
Harking back to our own days of getting started with Haskell, the good news is that the fun begins early: its simply an entertaining challenge to dig into a new language in which so many commonplace ideas are different or missingand to figure out how to write simple programs.
For us, the initial pleasure lasted as our experience grew and our understanding deepened. In other languages, its difficult to see any connection between science and the nuts-and-bolts of programming. In Haskell, we have imported some ideas from abstract mathematics and put them to work. Even better, we find that not only are these ideas easy to pick up, but they also have a practical payoff in helping us to write more compact, reusable code.
Furthermore, we wont be putting any brick walls in your way. There are no especially difficult or gruesome techniques in this book that you must master in order to be able to program effectively.
That being said, Haskell is a rigorous language: it will make you perform more of your thinking up front. It can take a little while to adjust to debugging much of your code before you ever run it, in response to the compiler telling you that something about your program does not make sense. Even with years of experience, we remain astonished and pleased by how often our Haskell programs simply work on the first try, once we fix those compilation errors.
Font size:
Interval:
Bookmark:
Similar books «Real World Haskell»
Look at similar books to Real World Haskell. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.
Discussion, reviews of the book Real World Haskell and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.