我为大学评估做了一些关于彩色 Petri 网的研究,我需要在 Haskell 中实现它们。我以这份文件为起点。
当我试图在 Haskell 中导入这个模块时:
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 的新手,因此将不胜感激。
谢谢,丹尼斯