類型別名我有以下類型別名派生式並顯示在Haskell
data Bindable = Const Value
| Variable Location
| Func Function
| Proc
deriving (Eq, Show)
type Function = Argument -> Store -> Value
但是編譯器給我一個錯誤
No instance for (Show Function)
arising from the 'deriving' clause of a data type declaration
Possible fix:
add an instance declaration for (Show Function)
or use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Show Bindable)
我可以明確顯示&式的功能?如果不是,那麼解決方案是什麼?我應該將Eq和Show定義爲參數,商店和價值嗎?
托馬斯感謝快速幫助!它解決了Show的問題。我應該爲Eq導入什麼? – 2013-02-22 02:14:41
你必須編寫自己的實例(默認爲True或False取決於你想要的)。 '實例Eq函數,其中_ == _ = True' – 2013-02-22 02:21:31