<- readConfig n <- parseInt s return n (readConfigとparseIntの定義) readConfig :: Maybe String readConfig = Just "42" parseInt :: String -> Maybe Int parseInt s = case reads s of [(n, "")] -> Just n _ -> Nothing これはOption型の例ですが、Result型やPromise型、IOモナドなどでも同様に do構文を使えます。 16
Programmer’s Guide to the IO Monad — Don’t Panic 簡単な方のモナドの定義をきちんと理解するための資料です。 Notions of computation and monads - Eugenio Moggi 計算作用にモナドを利用することを提案した1989年の論文です。 22