stylish-haskellをBlockArgumentsに対応させる
次に同じことをするときのための自分用のメモ。
背景と問題
- 私はHaskellのフォーマッタにstylish-haskellを使っている。
- BlockArgumentsやDerivingVia拡張を使うと、stylish-haskellがこれをパースできなくなってしまう。
解決策
ありがたいことに、解決策はここに書いてあった。
 グローバルへの汚染が最も少なそうな2番目の手順を試したところ、新たにインストールしたstylish-haskellは問題なく動いてくれた。
 他に書くべきこともないので、私がやった手順の日本語訳を置いておく。
手頃なプロジェクトの
stack.yamlを編集して、extra-depにhaskell-src-exts-1.23.0を与える。その後、そのプロジェクト上でstack install stylish-haskellを実行する。
引用元
引用元のURLはこちら。
Unable to parse BlockArguments syntax #229
https://github.com/jaspervdj/stylish-haskell/issues/229#issuecomment-598839774
翻訳元のコメントはこちら。
stylish-haskell\ will work with this provided that you build it withhaskell-src-exts-1.23.0`. You can do this in a few ways:
- Edit your global project (
~/.stack/global-project/stack.yaml) to sethaskell-src-exts-1.23.0as anextra-dep, and then dostack install stylish-haskell- Edit whatever project
stack.yamlyou have handy and sethaskell-src-exts-1.23.0as anextra-dep, and then dostack install stylish-haskellfrom that project.- Run
stack exec --no-ghc-package-path -- cabal new-install stylish-haskellwhich will automatically pull dependencies and use the GHC provided bystack(may require you to callstack install cabal-install)
haskell-src-extsis currently being held up byhaskell-names, and I have opened a PR that should unblockhaskell-src-exts.

