ãã®è¨äºã¯Haskell Advent Calendar 2022ã®1æ¥ç®ã®è¨äºã§ãã ãã®è¨äºã§ã¯ã2022å¹´12ææç¹ã®Haskellã®ç°å¢æ§ç¯æé ãç´¹ä»ãã¾ãã2023å¹´ã«ãªã£ã¦ãéç¨ããã¨ãããªãã 対象ã¨ããç°å¢ 対象ã¨ããç°å¢ã¯ä»¥ä¸ã®éãã§ãï¼ Unixç³» macOS (Intel / Apple Silicon) Linux (x86_64 / aarch64) WSL2ãå«ãï¼WSL1ã¯ä¸å ·åããã£ãæ°ãããã®ã§é¿ãã¦ãã ããï¼ Windows (x64) Armç³»CPUæè¼ã®ã³ã³ãã¥ã¼ã¿ã¼ã使ã£ã¦ããå ´åã¯ãå¥éLLVMãå¿ è¦ã«ãªãå ´åãããã¾ãã以ä¸ã«å½ã¦ã¯ã¾ãå ´åã¯ããè£éºï¼LLVMããã¯ã¨ã³ãã使ãããèªãã§ãã ããï¼ 64ãããArmï¼Apple Silicon MacããRaspberry Pi OSã®64ãããçãªã©ï¼ã§ãGHC 9.0ã¾ãã¯ãã以åã®ãã¼ã¸ã§
Haskellã§æ¬æ ¼çã«éçºããéã¯cabalãªãstackãªãã§ããã¸ã§ã¯ããä½ãããã§ããããã¡ã¤ã«ä¸ã¤ã§æ¸ããããªï¼æ¸ãæ¨ã¦ï¼ã¹ã¯ãªãããHaskellã§æ¸ãããå ´åãããã¾ãã ä¾åé¢ä¿ã®ãªãã¹ã¯ãªããã§ããã°ãæ®éã«ãã¡ã¤ã«ãä½ã£ã¦ runghc/runhaskell ããã°è¯ãã§ããããããããHaskellã«ã¯æ¨æºã©ã¤ãã©ãªã¼ï¼baseï¼ä»¥å¤ã«ããæºæ¨æºãã¨å¼ã¹ãå¤é¨ã®ã©ã¤ãã©ãªã¼ãå¤æ°ããï¼ä¾ï¼bytestring, text, vectorï¼ããããã«æ示çã«ä¾åãããã¨ã¯ runghc ã§ã¯ã§ãã¾ããã ããã§ä½¿ããã®ããcabal scriptãstack scriptã¨å¼ã°ããæ©è½ã§ãã cabal script cabal run ã³ãã³ãã使ãã¨ããã¡ã¤ã«ä¸ã« {- cabal: å½¢å¼ã®ç¹æ®ãªã³ã¡ã³ããå«ãHaskellã³ã¼ãããã®å ´ã§ãã«ããã¦å®è¡ãããã¨ãã§
Cabal 2.4以éã§ã¯source-repository-package stanzaã«ãã£ã¦GitHubãªã©ã«ããã¬ãã¸ããªããç´æ¥ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ã§ããããã«ãªã£ã¦ããã ä¾ãã°ãcabal.projectãã¡ã¤ã«ã«ä»¥ä¸ã®ããã«è¨è¿°ããã source-repository-package type: git location: https://github.com/brendanhay/amazonka tag: 0ccede621e56fb6f240e4850e205cde82d0e4a4b subdir: lib/amazonka lib/amazonka-core lib/services/amazonka-sts (ãªããsubdirã«è¤æ°ã®ãã£ã¬ã¯ããªãæå®ããã«ã¯ cabal-install >=3.2.0.0 ãå¿ è¦ããã) ããã«ãã£ã¦amazonkaãã
æ¬è¨äºã¯ ãHaskell Advent Calendar 2021ãã®4æ¥ç®ã®è¨äºã§ãã 空ãã¦ãã®ã§åãã¾ããã Bazelã¨ãããã«ããã¼ã«ãããã¾ããBazelã§ã¯ãããããã©ã¤ãã©ãªã®ãããªãã®ã使ããã¨ã§ãç°¡åã«ãã¾ãã¾ãªããã°ã©ã ã®ãã«ãããã¹ãã®å®è¡ãåãã¤ã³ã¿ã¼ãã§ã¼ã¹ã§è¡ããã¨ãã§ãã¾ããä¾ãã°ï¼ bazelbuild/rules_go : Goããã°ã©ã ã®ãã«ãããã¹ããªã© bazelbuild/rules_docker : Dockerã¤ã¡ã¼ã¸ã®ãã«ããããã·ã¥ãªã© bazelbuild/rules_nodejs : Nodeããã°ã©ã ã®ãã«ãããã¹ããªã© ããã¦ãtweag/rules_haskell ã使ããã¨ã§ãBazel ãå©ç¨ã㦠Haskell ããã°ã©ã ã®ãã«ããè¡ãã¾ããä»åã¯ä»å¹´ã§ãæ°ãããã¼ã¸ã§ã³ã® Haskell å¦çç³»ãGHC 9.2.1 ã
è¦ç´ Haskellã®cabal-install v3ã§Nix-style build(v3ã§ã¯ãããããã©ã«ãã®ã¢ã¼ã)ãããå ´åãdoctestã使ãããã±ã¼ã¸ããããªã以ä¸ã®è¨å®ãcabal.projectã$HOME/.cabal/configã«æ¸ãã¦ããã¨ããã
ã¯ããã« ï¼ãã¨ããå°ãã§ï¼ããã¾ãã¦ããã§ã¨ããããã¾ãã ãã®è¨äºã§ã¯2020å¹´12æ31æ¥æç¹ã§ã®ç§ã®ããããã®ææ°ã®Haskellããã¸ã§ã¯ãã®ä½ææ¹æ³ãã¾ã¨ãã¾ãã Haskellã®ç°å¢æ§ç¯ã¯stackã使ããã®ã¨cabalã使ããã®ã®ï¼ç¨®é¡ãããã¾ãã æ´å²çã«ã¯cabalã®ä¸ä¾¿ããæ¹åããã®ãstackã§ãããç¾å¨ã¯cabalãé²åã㦠ä¸ä¾¿ãã¯å¤§å¹ ã«è§£æ¶ããã¦ãããããçè ã®å¥½ã¿ã§cabalã«ããç°å¢æ§ç¯ãã¾ã¨ãã¾ãã ãã¼ã«ã®ã¤ã³ã¹ãã¼ã« ghcup ghcupã¯GHCã¨cabalã¨HLSããã¼ã¸ã§ã³ç®¡çãã¦ãããã¤ã³ã¹ãã¼ã©ã§ãã ã¤ã³ã¹ãã¼ã«ã¬ã¤ã ãåèã«ã¤ã³ã¹ãã¼ã«ãã¦ãã ããã ãã¼ã¸ã§ã³ç¢ºèª ghcupãã¤ã³ã¹ãã¼ã«ããã $ ghcup list Tool Version Tags Notes â ghc 7.10.3 base-4.8.2.0 â ghc
cabal repl ã³ãã³ã㯠ghci, ghc --interactive stack repl, stack ghci ãªã©ã¨åãããã« cabal 㧠REPL ç°å¢ãå®è¡ããããã®ã³ãã³ãã§ãã cabal ããã¸ã§ã¯ãå ã§å®è¡ããå ´åã¨ãcabal ããã¸ã§ã¯ãå¤ã§å®è¡ããå ´åã§æåãå°ãç°ãªãã¾ãã $ cabal -V cabal-install version 3.2.0.0 compiled using version 3.2.0.0 of the Cabal library cabal ããã¸ã§ã¯ãå¤ã§å®è¡ããå ´å cabal ã¯èªåçã« fake-package ã¨ããç°å¢ãç¨æãã¾ããããã¯ä½¿ãæ¨ã¦ã®ããã¼ cabal ããã¸ã§ã¯ãã§ãã $ cabal repl Resolving dependencies... Build profile: -w ghc-8
Haskell ã®ãã«ããã¼ã«ã¨ããã° cabal 㨠stack ã§ããã¡ãã£ã¨åã¾ã§ã¯ cabal ãã stack ã®æ¹ãæµè¡ã£ã¦ããã®ã§ãããæè¿ã¯éçºãè½ã¡çãã¦ããããã§ãã¾ãåããããã¾ãããããããã cabal ã® nix-style local build ãé常ã«ä½¿ãããããè¿é ã§ã¯ stack ãã cabal ã«ç§»è¡ãã¦ããããã¸ã§ã¯ããå¤ãããã¾ãã stack ã使ã£ã¦ãã¦æ¹åãããè¯ããªãã¨æãé¨åã¨ãã¦ã¯ãæ°ãã GHC ãã©ã¤ãã©ãªãããã«ä½¿ããã¨æã£ã¦ã LTS ã nightly ã«å ¥ã£ã¦ããªããã使ããªãã£ãããBackpack ãæªã ã«ä½¿ããªãã£ããããã¨ããã§ããããã ãã ããã«ãã®åç¾æ§ã¨ããç¹ã«ããã¦ã¯ stack ã®æ¹ãåªç§ã ã¨æã£ã¦ããã®ã§ä»ã¯ä¸¡æ¹ä½¿ã£ã¦ãã¾ãã(index-state 㨠freeze ãã¡ã¤ã«ãçµã¿åãããã° ca
cabal ã® build-tool-depends ã¨ãããã£ã¼ã«ãã便å©ã ã£ãã®ã§ç´¹ä»ãã¾ãã ãã¹ããæ¸ãã¨ãã« hspec-discover ã tasty-discover ãªã©ã使ãå ´åããã®ãã£ã¼ã«ããè¨å®ãã¦ãããã¨ã§ä¾åãã¦ããå®è¡ãã¡ã¤ã«ãèªåçã«ãã¦ã³ãã¼ããã¦ä½¿ã£ã¦ããã¾ãã $ cabal --version cabal-install version 3.0.0.0 compiled using version 3.0.0.0 of the Cabal library ãµã³ãã«ããã¸ã§ã¯ãã®æ§æ å ¨ä½ã®ãã£ã¬ã¯ããªæ§æã¯ä»¥ä¸ã®ããã«ãªã£ã¦ããã¨ãã¾ãããã $ tree . . âââ example.cabal âââ src â âââ Lib.hs âââ stack.yaml âââ test âââ LibSpec.hs âââ Spec.hs ããã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}