Haskell 找不到 fmt 库

Haskell fmt library not found

当我导入 Haskell Fmt 模块时,我得到了信息 “找不到模块 'Fmt'。 它不是当前程序或任何已知包中的模块。

GHCi, version 9.2.1: https://www.haskell.org/ghc/  :? for help
ghci> :set -XOverloadedStrings
ghci> import Fmt

<no location info>: error:
Could not find module `Fmt'
It is not a module in the current program, or in any known package.
ghci>

如今人们使用 cabal repl 而不是 ghci:

cabal repl --build-depends fmt
...
Prelude> :set -XOverloadedStrings 
Prelude> import Fmt
Prelude Fmt> let (a, b, n) = ("foo", "bar", 25)
Prelude Fmt> ("Here are some words: "+|a|+", "+|b|+"\nAlso a number: "+|n|+"") :: String
"Here are some words: foo, bar\nAlso a number: 25"