Real World Haskell - なんで Haskell?

http://d.hatena.ne.jp/yohtani/edit?date=20090219

Haskell は気になっていたので、がんばって読んでみよう。

というわけで、Real World Haskell を継続的に勉強。


ポールグレアムハッカーと画家"Lisp 最強!!" とか叫んでいるのを読むと、関数型言語が気になってしょうがないよね。

英語の勉強も兼ねて原則原文をあたるが、ときどき各サイトを参考にさせてもらうかもしれない。
Real World Haskellの読書メモ 1章 - Hatena’s Kitchen
502 Bad Gateway

目次

Real World Haskell
さて、目次を見る限り、守備範囲はとても広い。
Web client なんてのもあるぞ。

# Why functional programming? Why Haskell?
# 1. Getting started
# 2. Types and functions
# 3. Defining types, streamlining functions
# 4. Functional programming
# 5. Writing a library: working with JSON data
# 6. Using typeclasses
# 7. Input and output
# 8. Efficient file processing, regular expressions, and file name matching
# 9. I/O case study: a library for searching the filesystem
# 10. Code case study: parsing a binary data format
# 11. Testing and quality assurance
# 12. Barcode recognition
# 13. Data structures
# 14. Monads
# 15. Programming with monads
# 16. The Parsec parsing library
# 17. The foreign function interface
# 18. Monad transformers
# 19. Error handling
# 20. Systems programming
# 21. Working with databases
# 22. Web client programming
# 23. GUI programming
# 24. Basic concurrent and parallel programming
# 25. Profiling and tuning for performance
# 26. Advanced library design: building a Bloom filter
# 27. Network programming
# 28. Software transactional memory
# B. Installing GHC and Haskell libraries
# C. Characters, strings, and escaping rules
# D. Web site and comment system usage and policies

なんで Haskell?

Why functional programming? Why Haskell?

  • 3つの要素
    • 1. 新規性 (novelty)
      • function

In Haskell, we de-emphasise 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.

      • for ループとか無いよ
      • lazy language だよ
    • 2. パワー (power)
      • データは変更されないから理不尽なバグが起こらない
      • 自動的にテストする仕組みもあるらしい
      • 最初の例
minima k xs = take k (sort xs)
      • less code, less time, fewer bugs.
    • 3. 楽しさ (fun)

Harking back to our own days of getting started with Haskell, the good news is that the fun begins early: it's simply an entertaining challenge to dig into a new language, in which so many commonplace ideas are different or missing, and to figure out how to write simple programs.

参考