SF
是否已在任何地方定义,或至少有名称?
data SF a f x = SF a (f x)
instance Functor f => Functor (SF a f) where
fmap g (SF a fx) = SF a (fmap g fx)
答案 0 :(得分:4)
答案 1 :(得分:1)
您可以定义仿函数产品
data (f :* g) a = P (f a) (g a) deriving Functor
然后直接写
type SF a f = Const a :* f