Haskell 哈斯克尔推导显示错误
我为大学评估做了一些关于有色Petri网的研究,我需要在Haskell中实现它们。我使用文档作为起点 当我尝试在Haskell中导入此模块时:Haskell 哈斯克尔推导显示错误,haskell,show,deriving,Haskell,Show,Deriving,我为大学评估做了一些关于有色Petri网的研究,我需要在Haskell中实现它们。我使用文档作为起点 当我尝试在Haskell中导入此模块时: module SimpleHCPN where import Data.List import System.Random data Net marking = Net {trans :: [Transition marking]} deriving (Show) data Transition marking
module SimpleHCPN where
import Data.List
import System.Random
data Net marking = Net {trans :: [Transition marking]}
deriving (Show)
data Transition marking = Transition { name :: String
, action :: marking -> [marking]
}
deriving (Show)
我收到以下错误:
SimpleHCPN.hs:11:37: error:
* No instance for (Show (marking -> [marking]))
arising from the second field of `Transition'
(type `marking -> [marking]')
(maybe you haven't applied a function to enough arguments?)
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
* When deriving the instance for (Show (Transition marking))
我在Haskell还是个新手,所以如果能帮我一点忙,我将不胜感激
谢谢,
Denis
动作
类型为标记->[marking]
,没有函数的typeclassShow
实例
您可以为函数的Show
的typeclass实例导入Text.Show.Functions
,但我不知道它是否显示有用的内容,或者只为任何函数显示“Function”
。更多相关问题:,。如果域较小,则是另一种选择。