试图编译任何包含新类型的haskell程序

试图编译任何包含新类型的haskell程序,haskell,Haskell,每当我尝试用新类型编译haskell程序时,我都会收到一个错误,指出“没有因使用…而产生的诸如此类的实例”,例如: No instance for (Hashable NT.EndPointAddress) arising from a use of `hashable-1.2.0.10:Data.Hashable.Class.$gdmhashWithSalt' Possible fix: add an instance declaration for (Hashable NT.EndP

每当我尝试用新类型编译haskell程序时,我都会收到一个错误,指出“没有因使用…而产生的诸如此类的实例”,例如:

No instance for (Hashable NT.EndPointAddress)
  arising from a use of `hashable-1.2.0.10:Data.Hashable.Class.$gdmhashWithSalt'
Possible fix:
  add an instance declaration for (Hashable NT.EndPointAddress)
In the expression:
  (hashable-1.2.0.10:Data.Hashable.Class.$gdmhashWithSalt)
In an equation for `hashWithSalt':
    hashWithSalt
      = (hashable-1.2.0.10:Data.Hashable.Class.$gdmhashWithSalt)
In the instance declaration for `Hashable NodeId'
有人能提出可能发生的事情吗

谢谢

卡尔

我已经添加了与上述错误消息相关的代码。它贴在下面。错误发生在第132行。代码来自发布在github上的分布式流程的开发分支Types.hs。对于我试图编译的任何包含新类型的代码,我都会遇到同样的错误

{-# LANGUAGE DeriveGeneric #-}

-- | Types used throughout the Cloud Haskell framework
--
-- We collect all types used internally in a single module because
-- many of these data types are mutually recursive and cannot be split across
-- modules.
module Control.Distributed.Process.Internal.Types
  ( -- * Node and process identifiers
    NodeId(..)
  , LocalProcessId(..)
  , ProcessId(..)
  , Identifier(..)
  , nodeOf
  , firstNonReservedProcessId
  , nullProcessId
    -- * Local nodes and processes
  , LocalNode(..)
  , Tracer(..)
  , LocalNodeState(..)
  , LocalProcess(..)
  , LocalProcessState(..)
  , Process(..)
  , runLocalProcess
  , ImplicitReconnect(..)
    -- * Typed channels
  , LocalSendPortId
  , SendPortId(..)
  , TypedChannel(..)
  , SendPort(..)
  , ReceivePort(..)
    -- * Messages
  , Message(..)
  , isEncoded
  , createMessage
  , createUnencodedMessage
  , unsafeCreateUnencodedMessage
  , messageToPayload
  , payloadToMessage
    -- * Node controller user-visible data types
  , MonitorRef(..)
  , ProcessMonitorNotification(..)
  , NodeMonitorNotification(..)
  , PortMonitorNotification(..)
  , ProcessExitException(..)
  , ProcessLinkException(..)
  , NodeLinkException(..)
  , PortLinkException(..)
  , ProcessRegistrationException(..)
  , DiedReason(..)
  , DidUnmonitor(..)
  , DidUnlinkProcess(..)
  , DidUnlinkNode(..)
  , DidUnlinkPort(..)
  , SpawnRef(..)
  , DidSpawn(..)
  , WhereIsReply(..)
  , RegisterReply(..)
  , ProcessInfo(..)
  , ProcessInfoNone(..)
    -- * Node controller internal data types
  , NCMsg(..)
  , ProcessSignal(..)
    -- * Accessors
  , localProcesses
  , localPidCounter
  , localPidUnique
  , localConnections
  , localProcessWithId
  , localConnectionBetween
  , monitorCounter
  , spawnCounter
  , channelCounter
  , typedChannels
  , typedChannelWithId
    -- * Utilities
  , forever'
  ) where

import System.Mem.Weak (Weak)
import Data.Map (Map)
import Data.Int (Int32)
import Data.Typeable (Typeable, typeOf)
import Data.Binary (Binary(put, get), putWord8, getWord8, encode)
import qualified Data.ByteString as BSS (ByteString, concat, copy)
import qualified Data.ByteString.Lazy as BSL
  ( ByteString
  , toChunks
  , splitAt
  , fromChunks
  , length
  )
import qualified Data.ByteString.Lazy.Internal as BSL (ByteString(..))
import Data.Accessor (Accessor, accessor)
import Control.Category ((>>>))
import Control.DeepSeq (NFData(..))
import Control.Exception (Exception)
import Control.Concurrent (ThreadId)
import Control.Concurrent.Chan (Chan)
import Control.Concurrent.STM (STM)
import qualified Network.Transport as NT (EndPoint, EndPointAddress, Connection)
import Control.Applicative (Applicative, Alternative, (<$>), (<*>))
import Control.Monad.Reader (MonadReader(..), ReaderT, runReaderT)
import Control.Monad.IO.Class (MonadIO)
import Control.Distributed.Process.Serializable
  ( Fingerprint
  , Serializable
  , fingerprint
  , encodeFingerprint
  , sizeOfFingerprint
  , decodeFingerprint
  , showFingerprint
  )
import Control.Distributed.Process.Internal.CQueue (CQueue)
import Control.Distributed.Process.Internal.StrictMVar (StrictMVar)
import Control.Distributed.Process.Internal.WeakTQueue (TQueue)
import Control.Distributed.Static (RemoteTable, Closure)
import qualified Control.Distributed.Process.Internal.StrictContainerAccessors as DAC (mapMaybe)

import Data.Hashable
import GHC.Generics

--------------------------------------------------------------------------------
-- Node and process identifiers                                               --
--------------------------------------------------------------------------------

-- | Node identifier
newtype NodeId = NodeId { nodeAddress :: NT.EndPointAddress }
  deriving (Eq, Ord, Typeable, Generic)
instance Binary NodeId where
instance NFData NodeId
instance Hashable NodeId where
instance Show NodeId where
  show (NodeId addr) = "nid://" ++ show addr

-- | A local process ID consists of a seed which distinguishes processes from
-- different instances of the same local node and a counter
data LocalProcessId = LocalProcessId
  { lpidUnique  :: {-# UNPACK #-} !Int32
  , lpidCounter :: {-# UNPACK #-} !Int32
  }
  deriving (Eq, Ord, Typeable, Generic, Show)
{-#派生通用语言}
--|在整个Cloud Haskell框架中使用的类型
--
--我们收集单个模块内部使用的所有类型,因为
--这些数据类型中有许多是相互递归的,不能跨多个数据类型拆分
--模块。
模块控制.分布式.过程.内部.类型
(-*节点和进程标识符
节点ID(…)
,LocalProcessId(…)
,进程ID(…)
,标识符(…)
,nodeOf
,第一个非保留进程ID
,nullProcessId
--*本地节点和进程
,LocalNode(…)
,示踪剂(…)
,LocalNodeState(…)
,LocalProcess(…)
,LocalProcessState(…)
,过程(…)
,运行本地进程
,隐式连接(…)
--*类型化频道
,LocalSendPortId
,SendPortId(…)
,类型通道(…)
,发送端口(…)
,接收端口(…)
--*信息
,讯息(…)
,我承认
,createMessage
,createUnencodedMessage
,未经处理的未编码消息
,messageToPayload
,payloadToMessage
--*节点控制器用户可见数据类型
,MonitorRef(…)
,ProcessMonitorNotification(…)
,节点监视通知(…)
,端口监视器通知(…)
,ProcessExitException(…)
,ProcessLinkException(..)
,NodeLinkException(…)
,PortLinkException(..)
,ProcessRegistrationException(..)
,迪德雷森(…)
,didumonitor(…)
,DidUnlinkProcess(…)
,DidUnlinkNode(…)
,DidUnlinkPort(…)
,SpawnRef(…)
,didpawn(…)
,其中(…)
,RegisterReply(…)
,ProcessInfo(…)
,ProcessInfoNone(…)
--*节点控制器内部数据类型
,NCMsg(…)
,处理信号(…)
--*访问者
,本地进程
,localPidCounter
,localPidUnique
,本地连接
,localProcessWithId
,localConnectionBetween
,监视器计数器
,产卵计数器
,信道计数器
,类型频道
,typedChannel WithID
--*公用事业
“永远”
)在哪里
导入System.Mem.Weak(弱)
导入数据.Map(Map)
导入Data.Int(Int32)
导入数据.Typeable(Typeable,typeOf)
导入数据.Binary(二进制(put,get),putWord8,getWord8,encode)
将限定数据.ByteString作为BSS导入(ByteString、concat、copy)
将限定数据.ByteString.Lazy导入为BSL
(通过测试环)
,托克斯
,splitAt
,来自块
,长度
)
将限定数据.ByteString.Lazy.Internal作为BSL导入(ByteString(..)
导入数据访问器(访问器,访问器)
进口管制.类别(>>>))
导入控制.DeepSeq(NFData(..)
导入控制。异常(异常)
导入控制.Concurrent(线程ID)
进口管制.Concurrent.Chan(Chan)
导入控制.Concurrent.STM(STM)
导入合格的网络。传输为NT(端点、端点地址、连接)
导入控制.Applicative(Applicative,Alternative,(),())
导入Control.Monad.Reader(monaderreader(..),ReaderT,runReaderT)
导入控制.Monad.IO.Class(MonadIO)
导入控制.Distributed.Process.Serializable
(指纹
,可序列化
,指纹
,编码指纹
,sizeOfFingerprint
,解码指纹
,显示指纹
)
导入控制.Distributed.Process.Internal.CQueue(CQueue)
导入控制.Distributed.Process.Internal.StrictMVar(StrictMVar)
导入控制.Distributed.Process.Internal.WeakTQueue(TQueue)
导入控件.Distributed.Static(RemoteTable,闭包)
将合格的Control.Distributed.Process.Internal.StrictContainerAccessor导入为DAC(mapMaybe)
导入数据
进口GHC.仿制药
--------------------------------------------------------------------------------
--节点和进程标识符--
--------------------------------------------------------------------------------
--|节点标识符
newtype NodeId=NodeId{nodeAddress::NT.EndPointAddress}
派生(等式、Ord、可键入、通用)
实例二进制NodeId在哪里
实例NFData节点ID
实例Hashable NodeId在哪里
实例Show NodeId where
show(NodeId addr)=“nid://”++show addr
--|本地进程ID由一个种子组成,该种子将进程与
--同一本地节点和计数器的不同实例
数据LocalProcessId=LocalProcessId
{lpidUnique::{-#解包#-}!Int32
,lpidCounter::{-#解包#-}!Int32
}
派生(等式、Ord、可键入、通用、显示)

看起来您安装了多个版本的
哈希表。使用
ghc pkg list
ghc pkg unregister
等来了解发生了什么并修复它。几乎可以肯定的是,您只想拥有一个版本的
哈希表

好的,算了吧。EndPointAddress在hashable的主分支中没有实例。为了成功编译分布式流程平台,我必须下载以下软件包的开发分支:

hashable
distributed-process
distributed-process-static
rank1dynamic
network-transport
network-transport-tcp
distributed-process-simplelocalnet
distributed-process-platform
我在下面的帖子中找到了这个信息


谢谢你花时间回复我的帖子

您可以发布产生此错误的代码吗?您是否添加了用于newtype的类的实例?