Upcoming SlideShare
×

# モナモナ言うモナド入門.tar.gz

• 1,293 views

「モナモナ言うモナド入門」の短縮版。

「モナモナ言うモナド入門」の短縮版。

• Comment goes here.
Are you sure you want to
Be the first to comment

Total Views
1,293
On Slideshare
0
From Embeds
0
Number of Embeds
3

Shares
8
0
Likes
4

No embeds

### Report content

No notes for slide

### Transcript

• 1. モナモナ言う モナド入門.tar.gz 2012-11-18 hiratara
• 2. 100分で話して来た
• 3. 超短縮版
• 4. 話す内容• 抽象化オタクの更なる高みを目指す• 「モナドは自己関手の圏のモノイド」 という雑学
• 5. 大統一理論２
• 7. そのとき Philip Wadlerの脳裏に閃光が走った！ ※この話はフィクションです
• 8. モノイダル圏双関手□と自然同型α、λ、ρがある圏 A B A□B f g f□g A’ B’ A’□B’
• 9. (モノイダル圏の) モノイド η□M M□η I□M M□M M□I μ λ ρ α M□μ M□M(M□M)□M M□(M□M) M μ□M μ M□M M
• 10. Monoid a(1) prod (id, mappend’)(a, a), a ((x, y), z) -> (x, (y, z)) a, (a, a) (a, a) prod (mappend’, id) mappend’ mappend’ (a, a) prod (f, g) (x, y) = (f x, g y) a mappend’ = uncurry mappend
• 11. Monoid a(1) (x <> y) <> z = x <> (y <> z) prod (id, mappend’)(a, a), a ((x, y), z) -> (x, (y, z)) a, (a, a) (a, a) prod (mappend’, id) mappend’ mappend’ (a, a) prod (f, g) (x, y) = (f x, g y) a mappend’ = uncurry mappend
• 12. Monoid a(2) prod (mempty’, id) prod (id, mempty’)((), a) (a, a) (a, ()) mappend’ snd fst a mempty’ = const mempty
• 13. Monoid a(2) mempty <> x = x x <> mempty = x prod (mempty’, id) prod (id, mempty’)((), a) (a, a) (a, ()) mappend’ snd fst a mempty’ = const mempty
• 14. Monoid a(2) mempty <> x = x x <> mempty = x prod (mempty’, id) prod (id, mempty’)((), a) (a, a) (a, ()) mappend’ snd fst a ”集合” mempty’ = const mempty
• 15. Monoidは 集合圏のモノイド
• 16. モナド則• 以下と同値 join . fmap join = join . join join . fmap return = join . return = id• 証明は http://ja.wikibooks.org/wiki/Haskell/ %E5%9C%8F%E8%AB%96 を参照
• 17. Monad m(1) id fmap joinmmma mmma mma join join joinmma ma
• 18. Monad m(1) join . fmap join = join . join id fmap joinmmma mmma mma join join joinmma ma
• 19. Monad m(2) return fmap returnma mma ma join id id ma
• 20. Monad m(2) join . fmap return = id join . return = id return fmap returnma mma ma join id id ma
• 21. Monad m(2) join . fmap return = id join . return = id return fmap returnma mma ma join id id ma ”自己関手”