タグ

monadに関するtetrylのブックマーク (16)

  • A Neighborhood of Infinity: You Could Have Invented Monads! (And Maybe You Already Have.)

    You Could Have Invented Monads! (And Maybe You Already Have.) If you hadn't guessed, this is about monads as they appear in pure functional programming languages like Haskell. They are closely related to the monads of category theory, but are not exactly the same because Haskell doesn't enforce the identities satisfied by categorical monads. Writing introductions to monads seems to have developed

  • Motivation for Monads

    This is not a monads tutorial! There are lots of those in the world already. The best of those tutorials do a decent job of explaining the what and how of monads, but I haven't come across one that I think really nails the why. This essay is an attempt to fill this gap. To explain the why of monads, we have to first explain the why of the functional style of programming. The functional style has t

    tetryl
    tetryl 2016/03/19
  • モナドはポケモン。数学が出てこないモナド入門 - Qiita

    仮説:モナドとはポケモンである このテキストは、でんこうせっかの速さでモナドが使えるようになりたいひとのための、真面目なモナド入門です。数学っぽい話はなるべく避けていますし、関数型言語についての知識がなくても読めるように書いています。対象の読者は以下のような人です。 モナドが何なのか知りたい、使いたい Haskellを学ぼうとしたがモナドがわからなくて挫折した モナドを学ぼうとしたら、箱だのブリートだのと変な喩え話をされて余計わからなくなった プログラミングを学ぶつもりが数学の講義が始まったので止めた 最初はモナドは難しいからとGHCiを使わされたが、電卓程度にしかならないので飽きた なお、何故か説明の補助としてポケモンが登場しますが、この記事を読むのに別にポケモンをプレイしたことがある必要はありません。この記事はもしポケモン要素を全部無視したとしてもわかるようになっています。 挿絵があっ

    モナドはポケモン。数学が出てこないモナド入門 - Qiita
    tetryl
    tetryl 2016/03/12
  • From Lenses to Yoneda Embedding

    From Lenses to Yoneda Embedding Posted by Bartosz Milewski under Category Theory, Functional Programming, Haskell, Lens, Programming [6] Comments Lenses are a fascinating subject. Edward Kmett’s lens library is an indispensable tool in every Haskell programmer’s toolbox. I set out to write this blog post with the goal of describing some new insights into their categorical interpretation, but then

    From Lenses to Yoneda Embedding
  • より自由なFreerモナドをSchemeに - Qiita

    data Freer f a where Pure :: a -> Freer f a Impure :: f x -> (x -> Freer f a) -> Freer f a instance Monad (Freer f a) where return = Pure Pure x >>= k = k x Impure fx k' >>= k = Impure fx (k' >>> k) Pure に関しては Free と同じだが、 Impure の方は f x の値とそれを使う計算(継続)を合わせて持ち回り、 >>= で値を計算するのではなく継続を組み立てるようにしている。 >>> は Category クラスにおける射の合成で、ここでは Kleisli 射を合成して k' をした後に k をする計算を作っている。 先述の通り、この定義は Operational モナドと同一だが、

    より自由なFreerモナドをSchemeに - Qiita
    tetryl
    tetryl 2015/09/29
  • モナド教

    前提知識:モナド モナドを理解せずともモナド教を信ずることは出来ますが,理解していればより深く納得できるでしょう. 操作 :: 型 -> 型 は,"型"から"型"へ写す"操作"の存在を表します. モナドの文脈 m が必要とする2つの操作: return :: a -> m a で,値を保ちつつ文脈 m の中に入れ込むことが出来ます. (=<<) :: (a -> m b) -> (m a -> m b) で,「値を文脈に入った別の値へ写す操作」を「文脈に入った値を同じ文脈に入った別の値へ写す操作」に変換します. id :: a -> a は値をそのまま返す操作です. id を =<< で変換して得られる操作 join :: m (m a) -> m a で,二重に文脈に入った値を一重の文脈に入った値に戻すことが出来ます. 文脈の値から生の値を取り出す型 m a -> a を持つ操作は,一般

    tetryl
    tetryl 2014/08/15
  • 世界一わかりやすいモナドの記事 - Just $ A sandbox

    は環 はアーベル群 , として、 はAbel圏でモナドを定め、T-代数は左加群になる*1。 *1:これよりわかりやすい例があれば教えて下さい

    世界一わかりやすいモナドの記事 - Just $ A sandbox
    tetryl
    tetryl 2014/04/19
  • Monads

    Monads All the code for this post are available here.https://github.com/santoshrajan/monadjs Consider the map functor from the last chapter. We could use map to iterate over two arrays adding each element of the first to the second. var result = [1, 2].map(function(i) { return [3, 4].map(function(j) { return i + j }) }) console.log(result) ==>> [ [ 4, 5 ], [ 5, 6 ] ] The type signature of the inne

  • 絵で見るモナド · eed3si9n

    2012-08-21 John Wiegley さんの “Monads in Pictures” を翻訳しました。翻訳の公開は人より許諾済みです。翻訳の間違い等があれば遠慮なくご指摘ください。 2012年8月20日 John Wiegley 著 2012年8月21日 e.e d3si9n 訳 これはモナドのチュートリアルではないし、ここには数学用語も出てこない。稿は、既にモナドを一応使えるぐらいには習った人を対象とする。視覚化することで、何のために何をやっているかが明らかになるはずだ。 関数 モナドに対する直感を得る一つの方法として関数からモナドへの抽象化をたどるというものがある。関数が何をやっているのかを簡単な絵で表してみよう。Haskell の関数の呼び出しの構文を上に、同じ演算を視覚化したものを下に置いた: 関数はある値 a を投射 (map) して別の値 b を得る。中で何が起

    tetryl
    tetryl 2012/08/22
  • Scala Monads: Declutter Your Code With Monadic Design

    In this video tutorial, Dan Rosen will show you how to use Scala's capacity for monadic design to eliminate repetitive boilerplate in your code. You'll learn to recognize places where the perpetual clutter of null checks, try-catch blocks and more can be hidden within a monad, to make your code's logic stand out clearly. ** Head to http://marakana.com for more open source educational resources

    Scala Monads: Declutter Your Code With Monadic Design
  • Asynchronous API in C++ and the Continuation Monad - FP Complete

    The latest C++11 Standard was a brave attempt, after many years of neglect, at catching up with the reality of concurrent programming. The result is a new memory model — a solid foundation for concurrency — and a collection of random concurrency features, many of them either obsolete or inadequate. But there is hope on the horizon: the next C++ Standard, on which the work started even before C++11

    Asynchronous API in C++ and the Continuation Monad - FP Complete
  • Scrap your type classes

    Edit: My opinion on type classes has mellowed since I wrote this post, but I still keep it around as a critique against the excesses of type classes. What I'm about to propose is that all Haskell type class programming can (and should) be implemented purely at the value level using a simple and ordinary code transformation. The trick is simple and I will begin by transforming the Monad type-class.

    tetryl
    tetryl 2012/05/02
  • Monad tutorials timeline - HaskellWiki

    This is a comprehensive timeline of monad tutorials and related articles. Please update this list as it becomes outdated! If you find a tutorial, article, post, comment, or message that stands on its own as an explanation of monads, then please take a moment to paste the link somewhere on this page (register a throwaway account, if you prefer). The date, author, and blurb can be added later. This

    Monad tutorials timeline - HaskellWiki
    tetryl
    tetryl 2012/01/07
  • News

    Learn about new integrations, partnerships and more. Legitify, a leading remote online notarisation solution, has entered into a partnership with Scrive to offer electronic notarisation. Read articleRead articleGermany is taking a major step towards digitising employment contracts. Find out how this shift can simplify processes and increase flexibility in signing employment agreements digitally. R

  • QAで学ぶMonad - あどけない話

    この記事は、Monad でつまづいた Haskeller のための Monad 再入門です。 Monadとは何ですか? Monad とは、単なる型クラスの一つです。難しいという風評もありますが、それ以上でもそれ以下でもありません。 この型クラスのメソッドは、return と >>= です。 class Monad m where (>>=) :: m a -> (a -> m b) -> m b return :: a -> m a つまり、以下を満たす型の集合が Monad です。 m a で表現できるように一つの型変数を格納するコンテナ型 >>= と return を実装 return は新しいコンテナを作り、>>= は二つのコンテナを合成します。 Monad のインスタンスは失敗系と状態系に大別できます。以下に代表的なインスタンスを示します。 失敗系: Maybe、[] (リスト)

    QAで学ぶMonad - あどけない話
    tetryl
    tetryl 2011/11/17
  • monad-control

    Yesod is a Haskell web framework for productive development of type-safe, RESTful, high performance web applications. August 25, 2011By Michael SnoymanView source on Github Overview One of the powerful, and sometimes confusing, features in Haskell is monad transformers. They allow you to take different pieces of functionality- such as mutable state, error handling, or logging- and compose them tog

    tetryl
    tetryl 2011/10/06
  • 1