我正在尝试创建自己的数据类型,它将成为 Monad 类的一部分,但是
newtype Container a = Container a deriving Monad
Run Code Online (Sandbox Code Playgroud)
给我这个错误:
* Can't make a derived instance of `Monad Container'
(even with cunning GeneralizedNewtypeDeriving):
cannot eta-reduce the representation type enough
* In the newtype declaration for `Container'
|
30 | newtype Container a = Container a deriving Monad
Run Code Online (Sandbox Code Playgroud)
它适用于其他类(例如 Show),但不适用于 Monad,那么我如何说服 ghci 将我的 Container 实例化为 Monad 类?
谢谢