Preface、SML概観 ぱらぱらめくる『Purely Functional Data Structures』

  • Haskell関数型言語Standard MLもそう。SMLはOCalm系らしい。似ている点もあれば違う点もある(こちら)。
  • 共通点
    • First-class support for algebraic datatypes (disjoint unions)
    • Pattern matching on primitive and custom values
    • Arbitrarily higher order functions
    • Type synonyms
    • Hindley-Milner Type Inference
    • Parametric Polymorphism (define arbitrary Functors etc.)
    • Ad-hoc polymorphism (Haskell through type classes, SML through modules)
    • scorn of inclusion polymorphism (sub-type relations, a la object-wise inheritance)
    • Monads (and other exotic algebraic structures)—"Haskell has monads" is a common claim of superiority, but the reality is that at the language level a monad is nothing more than an abstraction pattern, and hence every language (can) have monads. Including a monad or not in any given language is a library-level decision.
  • 違い
    • Purity(PureでSide-effectフリーなハスケル、融通を聞かせているSML)
    • Referential transparency (付値できないハスケル、できるSML)
    • Evaluation semantics(Lazyなハスケル、StrictなSML)
    • Syntactic sugar(list/string/boolean/integerに関してがっちりのハスケル、そこそこのSML)
    • その他(IOに関して関数形式化を徹底しているハスケルhugs/ghcなどの環境が整備されているハスケル、オープン開発・発展のハスケル、モジュールによる様々なハンドリング手法の提供をするSML)
  • 評価全体
    • ハスケルの方が関数型言語として徹底するべきところを徹底していて、発展中、といったところでしょうか
    • ML系列の現在形といえばOcamlなのかと思います