`MonadThrow` 不在 LTS 11.0 开始的范围内

`MonadThrow` Not in scope beginning at LTS 11.0

我发现使用

me$ stack install --resolver lts-11.0 片段

{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where

import ClassyPrelude
import Network.HTTP.Conduit (host)

hostnameFromUrl :: MonadThrow m => Text -> m Text
hostnameFromUrl url = do
    return $ decodeUtf8 $ host "helloworld.com"

失败并显示消息

/Users/me/.../temp/Main.hs:8:20: error:
    Not in scope: type constructor or class ‘MonadThrow’
  |
8 | hostnameFromUrl :: MonadThrow m => Text -> m Text
  |                    ^^^^^^^^^^

当使用任何 lts >= 11.0 时。 lts <= 10.10 不会引发错误。

这看起来很奇怪,因为相关包 (exceptions-0.8.3) does not change 在这两个 LTS 之间。

我有stack.yaml个文件

resolver: lts-11.0
packages:
  - '.'
flags: {}
extra-package-dbs: []

temp.cabal文件

name:                temp
version:             0.0
build-type:          Simple
-- extra-source-files:
cabal-version:       >=1.10

library
  hs-source-dirs:      .
  exposed-modules:     Main
  ghc-options:         -Wall
  build-depends:       classy-prelude >= 1.0.0.2
                     , http-conduit >= 2.1
  default-language:    Haskell2010

请原谅具体的设置;我已尝试使其尽可能易于复制。

如有任何见解,我们将不胜感激!谢谢。

它不再从 ClassyPrelude 中导出,您需要从 Control.Monad.Catch 中导入它。