如何进行,以下类型检查
{-# LANGUAGE RankNTypes #-}
module Main where
class Foo a where
type FunFoo = (Foo a) => a -> IO ()
data Bar = Bar {
funFoo :: FunFoo
}
setFunFoo :: FunFoo -> Bar -> Bar
setFunFoo action bar = bar {funFoo = action}
Run Code Online (Sandbox Code Playgroud)
但是当将setFunFoo的类型签名更改为
setFunFoo :: ((Foo a) => a -> IO ()) -> Bar -> Bar
Run Code Online (Sandbox Code Playgroud)
它不是?有没有一种方法来表达上面的代码没有类型同义词FunFoo?