我想将 Servant 的ClientM
monad 与 一起使用,但遇到了错误。finally
:: MonadBaseControl IO m => m a -> m b -> m a
No instance for (MonadBaseControl IO ClientM)
奇怪的是,这个确切的实例似乎已经定义了,无论是来自内部模块。
我是否需要以某种方式显式导入此类实例?
正如丹尼尔所说,如果您导入定义所需实例的模块,它会很好地工作:
Prelude> import Control.Exception.Lifted
Prelude Control.Exception.Lifted> import Servant.Client
Prelude Control.Exception.Lifted Servant.Client> :set -XTypeApplications
Prelude Control.Exception.Lifted Servant.Client> :type finally @ ClientM
finally @ ClientM :: ClientM a -> ClientM b -> ClientM a