Haskelléçºã«é¢ä¿ãããã¼ã«ãã¨ãã¨ãããªãåæãã¦ã¿ã¾ãã
ã¨ãã£ã¿/IDE
åã¯ãEmacs 㨠haskell-mode 㨠ghc-mod ãçµã¿åããã¦ä½¿ã£ã¦ãã¾ããhaskell-mode ã¯ãè¡é æãã®æ©è½ãããã¼ãã®ã§ãä½ãç´ãããã¨æã£ã¦ãã¾ãã
IDE ã®ããã¯ã¨ã³ãã¨ãã¦ã¯ãscionãããã¾ããã使ã£ããã¨ããªãã®ã§èª¬æã§ãã¾ããã(å㯠ghc-mod ã§ååã ã¨æã£ã¦ããã®ã§ã)
Leksah ã¨ã yi ã¨ããèãã¾ããã使ã£ããã¨ããªãã®ã§ç¥ãã¾ããã(ãããyi ã¯ã¡ãã£ã¨ä½¿ã£ããã¨ãããã¾ããã©ã) èå³ã®ãã人ã¯èªåã§èª¿ã¹ã¦ä¸ããã
ããã¥ã¢ã«
é¢æ°ã®ããã¥ã¢ã«ãèªã¿ãããªã£ãããGHCについてくるモジュールの一覧ã¨hackageDBããæ¢ãã¦ä¸ãããghc-mod ã使ã£ã¦ããã°ãä¸çºã§ãã©ã¦ã¶ã«è¡¨ç¤ºã§ãã¾ãã
æ¢ãã®ãé¢åãªããgoogle ã«é©åãªãã¼ã¯ã¼ããå ¥ããã°ãããããæ±ãã¦ããããã¥ã¢ã«ãè¦ã¤ããã¾ããHoogle ã Hayoo!ã«ã伺ãããã¦ãã®ãããã§ãããã
èªåã§ããã±ã¼ã¸ãä½ãå ´åãããã¥ã¢ã«ã¯ã³ã¡ã³ãã« Haddock å½¢å¼ã§è¨è¿°ãã¾ãã
ããã±ã¼ã¸ç®¡ç
å ¬éããããã±ã¼ã¸ã¯ Cabal å½¢å¼ã«ãã¦ãhackageDB ã«ç»é²ãã¾ãã
hackageDB ã«ç»é²ãããããã±ã¼ã¸ã¯ãHaskell Platform ã«ä»ãã¦ãã cabal ã³ãã³ãã§ä¾åããã±ã¼ã¸ãä¸æ¬ã§ã¤ã³ã¹ãã¼ã«ã§ãã¾ããããããã¢ã³ã¤ã³ã¹ãã¼ã«(ã©ã¤ãã©ãªãã¡ã¤ã«èªä½ã¯æ®ããç»é²ã¯æ¹æ¶ããã)ã«ã¯ ghc-pkg ã¨ããã³ãã³ãã使ããªããã°ãªãããçµ±ä¸æãããã¾ãããã¾ããcabal ã³ãã³ãèªä½ããã¨ã£ã¦ãä¸ä¾¿ã§ãã
ããã§ãcab ã¨ããã³ãã³ããå ¬éãã¦ãã¾ãã
% cabal update % cabal install cab
ãå®è¡ããå¾ã¯ãcabal ã ghc-pkg ã®ãã¨ã¯å¿ãã¦ãcab ã ã使ãã°ããããã«ãªã£ã¦ãã¾ãã
ãããã°
printf ãããã°ã«ã¯ãDebug.Trace ã¢ã¸ã¥ã¼ã«ã® trace ã使ãã¾ã(åç §éæãå£ããã£ã¦ï¼ ããæ°ä»ãã¾ããããèã«è ¹ã¯ä»£ããããªãã®ã§ã)ã第ä¸å¼æ°ã® String ã«ã¯(ä»ã®åºå¥ãä»ããããª)é©å½ãªæååãä¸ãã表示ãããå¤ã第ã«å¼æ°ã«æå®ãã¾ããã¤ã¾ããå¤æ° foo ã使ã£ã¦ããå ´æã§ãfoo ã®å¤ã表示ããããã°ã(trace "foo" foo) ã«ç½®ãæããã°ããã®ã§ãã(ãããã¢ã¹ãã¯ãæåã§ãªãã¨ãããããµãã)
Haskell ã¯ãã©ããããããåç §éæãªã®ã§ãä¸é¨ãåãåºãã¦ããããã¬ãã«ã®é¢æ°ã«ãã¦ãã¡ããã¨åãã¾ãããããªãã°ãghci ã§å¯¾è©±çã«ãã¹ãã§ãã¾ããã¾ããé¢æ°ä»¥å¤ã®ãã¼ã¿ãªãã©ã«ãå¼·åã§ãããããã¹ããã¼ã¿ãç°¡åã«çæã§ãã¾ããdata ã deriving Show ãã¦ããã¦ãé©åãªã¨ãã㧠trace ããã°ãå ¥åå¯è½ãªãã¹ããã¼ã¿ãå¾ããã¾ãããããªãããã°ãã§ããè¨èªã¯ãä»ã«ã¯ãã¾ããªãã§ãããã
ghci にはデバッガが付属ãã¦ãã¾ããä¾å¤ãã©ãããæ¥ãã®ã調ã¹ãã®ã«ã¯ä¾¿å©ã§ãã
ãã¹ãã»ãã¬ã¼ã ã¯ã¼ã¯
ä¸éã§ã¯ããã¹ãã±ã¼ã¹ãæã§æ¸ãã¦ããããä¸æ¬ã§å®è¡ããä»çµã¿ãä½ããã¨ããã¹ãã®èªååã¨å¼ã³ã¾ãã
ä¸æ¹ãHaskell ã³ãã¥ããã£ã§ã¯ãããã°ã©ã ã®æ§è³ªãè¨è¿°ãããã¹ãã±ã¼ã¹ãèªåçæãããã¨ãããã¹ãã®èªååã«å«ãã¦ãã¾ãããããå®ç¾ããããã±ã¼ã¸ã QuickCheck ã§ãHaskell Platform ã«ä»ãã¦ãã¾ãã
çæ³çã«ã¯ QuickCheck ã ãã§æ¸ã¾ããããã°ããã®ã§ãããIO ã絡ãã¨ããã¯ããã¾ããããã®å ´åã¯ãJUnit ã«ä¼¼ã HUnit ã使ãã¾ãã
ããããçµ±åçã«æ±ãããã¬ã¼ã ã¯ã¼ã¯ããtest-frameworkã§ããåæ¨è«ã欺ããã°ã¯ãtest-framework ã使ã£ã¦ä¸æãã¾ãããã
ãããã¡ã¤ã©ã¼
GHC èªä½ã«ãããã¡ã¤ã«ãåãæ©è½ãããã¾ãã詳ãã㯠Real World Haskell ãèªãã§ä¸ããã
ãã³ããã¼ã¯
é 延è©ä¾¡ã®ããã°ã©ã ã«å¯¾ãã¦æ£ãããã³ããã¼ã¯ãåããã¨ã¯ãã¨ã¦ãå°é£ã§ããå¿ ãcriterionã使ãã¾ããããcriterion ãæ£ããå®è¡ããããã«ã¯ãdeepseqãæ·±ãç解ããå¿ è¦ãããã¾ãã
ãã¼ã¸ã§ã³ãã¨ã«éããªã£ã¦ããã®ã確ããããã£ãããcriterion ãå©ç¨ãã progressionããå§ãã§ãã
ãã¼ã¸ã§ã³ç®¡ç
ç´ ç´ã« git ã使ãã¾ãããã