タグ

monadとApplicativeに関するigrepのブックマーク (2)

  • Applicativeのススメ - あどけない話

    この記事の目的は、Applicative 信者による Applicative スタイルの布教です。 簡潔に結論を述べると、 foo = do a <- m1 b <- m2 return (f a b) のようなコードを書きたくなったら foo = f <$> m1 <*> m2 と書きましょうということ。 合い言葉は、「do と return をなくせ!」です。 FunctorとMonadの間 Functor を特殊化した型クラスがMonadで、Monadの方が強力です。なぜなら、メソッドが増えるからです。 Functorのメソッドはfmapです。fmapの別名を (<$>) といいます。(この記事では、(<$>) と liftM を同一視します。) そして、Monadのメソッドは、ご存知の通り (>>=) と return です。 FunctorとMonadの間にApplicative

    Applicativeのススメ - あどけない話
    igrep
    igrep 2016/05/15
    ブクマしてなかった。今はもうこの記事で言うところの理想化された世界になったからいいよね!
  • Applicative vs Monadic build systems

    Summary: Shake is a monadic build system, and monadic build systems are more powerful than applicative ones. Several people have wondered if the dependencies in the Shake build system are monadic, and if Make dependencies are applicative. In this post I'll try and figure out what that means, and show that the claim is somewhat true. Gergo recently wrote a good primer on the concepts of Applicative

    igrep
    igrep 2014/08/13
    "Alternatively stated, a monad lets you chose future dependencies based on the results of previous dependencies."
  • 1