在记录类型上添加类型类约束

时间:2018-11-02 13:25:42

标签: haskell

此声明在我的上下文中运行良好之前:

data PersistedCommand = PersistedCommand { offset :: Offset , command :: Command }

instance Show PersistedCommand where
  show persistedCommand = "PersistedCommand { offset = " ++ ( show $ offset persistedCommand) ++ " , command = " ++ (show $ getCommandName $ command persistedCommand) ++ ":"
    ++ (show $ getAggregateId $ command persistedCommand) ++ " }"

但是我已经将Command从数据类型更改为类型类。我现在如何在先前的声明中表达这一点?

0 个答案:

没有答案
相关问题