[Quick editing pass over chapter 2. Bryan O'Sullivan **20070920062106] { hunk ./en/book-shortcuts.xml 34 -hugs"> -runghc"> +hugs"> +runghc"> hunk ./en/ch02-starting.xml 13 - popular. + popular. This is the Haskell implementation we'll be using + throughout this book. hunk ./en/ch02-starting.xml 16 - &GHC; has two complementary components: &ghc;, a compiler - that generates native code, and &ghci;, an interpreter that can - run either interactively or in batch mode. + &GHC; has three complementary components: &ghc;, a + compiler that generates native code; &ghci;, an interpreter that + we can run interactively; and &runghc;, an interpreter that we + can run in batch mode. hunk ./en/ch02-starting.xml 22 + Which GHC do we mean? + hunk ./en/ch02-starting.xml 26 - we'll mention either &ghc; or &ghci;. + we'll mention either &ghc; or &ghci;. (We'll rarely make + reference to &runghc;.) hunk ./en/ch02-starting.xml 37 + With 6.8.1 due out long before the book, should we make + that the baseline version? + hunk ./en/ch02-starting.xml 71 + How much room does GHC need? + hunk ./en/ch02-starting.xml 90 - starts the installation process. This simply involves + starts the installation process. This involves hunk ./en/ch02-starting.xml 100 - double-click on to run &ghci;. + use to run &ghci;. hunk ./en/ch02-starting.xml 114 + Updating your search path + hunk ./en/ch02-starting.xml 213 - + + Terminal at your fingertips yet? + hunk ./en/ch02-starting.xml 220 - + hunk ./en/ch02-starting.xml 258 - &GHC; is packaged for Fedora. From a shell, all you need - to do is run sudo yum -y install ghc ghc-doc + &GHC; is available as a standard Fedora binary + package. From a shell, all you need to do is run + sudo yum -y install ghc ghc-doc hunk ./en/ch02-starting.xml 356 - &ghci; will do with them. Basic arithmetic works as we'd + &ghci; will do with them. Basic arithmetic works as we might hunk ./en/ch02-starting.xml 378 - + + Don't be too aggressive with parenthesis removal + hunk ./en/ch02-starting.xml 386 - Even more importantly, complex expressions that rely on - operator precedence are notorious sources of bugs. A - compiler and a human can easily end up with different - notions of what a long, parenthesis-free expression is - supposed to do. - + Even more importantly, complex expressions + that rely completely on operator precedence are notorious + sources of bugs. A compiler and a human can easily end up + with different notions of what a long, parenthesis-free + expression is supposed to do. + hunk ./en/ch02-starting.xml 454 + Don't worry about the error message + hunk ./en/ch02-starting.xml 482 - Unlike some other languages, Haskell does not treat the + Unlike some other languages, Haskell does + not treat the hunk ./en/ch02-starting.xml 489 - Comparison operators are mostly familiar from other - languages. + Comparison operators are mostly going to be + familiar from other languages that have taken some syntactic + cues from C. hunk ./en/ch02-starting.xml 495 - There's one exception: the is not equal - operator is (/=). + There's one exception: the is not + equal operator is (/=) + (somewhat visually similar to the mathematical ࣔ + operator), not the (!=) you might + expect. hunk ./en/ch02-starting.xml 514 - role="module">Prelude. + role="module">Prelude, whose name we've already + seen in &ghci;'s prompt. hunk ./en/ch02-starting.xml 529 - directive named :module to import + command named :module to import hunk ./en/ch02-starting.xml 631 - places + places. hunk ./en/ch02-starting.xml 648 + Remain dauntless in the face of error messages + hunk ./en/ch02-starting.xml 666 - Haskell's notations for strings, lists and tuples + Haskell's notations for strings and lists hunk ./en/ch02-starting.xml 686 - A list can be any length. + A list can be of any length. hunk ./en/ch02-starting.xml 696 - string into a number, so the list isn't properly typed. + string into a number, so the list expression isn't properly + typed. (It chose to try to turn the string into a number because + the list starts with a number.) hunk ./en/ch02-starting.xml 700 - When it makes sense to do so, we can write a range of - elements, and Haskell will fill in the contents of the list for + We can write a series of elements using range + notation, and Haskell will fill in the contents of the list for hunk ./en/ch02-starting.xml 706 - We can specify the size of the step to use by giving the - first two elements, followed by the value at which to stop - generating the range. + Notice that range notation gives us a closed + interval; the list contains both endpoints. + + When we write a range, we can optionally specify + the size of the step to use by giving the first two elements, + followed by the value at which to stop generating the + range. hunk ./en/ch02-starting.xml 716 + In the latter case above, the list is quite sensibly missing + the end point of the range, because it isn't an element of the + series we defined. + hunk ./en/ch02-starting.xml 803 - Integer is Haskell's arbitrary-precision - integer type. + Haskell's arbitrary-precision + integer type is named Integer . hunk ./en/ch02-starting.xml 813 - names with a lowercase letter. + names must start with a lowercase letter. As far as Haskell + is concerned, a function is just another variable, so a + function name must start with a lowercase letter, too. hunk ./en/ch02-starting.xml 823 - Notice two words on the right hand side - of the :: above. We can read this as a - Ratio of Integer, and infer that a - Ratio will probably need to have values of type - Integer as both numerator and denominator. Sure - enough, if we try to construct a Ratio where the - numerator and denominator are of different types, &ghci; + Notice two words on the right + hand side of the :: above. We can read this as a + Ratio of Integer; we + might infer that a Ratio must need to have values + of type Integer as both numerator and denominator. + Sure enough, if we try to construct a Ratio where + the numerator and denominator are of different types, &ghci; hunk ./en/ch02-starting.xml 837 - because it will become redundant: after a while, we'll often + because it will become redundant. After a while, we'll often hunk ./en/ch02-starting.xml 840 - at any time. + at any time, using the :unset command. hunk ./examples/ch02/basics.ghci 126 +print "Here's a newline -->\n<-- See?" hunk ./examples/ch02/types.ghci 34 -:set -t +:unset +t }