Haskell派生显示错误



我为大学评估做了一些关于彩色培养皿网的研究,我需要在 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))

我仍然是哈斯克尔的新手,所以一点帮助将不胜感激。

谢谢丹尼斯

action的类型

marking -> [marking],函数没有类型类Show的实例。

您可以为函数的 Show 的 typeclass 实例导入Text.Show.Functions,但我不知道它是否显示有用的东西或只对任何函数"Function"

相关内容

最新更新