Arrow記法
from Arrow型クラス
ArrowsGHC拡張を使うことで、使える記法が増える
monadに対するdoのようなイメージ
code:hs
f = proc x -> do -- xを仮引数とする計算fを定義.
y <- g -< x -- 計算gにxを渡して実行して、結果をyに格納
z <- h -< (x, y)
returnA -< z -- 値を返すときは returnA を使う
引数は1つになる
procはラムダ式のようなイメージ
この辺のキーワードが増えている
proc
-<
returnA
https://gyazo.com/981ad43d75167fffe31600555629bdd4
合字でみれば矢印の流れがなんとなくイメージできる気がする
xを入力して、(2 *)を経由して、yに突っ込んでる感じ
Arrow記法を使わずにArrowを書いているとポイントフリー頻出で読みづらいので、それを回避するための方法のような #??
https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/arrow-notation.html
https://www.haskell.org/arrows/syntax.html
『関数プログラミングの楽しみ』 10章
https://ocharles.org.uk/guest-posts/2014-12-21-arrows.html
https://www.haskell.org/arrows/syntax.html
https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/arrow-notation.html
https://wiki.haskell.org/HXT
https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/arrows.html
https://haskell.jp/blog/posts/2018/about-ghc-exts-1.html
http://www.kotha.net/ghcguide_ja/7.6.2/arrow-notation.html
https://en.wikibooks.org/wiki/Haskell/Arrow_tutorial
https://acatalepsie.fr/posts/overloading-lambda
arrowを使わないラムダ抽象のoverloadのやりかた