我正在研究一个monadic流媒体库,我遇到了一个我不理解的类型.我已设法将其减少到以下示例:
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
class Foo a b where
type E a b :: *
(>->) :: a -> b -> E a b
data Bar x
instance Foo (Bar x) (Bar x) where
type E (Bar x) (Bar x) = Bar x
(>->) = undefined
x = undefined :: Bar a
y = undefined :: Bar Int
z = x >-> y
Run Code Online (Sandbox Code Playgroud)
当我尝试编译它时,我得到:
No instance for (Foo (Bar a0) (Bar Int))
arising from a …Run Code Online (Sandbox Code Playgroud) haskell ×1