haskell-jp / random #102

@ai-ou has joined the channel
Reminder: [定期] 現在の主要なチャンネルは :point_down: のとおりです。 - questions : Haskellについてのお悩み相談 :thought_balloon: はこちら - beginners : 初心者 :beginner: 向けのより安心・より気軽なQ&A用チャンネル - random : 見つけたHaskellに関する情報、アナウンス、その他何でも :ok: - english-help : 英語 :uk: で困ったときの駆け込み寺 - event-announcement : :tada: Haskellに関するイベントを開催するときはこちらにリンクを張ってください - その他のChannelは「Channels」の右にある :heavy_plus_sign: ボタン -> 「Browse channels」から探してみましょう!
今週のHaskell Weeklyから。GHC 9.6.x Migration Guide
https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.6
Core Libraries Committee ってのができて CLC proposal 何番っていうふうに管理されるようになったんですね
(GHC 9.6 移行案内を見てた
https://github.com/haskell/core-libraries-committee
ghc 9.2.6 がリリースされています:haskell:
(問題なければ、これがghc 9.2系の最終になる予定とのこと)
https://discourse.haskell.org/t/ghc-9-2-6-is-now-available/5782
Hiromi ISHII / mr_konn
今週末くらいから、GitHub Action の Ubuntu shared runner 内で haskell/actions/setup が動かなくなっています(参考リンク, 2, 3)。runner 用イメージ内での ghcup のパーミッションの設定が問題のようで、ghcup の作者の方が修正に向けて動きだしています。コンテナ内でアクションを実行している場合は問題なく動くようです(setup アクションがサポートしている環境であれば、の話)。
一、二週間程度かかるかもしれないとのことで、それまでの間は https://github.com/haskell/actions/issues/187 で紹介されているように、setup 前に以下のようなコマンドを追加しておけば当座は動くようです:

    steps:
      ...
      - name: Workaround runner image issue
        if: ${{ runner.os == 'Linux' }}
        # 
        run: sudo chown -R "${USER}" /usr/local/.ghcup
      - uses: haskell/actions/[email protected]
        with:
          ghc-version: 9.0.2
@mocamocaland has joined the channel
baseパッケージだけで PATH 環境変数に入ったパスを分割する、横着なワンライナーを考えました
mapM_ print . filter (/= ";") . groupBy (\a b -> a /= ';' && b /= ';') =<< getEnv "PATH"

Windows上でやったので PATH の区切りがセミコロンになっている点に注意
... Replies ...
@h r has joined the channel
Hiromi ISHII / mr_konn
DeepFlow 社内で開発して2年ほど使っていた、Haskell 製巨大モノレポの依存関係チェックツール guardian を OSS 化したので宣伝させてください。

https://github.com/deepflowinc/guardian

大量のパッケージから成るモノレポで開発を進めていると、不用意にパッケージ間の依存関係を増やした結果不必要にビルドに時間がかかってしまい、ちょっとした変更でもビルドに時間がかかってイテレーションが阻害される、という事がしばしばあります。
guardian はパッケージを複数のグループ(ドメイン)に分けて、予め指定されたグループ間の依存関係以外を発見すると警告してくれる、というツールです。stackベースと cabal-install ベースのプロジェクトに対応しています。
CI で手軽に呼ぶためのビルド済バイナリや、GitHub Action も用意しています。

詳細は以下の記事で紹介させて頂いておりますので、巨大 Haskell モノレポの依存関係の管理にお悩みの方のお役に立てれば幸いです:pray:

https://zenn.dev/deepflow_tech/articles/secure-haskell-monorepo-deps-with-guardian
... Replies ...
atomicModifyIORef' についてまとめました。
https://kazu-yamamoto.hatenablog.jp/entry/2023/02/19/110709
そういえば共有したつもりで忘れてました。ブラウザー上でHaskellを試す公式のplaygroundができたそうです。
https://discourse.haskell.org/t/haskell-playground-is-live-at-play-haskell-org/5869
https://play.haskell.org/
pandocをcabalなんかでインストールしても、pandocコマンドはインストールされなくなり、はまりました。
コマンドはpandoc-cliという別パッケージになっています。
残念ながら9.2.6では最終にならずに、9.2.7が出てしまってますね,,, :haskell:
https://discourse.haskell.org/t/ghc-9-2-7-is-now-available/5883
@Greg Fragin has joined the channel
@フラワー has joined the channel
GHC 9.6のJavaScript backendを環境を汚さずに試したかったのでDockerfileを書いてみました。WebAssembly版も書いていますが、色々問題にぶち当たっています。ホストがAArch64じゃなくてx86_64なら問題ないのかもしれません。 https://github.com/minoki/ghc-docker
... Replies ...
なんか変なGHCのバグ踏んで面白かったので報告します.多分 https://gitlab.haskell.org/ghc/ghc/-/issues/12091 関係なんですけど,このissueってresolvedでcloseされてるんですよね:

$ mkdir ghcbugtest
$ cd ghcbugtest
$ echo "main = return () :: IO ()" > Test.hs
$ ghci-9.2.7 -fobject-code Test.hs
GHCi, version 9.2.7:   :? for help
[1 of 1] Compiling Main             ( Test.hs, Test.o )
Ok, one module loaded.
ghci> :{
ghci| f :: a -> a
ghci| f = id
ghci| :}
ghci> f

<interactive>:5:1: error: Variable not in scope: f
ghci> f :: a -> a; f = id
ghci> f

<interactive>:2:1: error: Variable not in scope: f
ghci> f = id :: a -> a
ghci> f

<interactive>:2:1: error:
    • No instance for (Show (a0 -> a0)) arising from a use of 'print'
        (maybe you haven't applied a function to enough arguments?)
    • In a stmt of an interactive GHCi command: print it
... Replies ...
ざっくりですが書きました / GHC 9.6の新機能 https://zenn.dev/mod_poppo/articles/whats-new-in-ghc-9-6
wasm32-wasi用のGHCをビルドするDockerfileも書けました。GHCをビルドする際のバグを回避するためにパッチを当てたりしています。途中でGHCだけでなくLLVMのビルドも走りますが、新しい物好きの人は試してみる価値があると思います。
@ has joined the channel
Setup.hs の HLS 対応はまだなのでこういうワークアラウンドが必要なんですね https://github.com/haskell/haskell-ide-engine/issues/1650#issuecomment-650192055
cabal が v2 コマンドになってから、ビルドのパスが分からないので doctest が失敗するようになってしまった問題についてです。
現在では cabal repl で動かすようになったんですね。

https://github.com/sol/doctest#running-doctest-for-a-cabal-package

.cabalファイルに doctest の項目は不要になりました
• test/doctest.hs も不要になりました
• CI では、cabal test に加えて cabal repl を追加します
@kudos3939 has joined the channel
相互再帰ってfixで書けるんですね.Lazy pattern matchingがミソでした.
even1, odd1 :: Int -> Bool
(even1, odd1) = fix $ \ ~(e, o) ->
  let f n = if n == 0 then True else o $ pred n
      g n = if n == 0 then False else e $ pred n
  in (f, g)

even2, odd2 :: Int -> Bool
(even2, odd2) = fix $ \ ~(e, o) -> (f o, g e)
 where
  f o n = if n == 0 then True else o $ pred n
  g e n = if n == 0 then False else e $ pred n
@西澤秀樹 has joined the channel
GeneralizedNewtypeDeriving, Strict, StrictData をオンにしておいて
newtype Foo = Foo Int deriving (Storable)

と定義すると、sizeOf は引数に対して lazy になります。
Strictが効かない。
そういうものですかね?
@Hisawo TAKASE has joined the channel