Mercurial > hg > Members > atton > generated_seminar_slides
view slides/20140902/slide.html @ 42:ce4917c50d29
auto-Update generated slides by script
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 02 Sep 2014 18:03:20 +0900 |
parents | 3773cf2f688d |
children | d4e4ecc1c347 |
line wrap: on
line source
<!DOCTYPE HTML> <html lang="Japanese"> <head> <title>プログラムのデバッグ支援(仮)</title> <meta charset="UTF-8"> <meta name="viewport" content="width=1274, user-scalable=no"> <meta name="generator" content="Slide Show (S9)"> <meta name="author" content="Yasutaka Higa"> <link rel="stylesheet" href="themes/ribbon/styles/style.css"> <style> #Cover H2 { color:#FFF; text-align:center; font-size:70px; } </style> </head> <body class="list"> <header class="caption"> <h1>プログラムのデバッグ支援(仮)</h1> <p>Yasutaka Higa</p> </header> <div class="slide bg" id="Cover"><div> <section> <header> <h2>プログラムのデバッグ支援(仮)</h2> </header> <img src="pictures/" alt=""> <!-- © John Carey, http://fiftyfootshadows.net/ --> </section> </div></div> <!-- todo: add slide.classes to div --> <!-- todo: create slide id from header? like a slug in blogs? --> <div class="slide" id="2"><div> <section> <header> <h1 id="section">研究目的(仮)</h1> </header> <!-- === begin markdown block === generated by markdown 1.1.1 on Ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0] on 2014-09-02 18:03:19 +0900 with Markdown engine kramdown (1.3.3) using options {} --> <!-- _S9SLIDE_ --> <ul> <li>プログラミングにおいて、ソースコードを改変するとプログラムの挙動も変わる</li> <li>しかしリファクタリングにおいてはソースコードを変更した後も同じ結果を得たい</li> <li>ソースコードの改変をモナドとして記述し、実行結果の変化を自動的に検出したい</li> <li>これによりリファクタリング支援や後方互換性の支援などを行なう</li> </ul> </section> </div></div> <div class="slide" id="3"><div> <section> <header> <h1 id="section-1">業務連絡 + 近況報告</h1> </header> <!-- _S9SLIDE_ --> <ul> <li>PS4 環境開発詳細? (from 長田先生)</li> <li>Similar Monad <ul> <li>as Functor</li> <li>as Monad (has Constraint)</li> </ul> </li> </ul> </section> </div></div> <div class="slide" id="4"><div> <section> <header> <h1 id="similar-monad">Similar Monad</h1> </header> <!-- _S9SLIDE_ --> <ul> <li>似てるっぽい関数を記述して実行すると違う時に怒って欲しい</li> <li>値比較ができるのなら良いのですが</li> <li>/Users/one/hg/Members/atton/similar_monad</li> </ul> <pre><code>data Similar a b = Similar a (a -> b) b data Similar a a = Similar a (a -> a) a </code></pre> <ul> <li>型変数をどう扱うかで悩み中です</li> </ul> </section> </div></div> <div class="slide" id="5"><div> <section> <header> <h1 id="usage--similar-monad">Usage : Similar Monad</h1> </header> <!-- _S9SLIDE_ --> <pre><code>initObj = Similar 100 id 100 initObj >>= \x -> Similar x f (g x) >>= ... </code></pre> <p>f と g の diff があったら »= の時点で怒って欲しい</p> </section> </div></div> <div class="slide" id="6"><div> <section> <header> <h1 id="similar-monad-as-functor">Similar Monad as Functor</h1> </header> <!-- _S9SLIDE_ --> <pre><code>data Similar a b = Similar a (a -> b) b instance Functor (Similar a) where fmap g (Similar a f b) = Similar a (g . f) $ g b </code></pre> <ul> <li>型変数が2つだと Functor の定義は楽</li> </ul> </section> </div></div> <div class="slide" id="7"><div> <section> <header> <h1 id="similar-monad-as-functor-1">Similar Monad as Functor</h1> </header> <!-- _S9SLIDE_ --> <pre><code>instance Monad (Similar a) where return x = Similar x id x -- NG s >>= f = mu (eqmap f s) </code></pre> <ul> <li>型変数が2つだと Monad の return が定義できない <ul> <li>(Similar a) の a を固定していないと Monad の instance にできない</li> <li>return :: a1 -> Similar a a1</li> <li>を想定されているが、 id なので Similar a a でおかしい</li> </ul> </li> </ul> </section> </div></div> <div class="slide" id="8"><div> <section> <header> <h1 id="sample--similar-monad-as-functor-revision-9">Sample : Similar Monad as Functor (revision 9)</h1> </header> <!-- _S9SLIDE_ --> <pre><code>similar :: (Show b, Eq b) => (a -> b) -> (a -> b) -> a -> b similar f g x = same $ Similar x g (f x) -- samples ok = map (similar twicePlus double) [1..10] notOk = map (similar twicePlus plusTwo) [1..10] okSpecific = map (similar twicePlus plusTwo) [2] </code></pre> </section> </div></div> <div class="slide" id="9"><div> <section> <header> <h1 id="similar-monad-as-monad">Similar Monad as Monad</h1> </header> <!-- _S9SLIDE_ --> <pre><code>data Similar a b = Similar a (a -> b) b instance EqMonad Similar where return x = Similar x id x s >>= f = mu (eqmap f s) </code></pre> <ul> <li>型変数が1つなら Monad の定義はできる</li> <li>通常の Functor だと (a -> b) の b に constraint をかけられない</li> </ul> </section> </div></div> <div class="slide" id="10"><div> <section> <header> <h1 id="similar-monad-as-monad-1">Similar Monad as Monad</h1> </header> <!-- _S9SLIDE_ --> <pre><code>class EqFunctor f where eqmap :: (Eq a, Eq b) => (a -> b) -> f a -> f b instance EqFunctor Similar where eqmap f s = Similar fs id fs where fs = f $ same s </code></pre> <ul> <li>(a -> b) の b が Eq 保証された Functor Class を使えばどうにか</li> </ul> </section> </div></div> <div class="slide" id="11"><div> <section> <header> <h1 id="sample--similar-monad-as-monad-revision-11">Sample : Similar Monad as Monad (revision 11)</h1> </header> <!-- _S9SLIDE_ --> <pre><code>same $ return 100 >>= (\x -> Similar x twicePlus $ double x) 200 same $ return 2 >>= (\x -> Similar x plusTwo $ double x) 4 same $ return 100 >>= (\x -> Similar x plusTwo $ double x) *** Exception: Prelude.undefined </code></pre> </section> </div></div> <div class="slide" id="12"><div> <section> <header> <h1 id="problem">Problem</h1> </header> <!-- _S9SLIDE_ --> <ul> <li>type variable が 1つだと <ul> <li>Functor で移す先が Eq である保証が無くて怒られる</li> </ul> </li> <li>type variable が 2つだと <ul> <li>return の型がー</li> </ul> </li> <li>とりあえず悩み中です</li> </ul> <!-- vim: set filetype=markdown.slide: --> <!-- === end markdown block === --> </section> </div></div> <!-- To hide progress bar from entire presentation just remove “progress” element. --> <div class="progress"><div></div></div> <script src="scripts/script.js"></script> <!-- Copyright © 2010–2011 Vadim Makeev, http://pepelsbey.net/ --> </body> </html>