LTé§åéçº14ã®çºè¡¨è³æã§ãã https://github.com/LTDD/Sessions/wiki/LT%E9%A7%86%E5%8B%95%E9%96%8B%E7%99%BA14 解説 http://blog.eiel.info/blog/2015/05/02/want-stariâ¦
ãã®è¨äºã¯ãHaskellãåå¼·ãã¦ããç¨åº¦åãã£ããã©ãMonadã§æ«æãã人ã®ããã®è¨äºã§ãã10åéã§ãMonadã«å¯¾ããç´å¾æãå¾ããã¨ãç®çã¨ãã¦ãã¾ããä»ã®è¨èªã§ãããã¢ãããã«ãéç¨ããå 容ã§ãããHaskell ã®ææ³ãç¨èªãç¨ãã¾ãã®ã§ãä»ã®è¨èªã®å©ç¨è ã«åãããã¯ä¸æã§ãã Haskellãåå¼·ããã®ã§ãããã 代æ°ãã¼ã¿å åã¯ã©ã¹ ã¯åãã£ã¦ãããã¨ã«ãã¾ããMonad ã¯ãåãªãåã¯ã©ã¹ã®ä¸ã¤ã§ããã以ä¸ã§ããã以ä¸ã§ãããã¾ããããããã®äºã¤ãåãã£ã¦ãªãã¨è©±ã«ãªãã¾ããã ã¾ããè¨èªå DSL(以ä¸ãDSLã¨ç¥è¨)ã¨ããèãæ¹ãç¥ã£ã¦ãããã¨ãä»®å®ãã¾ããMonad ã¨ã¯ãDSLã®ãã¬ã¼ã ã¯ã¼ã¯ã¨ããç´æãä¸ããã®ãããã®è¨äºã®ä¸»ç¼ã§ããããã ããã«ãæ§é åå®çãããåèªãèãã¦ãããããªã人ãæ³å®ãã¦ãã¾ããé次ãå復ãåå²ãããã°ãè¨ç®ãããè¨ç®ã¯ãã¹ã¦è¨
Principles of Reactive Programming æåé±ã®è¬ç¾©ã§è¨ã£ã¦ããã¨ã å¿ããããªã®ã§ã¡ã¢ã ã¢ããã§ããããã«ã¯ã¢ããåãæºãããã°ãªããªãã ã¢ããåã¯ä»¥ä¸ã®ï¼ã¤ã Associativity: (m flatMap f) flatMap g == m flatMap (x => f(x) flatMap g) Left unit: unit(x) flatMap f == f(x) Right unit: m flatMap unit == m ã¡ãªã¿ã«ãããHaskellæ¬ã§ã¢ããåã¯æ¬¡ã®ããã«æ¸ããã¦ããã çµåæ³å: (m >>= f) >>= g 㨠m >>= (\x -> f x >>= g) ãç価 å·¦æçæ§: return x >>= f 㨠f x ãç価 å³æçæ§: m >>= return 㨠m ãç価 flatMap ã >>=
ãã®ã¨ã³ããªã¯Scalaã¢ããã³ãã«ã¬ã³ãã¼ã®3æ¥ç®ã§ããæ¨æ¥ã¯ Kuchitama ããã®Scalaãã¤ãªãã§ãããç¸-NetflixMeetup Kyoto éå¬å¾è¨- ã§ããã åãã ãã®è¨äºã¯ãã¿ã¤ãã«éãFreeã¢ããã¨Coyonedaãæ±ããã®ã®ããã¾ããããã®ç´æ¥çãªè©±ãã¢ãã¢ããã話ã§ã¯ãªããããã«è³ãã¾ã§ã®å®è£ ã®ããããããScalaã®ããã°ã©ãã³ã°ã¨ãã¦ãææ¢ãã§è¿½ã£ã¦ã¿ãããã¨ãããã®ã§ãã ãã®éç¨ã§ãç¹ã«åå¼æ°(åå¤æ°)ãé«éåããããããç¶æ¿æã«ã©ãæ±ãããã¨ãããããã®Scalaã®åºæ¬ã«ãã£ã·ã触ãã¾ãã ãªã®ã§ãFreeã¢ããã«èå³ããªãæ¹ã§ã åå¼æ°ã§ A ã¨ã F[_] ã¨ãåºã¦ããã¨ãã¾ã ã¡ãã£ã¨ããã Scalaã§ããããã°ã©ãã³ã°ããã¨åãåããã¤ã¾ã¥ãäºãå¤ã ã¨ããæ¹ã«ããå½¹ã«ç«ã¤é¨åãããã¨æãã®ã§åèã«ãã²èªãã§ã¿ã¦ãããããã§ãã ãã¡
ãã®è¨äºã¯jQuery is a Monad | Important Shockã¨ããè¨äºã®åæ訳ã§ãã 追è¨1: bonotakeãããè£è¶³è¨äºãæ¸ãã¦ããã¦ãã¾ã â JQueryãã¢ãããã©ããã¨ã - ãããã®æ¥è¨ï¼ 天竺ãã帰ã£ã¦ããã 追è¨2: hirataraãããè£è¶³è¨äºãæ¸ãã¦ããã¦ãã¾ã â jQueryã¯æ¬å½ã«ã¢ããã ã£ã - åæµ·éè«å°ç§å¸åºèº«ã®PGãæ¸ãããã° Haskellããã°ã©ãã¼ã¯èª°ãããã¢ããã«é¢ããåã ã®ãã¥ã¼ããªã¢ã«ãæ¸ãã¨è¨ããããã¨ããã®ããä¸åº¦ã¢ããã®å®ç¾©ã¨ãã®å¯è½æ§ãç解ããã°ãã¢ããå ¨ä½ãå²ãç¥ç§æ§ã«ææ¦ãã¦æã¡ç ´ãã®ã容æã«ãªãããã ãéå¤æ¼¢ããããã°ãã¢ããã¯Haskellãçã«ç解ãããã¨ã妨ããä¸å¯è§£ãªéå£ã ãã¢ããã¯ã¨ã¦ãä¸é©å½ãªååã§åªããã¦ãã¦ãä¸é¢¨å¤ãã£ãææ³ãæã¡ãä¸åº¦ã«ä½ããããã£ã¦ãã¾ãæ§ã«è¦ãããããããªããããã®åã
åæç¥èï¼ã¢ãã ã¢ãããç解ããã¨ãã¢ããæãä¿¡ãããã¨ã¯åºæ¥ã¾ããï¼ç解ãã¦ããã°ããæ·±ãç´å¾ã§ããã§ãããï¼ æä½ :: å -> å ã¯ï¼"å"ãã"å"ã¸åã"æä½"ã®åå¨ã表ãã¾ãï¼ ã¢ããã®æè m ãå¿ è¦ã¨ãã2ã¤ã®æä½ï¼ return :: a -> m a ã§ï¼å¤ãä¿ã¡ã¤ã¤æè m ã®ä¸ã«å ¥ãè¾¼ããã¨ãåºæ¥ã¾ãï¼ (=<<) :: (a -> m b) -> (m a -> m b) ã§ï¼ãå¤ãæèã«å ¥ã£ãå¥ã®å¤ã¸åãæä½ãããæèã«å ¥ã£ãå¤ãåãæèã«å ¥ã£ãå¥ã®å¤ã¸åãæä½ãã«å¤æãã¾ãï¼ id :: a -> a ã¯å¤ããã®ã¾ã¾è¿ãæä½ã§ãï¼ id ã =<< ã§å¤æãã¦å¾ãããæä½ join :: m (m a) -> m a ã§ï¼äºéã«æèã«å ¥ã£ãå¤ãä¸éã®æèã«å ¥ã£ãå¤ã«æ»ããã¨ãåºæ¥ã¾ãï¼ æèã®å¤ããçã®å¤ãåãåºãå m a -> a ãæã¤æä½ã¯ï¼ä¸è¬
ç¶æ 管çã®ã¢ãã«æ¡: spawn/killã¢ãã«ã®å®è£ ãä½ã£ã¦ã¿ãã worldsããã±ã¼ã¸ãããã (é²éª¨ãªååã ã赦ãã¦ã»ãã)ãåã®è¨äºã¨éãç¹ã¯ãWorldãã¢ããå¤æåã¨ãã¦å®è£ ããã¦ããç¹ã ãã§ããã worlds-exampleã¯ç»é¢å ã®ãã£ã©ã¯ã¿ã¼ãæ¹åãã¼ã§æä½ããä¾ãã¡ã¤ã³ã®ããã°ã©ã ã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã: import Include import Types import qualified Entity.Player as Player import Assets main = runGameDefault $ runWorldT $ do player <- spawn $ Player.new (V2 240 240) forever $ do whenM (lift $ keyPress KeyLeft) $ player .! Player.Move L
ã¯ããã« é¢æ°åã¨ããã°ã¢ãããã¢ããã¨ããã°é£ããã¨ããäºãå··ã§è¨ããã¦ãã¾ããããããªãã¢ãããç解ãããã¨ããããé£ããæããã ãã§ãåè«ããé åºã追ã£ã¦ç解ãã¦ããã°å ¨ç¶é£ããç¡ããã ãã£ã¦äºãåãã£ã¦è²°ããã°ãããªãã¨æãæ¸ãã¦è¦ããã¨ã«ãã¾ããã ãã ãåè«ã¨ãã£ã¦ãé©ç¨ç¯å²ãã¨ã£ã¦ãåºããå¿ç¨ç·¨ã«ãªãã¨åãããããªããªã£ã¦ããã®ã§ãããã§ã¯ããã°ã©ãã³ã°åéã«ç¹åããFP(functional programing)åè«*1ã«ã¤ãã¦æ¸ãã¾ãã ã¾ãã説æãç°¡åã«ããçºã«ç´°ããé¨åãããããçç¥ãã¦ãã¾ããå¦è¡çãªå®ç¾©ã¨ãã¦ã¯æ£ç¢ºã§ã¯ãªãã®ã§ããã®ã¨ã³ããªã®èª¬æã¯å¤§ä½åã£ã¦ãä½ã®æ°æã¡ã§èªãã§ãã ãããã å°ãã¼ãã¯åè«ã®è©³ããäºã¯ãã£ã±ãåãããªãã®ã§ãå¦åçãªè©±ãæ¯ããã¦ãåçã§ãã¾ããï½·ï¾ï½¯ åã£ã¦ãªããªã®ï¼ åè«ã¨è¨ãã°ãåã§ãã åã£ã¦ä½ãªã®ãã¨ããã¨ã対象(obje
Haskell ã§ã¯ IO ãç解ããã®ãé£ãããããã«ãããã¢ãããªã®ã§2éã«ï¼ï¼ï¼ã«ãªããæè¿ãã®2ã¤ãããã¦èãããããã«ãªã£ãã®ã§æ¸ãã¦ã¿ããã(æ¸ãã¦ã¿ãçµæãç¡é§ææããã®ã§ã¤ãã) æ³å®ããèªè Haskell ãå§ããã°ããã§åºæ¬çãªææ³ãªã©ã¯ãããã IOï¼ï¼ï¼ï¼ ã¨ãªã£ã¦ããã ã¢ããã¯ãã¡ã³ã¯ã¿ã¼ã§ãããã¨ãç¥ã£ã¦ããã ã¢ãããæ¼ãã¤ã¶ã join ã¨ããé¢æ°ãç¥ã£ã¦ããã ãã®æç« ã¯ã¢ããã«å¯¾ãã説æã§ã¯ãªããHaskell ã® IO ã¢ããã«å¯¾ãã説æã¨ããæãã§ãã ã¡ãªã¿ã«ãã®æç« ã§ã® "Haskell" 㯠"Haskell 1.3 以éã® Haskell" ã®ãã¨ã§ãã Haskell 㨠IO Haskell ã¯ç´ç²é¢æ°åè¨èªã§ããç´ç²é¢æ°åè¨èªã§ããã¨ãããã¨ã¯ãå¤çãå¤ããåãããªãã¨ãããã¨ã§ãã ã¨ãããã¨ã¯ç´ç²ã§ããããã«ã¯å ¥åãåãåããªã
ãããã¯ã¼ã¯ã®è¨æ¸¬ã¨è§£æ ã¤ã³ã¿ã¼ãããã®ä½¿ããæ¹ããããã¯ã¼ã¯ã®æåãææ¡ããäºã¯ããããã¯ã¼ã¯ãéç¨ãããã®æè¡éçºãè¡ã ããã«æ¬ ããã¾ããããããã観測ã§å¾ããããã¼ã¿éã¯è¨å¤§ã§ãããã¤ãºãå¤ããã¾ãã観測ã§ããã®ã¯æ¥µãã¦éãããé¨åã§ããããã¾ãããããã§ãè¨å¤§ãªãã¼ã¿ããæå³ã®ããæ å ±ãæ½åºããããé¨åçãªè¦³æ¸¬ããããä¸è¬çãªå¾åãæ¨æ¸¬ããäºãå¿ è¦ã¨ãªãã¾ãã... ã¤ã³ã¿ã¼ãããåºç¤æè¡ éãã¦ãå®å ¨ã§ãä¿¡é ¼æ§ãé«ãã使ããããããªã©ãã¤ã³ã¿ã¼ããããµã¼ãã¹ã¸ã®è¦æ±ã¯ã¾ãã¾ãé«ã¾ã£ã¦ãã¾ãããããã®è¦æ±ã«å¿ããããã«ãã¤ã³ã¿ã¼ãããã® åºç¤æè¡ãæ¥ã é²æ©ãã¦ãã¾ãããã¾ãã¤ã³ã¿ã¼ãããã¯ã¤ãªããã ãã®ãµã¼ãã¹ã§ã¯ãªããé«åº¦ã§è¤éãªæ©è½ãåãã社ä¼åºç¤ã¨ãªãã¾ãããIIJæè¡ç 究æã¯ãã¤ã³ã¿ã¼ãããã®åºç¤ã¨ãã¦å®ç¾ãæå¾ ãããæ©è½ãæä¾ããããã«ããã¾ãã¾ãªæè¡èª²é¡ã«åãçµãã§
Java8ã«ã¯Optionalã¯ã©ã¹ãå°å ¥ãããã®ã§ããã5æã«ã¨ã³ããªãæ¸ããæç¹ã§ã¯ã¢ããã§ã¯ããã¾ããã§ããã Java8ã§ã®ããã°ã©ã ã®æ§é ãå¤ããOptionalããã ãã¢ããã§ã¯ãªã ããããï¼ææ«ã«ã©ããã½ã¼ã¹ã«ã¢ããã«å¿ è¦ãªã¡ã½ããã追å ããããããã¨ãããã¨ã«ãªã£ã¦ããã¤ä½¿ããããã«ãªããå¾ ã£ã¦ãããããã¤ã®éã«ã使ããããã«ãªã£ã¦ãã¾ããã Optional (Java Platform SE 8 b101) ãã¡ããããã¦ã³ãã¼ãã§ãã¾ãã JDK8 Early Access Releases â Project Kenai ä»ã«ãããã¤ã便å©ã¡ã½ããã追å ããããããã§ããã®ãããªã³ã¼ããæ¸ããããã«ãªãã¾ããã String str = "abcd"; Optional.ofNullable(str) .map(st -> st.toUpperCase()) .f
2012-08-21 John Wiegley ããã® âMonads in Picturesâ ã翻訳ãã¾ããã翻訳ã®å ¬éã¯æ¬äººãã許諾æ¸ã¿ã§ãã翻訳ã®ééãçãããã°é æ ®ãªããææãã ããã 2012å¹´8æ20æ¥ John Wiegley è 2012å¹´8æ21æ¥ e.e d3si9n 訳 ããã¯ã¢ããã®ãã¥ã¼ããªã¢ã«ã§ã¯ãªãããããã«ã¯æ°å¦ç¨èªãåºã¦ããªããæ¬ç¨¿ã¯ãæ¢ã«ã¢ãããä¸å¿ä½¿ãããããã«ã¯ç¿ã£ã人ã対象ã¨ãããè¦è¦åãããã¨ã§ãä½ã®ããã«ä½ããã£ã¦ããããæããã«ãªãã¯ãã ã é¢æ° ã¢ããã«å¯¾ããç´æãå¾ãä¸ã¤ã®æ¹æ³ã¨ãã¦é¢æ°ããã¢ããã¸ã®æ½è±¡åããã©ãã¨ãããã®ããããé¢æ°ãä½ããã£ã¦ããã®ããç°¡åãªçµµã§è¡¨ãã¦ã¿ãããHaskell ã®é¢æ°ã®å¼ã³åºãã®æ§æãä¸ã«ãåãæ¼ç®ãè¦è¦åãããã®ãä¸ã«ç½®ãã: é¢æ°ã¯ããå¤ a ãæå° (map) ãã¦å¥ã®å¤ b ãå¾ããä¸ã§ä½ãèµ·
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}