以前(id:fits:20101129, id:fits:20101204)試したような CSV ファイルのパース処理を書籍 Real World Haskell―実戦で学ぶ関数型言語プログラミング を参考に Haskell と Scala のパーサーコンビネータでやってみました。 Haskell の方は本の内容ほとんどそのままなので簡単に動作しましたが、Scala の方は挙動が良く分からなくて結構苦労しました。 環境は以下の通り。 HaskellPlatform 2010.2.0.0 (GHC 6.10.4) Scala 2.8.1 サンプルのソースは http://github.com/fits/try_samples/tree/master/blog/20101226/ 単純なCSV まずは、以下のような単純な CSV ファイルをパースするサンプルです。 test_simple.cs