“没有实例”已经实施的特性

时间:2018-05-20 21:57:44

标签: haskell servant

我想在ClientM :: MonadBaseControl IO m => m a -> m b -> m a使用仆人的finally monad,但我遇到错误No instance for (MonadBaseControl IO ClientM)

奇怪的是,这个确切的实例似乎已经是defined,无论是来自internal模块。

我是否需要以某种方式明确导入此类实例?

1 个答案:

答案 0 :(得分:2)

如果像丹尼尔所说,导入定义所需实例的模块,它可以正常工作:

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