问题
I'd like to use Servant's ClientM monad with finally:: MonadBaseControl IO m => m a -> m b -> m a
, but am faced with error No instance for (MonadBaseControl IO ClientM)
.
Oddly, this exact instance appears to be defined already, be it from an internal module.
Do I need to explicitly import such instances somehow?
回答1:
It works fine if, as Daniel said, you import the module that defines the desired instance:
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
来源:https://stackoverflow.com/questions/50439760/no-instance-for-trait-thats-already-implemented