0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

モナドメモ

Last updated at Posted at 2016-05-31

メモ

  • 表の世界とモナドの世界
  • 表の世界を「モナド」でラップしたもの
  • 「ラッパー」という概念を、構成的にではなく外側から見た振る舞い(≒インターフェース)によって定義したものと理解することが可能
  • つまり、「ラッパー」の中は直接的に見ることができないのだけれども、外側からどのような刺激を与えるとどのような反応を返すべきか(あるいは返さないか)は観測できるものとして定義する
  • モナド界のオブジェクトがあったとして、必ずしもそこから表層界のオブジェクトを取り出せるとは限らないということ
  • 外界に対して副作用を及ぼすようなモナドについては、むしろその中は観測不能であるべき
  • 実際のところ、表の世界だけの道具だてでモナドを構築する限りにおいては、中が観測可能なものしかできないように思われる
  • システムが用意してくれる裏世界モナドを使うことで、我々表世界のプログラマもある程度裏世界をあやつれるということか

モナド則

  • モナドは、それに関係する二つの演算子 bind と return で特徴付けられる
  • return は、ある表世界の型 t からモナド界の型 M t への関数。 return: t → M t
  • bind は、表層界からモナド界への関数 : t → M u をモナド界の関数 : M t → M u にマップする。

image


image

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?