• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
モナモナ言うモナド入門.tar.gz
 

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

on

  • 1,657 views

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

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

Statistics

Views

Total Views
1,657
Views on SlideShare
1,528
Embed Views
129

Actions

Likes
4
Downloads
8
Comments
0

5 Embeds 129

http://makopi23.blog.fc2.com 84
http://control.blog.fc2.com 34
https://twitter.com 9
https://si0.twimg.com 1
http://cache.yahoofs.jp 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    モナモナ言うモナド入門.tar.gz モナモナ言うモナド入門.tar.gz Presentation Transcript

    • モナモナ言う モナド入門.tar.gz 2012-11-18 hiratara
    • 100分で話して来た
    • 超短縮版
    • 話す内容• 抽象化オタクの更なる高みを目指す• 「モナドは自己関手の圏のモノイド」 という雑学
    • 大統一理論2
    • お題Monoid則とMonad則は統一できるか?
    • そのとき Philip Wadlerの脳裏に閃光が走った! ※この話はフィクションです
    • モノイダル圏双関手□と自然同型α、λ、ρがある圏 A B A□B f g f□g A’ B’ A’□B’
    • (モノイダル圏の) モノイド η□M M□η I□M M□M M□I μ λ ρ α M□μ M□M(M□M)□M M□(M□M) M μ□M μ M□M M
    • 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
    • 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
    • Monoid a(2) prod (mempty’, id) prod (id, mempty’)((), a) (a, a) (a, ()) mappend’ snd fst a mempty’ = const mempty
    • 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
    • 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
    • Monoidは 集合圏のモノイド
    • モナド則• 以下と同値 join . fmap join = join . join join . fmap return = join . return = id• 証明は http://ja.wikibooks.org/wiki/Haskell/ %E5%9C%8F%E8%AB%96 を参照
    • Monad m(1) id fmap joinmmma mmma mma join join joinmma ma
    • Monad m(1) join . fmap join = join . join id fmap joinmmma mmma mma join join joinmma ma
    • Monad m(2) return fmap returnma mma ma join id id ma
    • Monad m(2) join . fmap return = id join . return = id return fmap returnma mma ma join id id ma
    • Monad m(2) join . fmap return = id join . return = id return fmap returnma mma ma join id id ma ”自己関手”
    • Monadは自己関手圏のモノイド
    • まとめ• 同じ図で法則をまとめれるのはイイ• 書きかけの検証用ソース https://gist.github.com/4104020