网上购物 货比三家
您现在的位置:快乐比价网 > 图书 > 计算机与网络 > 计算机/网络 > 商品详情

真实世界的Haskell(影印版)

分享到:
真实世界的Haskell(影印版)

最 低 价:¥69.50

定 价:¥0.00

作 者:Bryan O'Sullivan

出 版 社:东南大学出版社

出版时间:2010 年2月

I S B N:9787564119256

价格
缺货
  • 真实世界的Haskell
  • 送货上门
  • 价格
    69.50元
    价格
    71.50元
    价格
    73.00元
    价格
    77.80元
    价格
    79.20元

    商品详情

    编辑推荐

    《真实世界的Haskell》能帮助你:
      * 理解过程式与函数式编程之间的差异
      * 学习Haskell的特性,以及如何使用它来开发有用的程序
      * 与文件系统、数据库和网络服务交互
      * 编写可以进行自动测试、代码覆盖和错误处理的代码
      * 通过并发和并行编程发挥多核系统的威力

    内容简介

    《真实世界的haskell》是一本上手快且易于使用的指导书,它向你介绍这门日趋流行的编程语言。你将学习如何将haskell应用于不同实践当中,从简短的脚本到要求苛刻的大型应用。本书向你讲解了函数式编程的基础,帮助你加深对如何在现实世界中应用haskell的理解,例如输入/输出性能、数据处理、并发等等。
      《真实世界的haskell》能帮助你:
      * 理解过程式与函数式编程之间的差异
      * 学习haskell的特性,以及如何使用它来开发有用的程序
      * 与文件系统、数据库和网络服务交互
      * 编写可以进行自动测试、代码覆盖和错误处理的代码
      * 通过并发和并行编程发挥多核系统的威力
      在本书中你将发现大量的实用习题和真实的haskell程序示例,你可以修改、编译及运行它们。无论是否曾经使用过函数式语言,如果想要了解haskell为何成为众多组织所选用的实用语言,《真实世界的haskell》是你的首选。

    作者简介

    目录

    preface
    1. 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
    2. 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
    3. defining types, streamlining functions
    defining a new data type
    naming types and values
    type synonyms
    algebraic data types
    tuples, algebraic data types, and when to use each
    analogues to algebraic data types in other languages
    pattern matching
    construction and deconstruction
    further adventures
    variable naming in patterns
    the wild card pattern
    exhaustive patterns and wild cards
    record syntax
    parameterized types
    recursive types
    reporting errors
    a more controlled approach
    introducing local variables
    shadowing
    the where clause
    local functions, global variables
    the offside rule and whitespace in an expression
    a note about tabs versus spaces
    the offside rule is not mandatory
    the case expression
    common beginner mistakes with patterns
    incorrectly matching against a variable
    incorrectly trying to compare for equality
    conditional evaluation with guards
    4. functional programming
    thinking in haskell
    a simple command-line framework
    warming up: portably splitting lines of text
    a line-ending conversion program
    infix functions
    working with lists
    basic list manipulation
    safely and sanely working with crashy functions
    partial and total functions
    more simple list manipulations
    working with sublists
    searching lists
    working with several lists at once
    special string-handling functions
    how to think about loops
    explicit recursion
    transforming every piece of input
    mapping over a list
    selecting pieces of input
    computing one answer over a collection
    the left fold
    why use folds, maps, and filters?
    folding from the right
    left folds, laziness, and space leaks
    further reading
    anonymous (lambda) functions
    partial function application and currying
    sections
    as-patterns
    code reuse through composition
    use your head wisely
    tips for writing readable code
    space leaks and strict evaluation
    avoiding space leaks with seq
    learning to use seq
    5. writing a library: working with json data
    a whirlwind tour of json
    representing json data in haskell
    the anatomy of a haskell module
    compiling haskell source
    generating a haskell program and importing modules
    printing json data
    type inference is a double-edged sword
    a more general look at rendering
    developing haskell code without going nuts
    pretty printing a string
    arrays and objects, and the module header
    writing a module header
    fleshing out the pretty-printing library
    compact rendering
    true pretty printing
    following the pretty printer
    creating a package
    writing a package description
    ghc’s package manager
    setting up, building, and installing
    practical pointers and further reading
    6. using typeclasses
    the need for typeclasses
    what are typeclasses?
    declaring typeclass instances
    important built-in typeclasses
    show
    read
    serialization with read and show
    numeric types
    equality, ordering, and comparisons
    automatic derivation
    typeclasses at work: making json easier to use
    more helpful errors
    making an instance with a type synonym
    living in an open world
    when do overlapping instances cause problems?
    relaxing some restrictions on typeclasses
    how does show work for strings?
    how to give a type a new identity
    differences between data and newtype declarations
    summary: the three ways of naming types
    json typeclasses without overlapping instances
    the dreaded monomorphism restriction
    conclusion
    7. i/o
    classic i/o in haskell
    pure versus i/o
    why purity matters
    working with files and handles
    more on openfile
    closing handles
    seek and tell
    standard input, output, and error
    deleting and renaming files
    temporary files
    extended example: functional i/o and temporary files
    lazy i/o
    hgetcontents
    readfile and writefile
    a word on lazy output
    interact
    the io monad
    actions
    sequencing
    the true nature of return
    is haskell really imperative?
    side effects with lazy i/o
    buffering
    buffering modes
    flushing the buffer
    reading command-line arguments
    environment variables
    8. efficient file processing, regular expressions, and filename matching
    efficient file processing
    binary i/o and qualified imports
    text i/o
    filename matching
    regular expressions in haskell
    the many types of result
    more about regular expressions
    mixing and matching string types
    other things you should know
    translating a glob pattern into a regular expression
    an important aside: writing lazy functions
    making use of our pattern matcher
    handling errors through api design
    putting our code to work
    9. i/o case study: a library for searching the filesystem
    the find command
    starting simple: recursively listing a directory
    revisiting anonymous and named functions
    why provide both mapm and form?
    a naive finding function
    predicates: from poverty to riches, while remaining pure
    sizing a file safely
    the acquire-use-release cycle
    a domain-specific language for predicates
    avoiding boilerplate with lifting
    gluing predicates together
    defining and using new operators
    controlling traversal
    density, readability, and the learning process
    another way of looking at traversal
    useful coding guidelines
    common layout styles
    10. code case study: parsing a binary data format
    grayscale files
    parsing a raw pgm file
    getting rid of boilerplate code
    implicit state
    the identity parser
    record syntax, updates, and pattern matching
    a more interesting parser
    obtaining and modifying the parse state
    reporting parse errors
    chaining parsers together
    introducing functors
    constraints on type definitions are bad
    infix use of fmap
    flexible instances
    thinking more about functors
    writing a functor instance for parse
    using functors for parsing
    rewriting our pgm parser
    future directions
    11. testing and quality assurance
    quickcheck: type-based testing
    testing for properties
    testing against a model
    testing case study: specifying a pretty printer
    generating test data
    testing document construction
    using lists as a model
    putting it all together
    measuring test coverage with hpc
    12. barcode recognition
    a little bit about barcodes
    ean-13 encoding
    introducing arrays
    arrays and laziness
    folding over arrays
    modifying array elements
    encoding an ean-13 barcode
    constraints on our decoder
    divide and conquer
    turning a color image into something tractable
    parsing a color image
    grayscale conversion
    grayscale to binary and type safety
    what have we done to our image?
    finding matching digits
    run length encoding
    scaling run lengths, and finding approximate matches
    list comprehensions
    remembering a match’s parity
    chunking a list
    generating a list of candidate digits
    life without arrays or hash tables
    a forest of solutions
    a brief introduction to maps
    further reading
    turning digit soup into an answer
    solving for check digits in parallel
    completing the solution map with the first digit
    finding the correct sequence
    working with row data
    pulling it all together
    a few comments on development style
    13. data structures
    association lists
    maps
    functions are data, too
    extended example: /etc/passwd
    extended example: numeric types
    first steps
    completed code
    taking advantage of functions as data
    turning difference lists into a proper library
    lists, difference lists, and monoids
    general-purpose sequences
    14. monads
    revisiting earlier code examples
    maybe chaining
    implicit state
    looking for shared patterns
    the monad typeclass
    and now, a jargon moment
    using a new monad: show your work!
    information hiding
    controlled escape
    leaving a trace
    using the logger monad
    mixing pure and monadic code
    putting a few misconceptions to rest
    building the logger monad
    sequential logging, not sequential evaluation
    the writer monad
    the maybe monad
    executing the maybe monad
    maybe at work, and good api design
    the list monad
    understanding the list monad
    putting the list monad to work
    desugaring of do blocks
    monads as a programmable semicolon
    why go sugar-free?
    the state monad
    almost a state monad
    reading and modifying the state
    will the real state monad please stand up?
    using the state monad: generating random values
    a first attempt at purity
    random values in the state monad
    running the state monad
    what about a bit more state?
    monads and functors
    another way of looking at monads
    the monad laws and good coding style
    15. programming with monads
    golfing practice: association lists
    generalized lifting
    looking for alternatives
    the name mplus does not imply addition
    rules for working with monadplus
    failing safely with monadplus
    adventures in hiding the plumbing
    supplying random numbers
    another round of golf
    separating interface from implementation
    multiparameter typeclasses
    functional dependencies
    rounding out our module
    programming to a monad’s interface
    the reader monad
    a return to automated deriving
    hiding the io monad
    using a newtype
    designing for unexpected uses
    using typeclasses
    isolation and testing
    the writer monad and lists
    arbitrary i/o revisited
    16. using parsec
    first steps with parsec: simple csv parsing
    the sepby and endby combinators
    choices and errors
    lookahead
    error handling
    extended example: full csv parser
    parsec and monadplus
    parsing a url-encoded query string
    supplanting regular expressions for casual parsing
    parsing without variables
    applicative functors for parsing
    applicative parsing by example
    parsing json data
    parsing a http request
    backtracking and its discontents
    parsing headers
    17. interfacing with c: the ffi
    foreign language bindings: the basics
    be careful of side effects
    a high-level wrapper
    regular expressions for haskell: a binding for pcre
    simple tasks: using the c preprocessor
    binding haskell to c with hsc2hs
    adding type safety to pcre
    binding to constants
    automating the binding
    passing string data between haskell and c
    typed pointers
    memory management: let the garbage collector do the work
    a high-level interface: marshaling data
    marshaling bytestrings
    allocating local c data: the storable class
    putting it all together
    matching on strings
    extracting information about the pattern
    pattern matching with substrings
    the real deal: compiling and matching regular expressions
    18. monad transformers
    motivation: boilerplate avoidance
    a simple monad transformer example
    common patterns in monads and monad transformers
    stacking multiple monad transformers
    hiding our work
    moving down the stack
    when explicit lifting is necessary
    understanding monad transformers by building one
    creating a monad transformer
    more typeclass instances
    replacing the parse type with a monad stack
    transformer stacking order is important
    putting monads and monad transformers into perspective
    interference with pure code
    overdetermined ordering
    runtime overhead
    unwieldy interfaces
    pulling it all together
    19. error handling
    error handling with data types
    use of maybe
    use of either
    exceptions
    first steps with exceptions
    laziness and exception handling
    using handle
    selective handling of exceptions
    i/o exceptions
    throwing exceptions
    dynamic exceptions
    error handling in monads
    a tiny parsing framework
    20. systems programming in haskell
    running external programs
    directory and file information
    program termination
    dates and times
    clocktime and calendartime
    file modification times
    extended example: piping
    using pipes for redirection
    better piping
    final words on pipes
    21. using databases
    overview of hdbc
    installing hdbc and drivers
    connecting to databases
    transactions
    simple queries
    sqlvalue
    query parameters
    prepared statements
    reading results
    reading with statements
    lazy reading
    database metadata
    error handling
    22. extended example: web client programming
    basic types
    the database
    the parser
    downloading
    main program
    23. 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
    24. 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
    25. 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
    26. 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
    27. 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
    28. 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
    a. installing ghc and haskell libraries
    b. characters, strings, and escaping rules
    index

    商品评论(0条)

    暂无评论!

    您的浏览历史

    loading 内容加载中,请稍后...