「ふつうのHaskellプログラミング」や 「構文解析結合子」の元ネタは、どうやら「Monadic parsing in Haskell」のようです。(さらに元ネタは Parsec ですかね。) このオリジナルは、MonadPlus の部分などが古くさいのですが、分りやすいです。というわけで、例題を Parsec 風にアレンジしつつ、勉強してみました。 四則演算式のパーサーを実現することを目標にします。 おまじない 最終的に以下のモジュールが必要になるので、import しておきます。 import Monad import Data.Char Parser の定義 Parser 型の定義はこうなります。 data Parser a = Parser (String -> [(a,String)]) 状態を表すために関数を使っている 関数を使うと状態が表現できることが分らない人は、先に「状
The Greenhorn's Guide to becoming a Monad Cowboy Saddle up Round 'em up Brand 'em Maybe State List Reader IO Breed 'em StateT WriterT Drive 'em Copyrights Howdy! You all are probably wondering why this guide, when there are so many fine monad tutorials out there already. Well, I've noticed some people on the Haskell trail (and in the saloon) still talk of them monads like they were rattlesnakes ha
Introduction Monads in functional programming provide a framework for aspect-aware computations to be composed to build higher-level aspect-aware computations. An aspect-aware computation is some basic computation that has been enhanced, augmented, or, more generally, just transformed, to become aware of some generic concern. Consider, for example, the well-known maybe monad. This monad pr
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く