前言

最近换了全新的 MacBook Air 2022 M2,安装好 ghcup 后惊奇发现在 set +m 后,复制粘贴会出现非常诡异的情况

1
2
Prelude> let concat3 :: [[a]] -> [a]
Prelude|  concat3 x = foldl (++) []  concat3 x = foldl (++) []  concat3 x = foldl (++) []  concat3 x = foldl (++) []  concat3 x = foldl (++) []concat3 x = foldl (++) []concat3 x = foldl (++) []concat3 x = foldl (++) []concat3 x = foldl (++) []concat3 x = foldl (++) [] :concat3 x = foldl (++) [] x

解决方案

查了查 GitHub issue,发现是 CR 没有被正确清除,然后就有了非常离谱的解决方案

1
2
$ whereis ghci
ghci: /Users/kevin/.ghcup/bin/ghci
1
vim /Users/kevin/.ghcup/bin/ghci

exec 命令前一行加入 TERM=dumb,保存退出即可:

1
2
3
#!/bin/sh
TERM=dumb
exec "/Users/kevin/.ghcup/ghc/8.10.7/bin/ghc-8.10.7" --interactive "$@"