<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/paphi/">
    <title>paphi @wiki</title>
    <link>http://w.atwiki.jp/paphi/</link>
    <atom:link href="https://w.atwiki.jp/paphi/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>paphi @wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2012-12-26T07:24:57+09:00</dc:date>
    <utime>1356474297</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/18.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/17.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/16.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/15.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/12.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/10.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/7.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/6.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/3.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/paphi/pages/2.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/18.html">
    <title>haskell/arrow</title>
    <link>https://w.atwiki.jp/paphi/pages/18.html</link>
    <description>
      [[haskell]] &gt; arrow

* Arrow
Monadの進化形みたいなもの（適当）
 Monad m -- m a   :: *, m :: * -&gt; *
 Arrow a -- a b c :: *, a :: * -&gt; * -&gt; *
ArrowはArrowApplyを満たしてはじめてMonadと等価だそうです．

** ライブラリ
本当はFRPの括りで紹介すべきなんだろうけど．以下の話は全てこれ前提．
[[http://www.haskell.org/haskellwiki/Netwire]]
[[http://hackage.haskell.org/package/netwire]]
2012/12現在4.0.7

* netwire
** Wire型
*** instance
記法として使いそうなのだけ．ArrowApplyは満たしていない．

以下の省略を用いる．本当はdataに制約つけるのは良くないらしい．
 (Monoid e, Monad m) =&gt; type WireP = Wire e m
Categoryっぽく直列につなぐ．
 instance Category WireP where
   id  :: WireP a a
   (.) :: WireP b c -&gt; WireP a b -&gt; WireP a c
Alternativeで並列に．
 instance Functor (WireP a) where
   fmap  :: (b -&gt; c) -&gt; WireP a b -&gt; WireP a c
 instance Functor (WireP a) =&gt; Applicative (WireP a) where
   pure  :: b -&gt; WireP a b
   (&lt;*&gt;) :: WireP a (b -&gt; c) -&gt; WireP a b -&gt; WireP a c
   (&lt;$&gt;) :: (b -&gt; c) -&gt; WireP a b -&gt; WireP a c                 -- (&lt;$&gt;) = fmap
 instance Applicative (WireP a) =&gt; Alternative (WireP a) where --    </description>
    <dc:date>2012-12-26T07:24:57+09:00</dc:date>
    <utime>1356474297</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/17.html">
    <title>haskell/syntax</title>
    <link>https://w.atwiki.jp/paphi/pages/17.html</link>
    <description>
      [[haskell]] &gt; syntax
* Haskellの構文
[[Haskell2010&gt;http://www.haskell.org/onlinereport/haskell2010/]]準拠
工事中

** if, case...of, |
*** if
elseは必須．
 abs n =
   if n &lt; 0
     then -n
     else  n
*** case
これだけインデントを揃える必要がある．多分doと同じ
 sign n = case n `compare` 0 of
   LT -&gt; -1
   GT -&gt;  1
   EQ -&gt;  0
   _  -&gt; error &quot;error&quot;
*** |
otherwise = True
 sign n
   | n &lt; 0 = -1
   | n &gt; 0 =  1
   | otherwise = 0
*** パターンマッチ
分岐っぽいのでついでに
 delta 0 = 1
 delta _ = 0

caseがパターンマッチとかぶってるようだがdataの構成子などで有用．

http://d.hatena.ne.jp/kazu-yamamoto/20110826/1314352340
ここにcaseとガードを混ぜる例があるけど実用はできないと思う．

** where, let...in

** do
[[DoAndIfThenElse&gt;http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse]] hlint(haskell-src-exts)はこの構文に未対応．[[#215&gt;http://trac.haskell.org/haskell-src-exts/ticket/215]]

[[Arrows: A General Interface to Computation&gt;http://www.haskell.org/arrows/]]
[[Haskell/Arrows - Wikibooks&gt;http://ja.wikibooks.org/wiki/Haskell/Arrows]]

** インデント
http://d    </description>
    <dc:date>2012-09-22T08:23:40+09:00</dc:date>
    <utime>1348269820</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/16.html">
    <title>haskell</title>
    <link>https://w.atwiki.jp/paphi/pages/16.html</link>
    <description>
      * Haskell
世はまさに関数型時代

#ls    </description>
    <dc:date>2012-09-06T03:18:35+09:00</dc:date>
    <utime>1346869115</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/15.html">
    <title>haskell/random</title>
    <link>https://w.atwiki.jp/paphi/pages/15.html</link>
    <description>
      [[haskell]] &gt; random
* Haskellの乱数
乱数は疑似乱数に限定．
&gt; import System.Random
&gt; import Control.Monad.State

** 乱数の定義
乱数はseed値を与えると，値がランダムである無限リストを返す関数であるとひとまず定義する．
乱数の型を1から6までの整数とすると，
&gt; inftyrand seed = [6, 5, 5, 3, ...]
のようになる．ここで，
&gt; inftyrand seed = x:xs -- 先の例では, x = 6, xs = [5, 5, 3, ...]
&gt; inftyrand seed&#039; == xs
となるseed&#039;が存在すると仮定して，乱数を次のように定義することもできる．
#region(seed&#039;の仮定について)
このseed&#039;はまず存在すると考えてよい．
というよりは私の知る乱数は全て Seed -&gt; (a, Seed) という型で計算できる．
例えばC標準の線形randで連想されるアレが一番考えやすい．LCG, 線形合同法というらしい．
http://en.wikipedia.org/wiki/Linear_congruential_generator
簡単に言うと，x = x * c + a (mod m)．この乱数は
&gt; next x = let y = x * c + a `mod` m in (y, y)
と表すことができる．ここでSeedはただの整数値である．

Seedをもう少し複雑にすれば，一気に生成するタイプにも対応できる．多分．(SFMTとか)
Seedの一般化としてRandomGenがある...この辺から表現が曖昧に
複雑なSeed型からどうやって次の値を得るのか，ではなく，
RandomGen型のinstanceであるgが next :: g -&gt; (Int, g) なる関数を持ち，
そこから各種乱数値を生成している...と思う．未確認．
いままで(というかLCGのみ？)値と考えてきたSeedを，次の乱数を生成できる状態と考えることによる一般化である．

seed&#039;が存在するというより，Haskellの乱数は Seed -&gt; (a, Seed) 型の関数を主軸に構成    </description>
    <dc:date>2012-09-06T03:05:58+09:00</dc:date>
    <utime>1346868358</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/12.html">
    <title>プラグイン/コメント</title>
    <link>https://w.atwiki.jp/paphi/pages/12.html</link>
    <description>
      * コメントプラグイン
@wikiのwikiモードでは
 #comment()
と入力することでコメントフォームを簡単に作成することができます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/17_60_ja.html


-----
たとえば、#comment() と入力すると以下のように表示されます。

#comment    </description>
    <dc:date>2012-09-01T00:12:14+09:00</dc:date>
    <utime>1346425934</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/10.html">
    <title>プラグイン</title>
    <link>https://w.atwiki.jp/paphi/pages/10.html</link>
    <description>
      @wikiにはいくつかの便利なプラグインがあります。

-----


#ls

-----

これ以外のプラグインについては@wikiガイドをご覧ください
=&gt;http://atwiki.jp/guide/
    </description>
    <dc:date>2012-09-01T00:12:14+09:00</dc:date>
    <utime>1346425934</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/7.html">
    <title>プラグイン/アーカイブ</title>
    <link>https://w.atwiki.jp/paphi/pages/7.html</link>
    <description>
      * アーカイブ
@wikiのwikiモードでは
 #archive_log()
と入力することで、特定のウェブページを保存しておくことができます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/25_171_ja.html


-----


たとえば、#archive_log()と入力すると以下のように表示されます。
保存したいURLとサイト名を入力して&quot;アーカイブログ&quot;をクリックしてみよう


#archive_log()
    </description>
    <dc:date>2012-09-01T00:12:14+09:00</dc:date>
    <utime>1346425934</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/6.html">
    <title>プラグイン/編集履歴</title>
    <link>https://w.atwiki.jp/paphi/pages/6.html</link>
    <description>
      * 更新履歴
@wikiのwikiモードでは
 #recent(数字)
と入力することで、wikiのページ更新履歴を表示することができます。
詳しくはこちらをご覧ください。
＝＞http://atwiki.jp/guide/17_117_ja.html


-----


たとえば、#recent(20)と入力すると以下のように表示されます。


#recent(20)
    </description>
    <dc:date>2012-09-01T00:12:14+09:00</dc:date>
    <utime>1346425934</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/3.html">
    <title>右メニュー</title>
    <link>https://w.atwiki.jp/paphi/pages/3.html</link>
    <description>
      **更新履歴
#recent(20)


&amp;link_editmenu2(text=ここを編集)
    </description>
    <dc:date>2012-09-01T00:12:14+09:00</dc:date>
    <utime>1346425934</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/paphi/pages/2.html">
    <title>メニュー</title>
    <link>https://w.atwiki.jp/paphi/pages/2.html</link>
    <description>
      **メニュー
-[[トップページ]]

----
** 最新10件
#recent(10)
**リンク
-[[@wiki&gt;&gt;http://atwiki.jp]]
-[[@wikiご利用ガイド&gt;&gt;http://atwiki.jp/guide/]]

&amp;link_editmenu(text=ここを編集)    </description>
    <dc:date>2012-09-01T01:08:18+09:00</dc:date>
    <utime>1346429298</utime>
  </item>
  </rdf:RDF>
