å¿ããã¨ãã»ã©ä»ã®ãã¨ããããããªãã®ã¯äººã®æ§ãªã®ãï¼ï¼ï¼ã¨ããããã§ä»åã Haskell é¢é£ã®å 容ã§ãï¼ ã¯ããã« Twitter ã® Streamimg API ããåå¾ããå 容ã Conduit ã§å¦çããï¼ã¨ããå 容ã§ãï¼Streaming API 㯠Source ã¨ãã¦å©ç¨ããã®ã«æé©ãªæ°ãããã®ã§ãï¼ ç°å¢ ubuntu 10.04 32bit ghc 7.0.4 cabal-install 0.10.2 *1 using version 1.10.2.0 of the Cabal library å©ç¨ããã±ã¼ã¸ 主ãªå©ç¨ããã±ã¼ã¸ã¯ä»¥ä¸ã®éãã§ãï¼ (å ·ä½ç㪠import ã«ã¤ãã¦ã¯ããªãã¸ããªãã®ã¨ããã«è¼ããã³ã¼ããåç §) http-conduit-1.4.1.3 http://hackage.haskell.org/package/http-conduit-1.
{-# LANGUAGE OverloadedStrings #-} import Web.Authenticate.OAuth as OAuth -- authenticate-oauth-1.4.0.4 import qualified Data.Aeson as JSON -- aeson-0.6.1.0 import Data.Conduit -- conduit-1.0.0 import Network.HTTP.Conduit -- http-conduit-1.9.0 import Network.HTTP.Types -- http-types-0.8.0 import Network (withSocketsDo) oauth :: OAuth.OAuth oauth = OAuth.newOAuth { OAuth.oauthServerName = "twitter"
å ãã¿ã¯ããããã: ããã«ãã¦ãã£ã±ãç»åããã¦ã³ãã¼ããããã2012 - ãã¼ããã¹ã¼æ¥è¨ Dè¨èªã§ããã«ãã¦ãã£ã±ãç»åããã¦ã³ãã¼ããããã2012 â Gist ãè¦ãããã®ã§ Haskell çãæ¸ãã¦ã¿ããã ãã©ãã©ãããæ¢ã«ãããã¦ãã¾ã£ã¦ããããã ⦠ããã«ãã¦ãã£ã±ãç»åããã¦ã³ãã¼ããããï½2012 Haskellç·¨ - å¨äºç æ£è ã®ããã°ã©ãã³ã°å ¥é ã¾ãä»æµè¡ãã®(?) Conduit çã ã¨ãããªããããã¨ããä¾ã¨ãã¦è¦ã¦ããããã°ãä»æ°ä»ãããã© TupleSections ã¯ç¹ã«æå¹ã«ããå¿ è¦ãªãã£ããªâ¦
ãã®è¨äºã¯ http://www.yesodweb.com/blog/2012/06/conduit-0-5 ã®ç¿»è¨³ã§ãã conduit-0.5 ããªãªã¼ã¹ãã¾ããã conduitã¯ã¹ããªã¼ã ãã¼ã¿ãæ±ãããã®ã©ã¤ãã©ãªã§ãã conduitãç¨ããã¨ãæ§ã ãªå½¢ã®ãã¼ã¿ãçæãå¤å½¢ãæ¶è²»ãããããªå¦çãã ç°¡åã«çµã¿åããããã¨ãã§ããããã«ãªãã¾ãã enumerator/iterateeãã©ãã¤ã ã¨åãåé¡ã解決ãããã¨ãç®çã«ä½ããã¾ãããã ã¢ããã¼ãã¯ãããã®ãã®ã¨ã¯ç°ãªãã¾ãã conduitã¯ç°¡åã«ç解ãã¦å©ç¨ã§ãããã®ã«ãªããã¨ãä¸çªã®ç®çã¨ãã¦ãã¾ãã é 延I/Oã¨ã¯ç°ãªãããªã½ã¼ã¹ã®å³æéæ¾ãä¿è¨¼ãã ã¾ããç´ç²ãªã³ã¼ãã«ä¾å¤ãæã¡è¾¼ã¿ã¾ããã ä»åã®ãªãªã¼ã¹ã§SourceãSinkãConduitã®ãããããä½ãããã®ã ã·ã³ãã«ã§å¹çã®è¯ããé«ã¬ãã«ã®ã¤ã³ã¿ã¼ã
Iteratee/Enumeratorç³»ã®è©±é¡ãHaskellçéã§é¨ããã¦ä¹ ãã (æ¥æ¬èªã®ç´¹ä»è¨äº)ããããã¯Haskellã§ç´°ç²åº¦ã®ãªã½ã¼ã¹å¶å¾¡ãã§ããã¹ããªã¼ã å¦çã®æ¹æ³ã§ãä¾å¤å¦çãããããããã¨ãã触ãè¾¼ã¿ã ã£ããæ°ããã¹ããªã¼ã å¦çã¯ãªã½ã¼ã¹ã®æ¶è²»éã®ç¹ã§ï¼ãªã³ã¡ã¢ãªã«å ¨ã¦ãç½®ããããï¼åªãã¦ããããhGetContents::IO Handle->Stringã®ãããªé 延IOã¯ãã¡ã¤ã«ã®ã¯ãã¼ãºãªã©ãªã½ã¼ã¹ã®å¶å¾¡ãé£ããããããæ¹è¯ããã®ãIteratee/Enumeratorç³»ã®ã©ã¤ãã©ãªã ããã ã Conduit iteratee/enumeratorã®æ¹è¯ã試ã¿ã¦ããã®ã Conduit ï¼ã³ã³ãã£ããï¼ï¼ã ï¼æ¥æ¬èªã®ç´¹ä»è¨äºï¼ã æè¿ã§ããã£ã¨æ¹è¯ãã¤ã¥ãã¦ããããã§(åèï¼tanakhããã®çºè¡¨è³æ)ãä¾ãã°Source/Conduit/Sinkã®åãPipeã«çµ±
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}