"No instance for" 已经实施的特征
"No instance for" trait that's already implemented
我想使用 Servant 的 ClientM
monad with finally
:: MonadBaseControl IO m => m a -> m b -> m a
,但遇到错误 No instance for (MonadBaseControl IO ClientM)
。
奇怪的是,这个实例似乎是 defined already, be it from an internal 模块。
我是否需要以某种方式显式导入此类实例?
如果像 Daniel 所说的那样导入定义所需实例的模块,它就可以正常工作:
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
我想使用 Servant 的 ClientM
monad with finally
:: MonadBaseControl IO m => m a -> m b -> m a
,但遇到错误 No instance for (MonadBaseControl IO ClientM)
。
奇怪的是,这个实例似乎是 defined already, be it from an internal 模块。
我是否需要以某种方式显式导入此类实例?
如果像 Daniel 所说的那样导入定义所需实例的模块,它就可以正常工作:
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