Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
具有以下自定义新类型:
newtype QueryM a = QueryM (Connection -> IO a)
如何Alternative在约束它的同时为它a声明一个实例Alternative?或者我可以吗?
Alternative
a
我的意思是这样的:
instance (Alternative a) => Alternative (QueryM a) where
如果我添加一个参数,这里编译得很好a:
import Control.Applicative newtype QueryM a b = QueryM (Connection -> IO (a b)) type Connection = () instance Functor (QueryM a) instance Applicative (QueryM a) instance (Alternative a) => Alternative (QueryM a) where