Commits

Bryan O'Sullivan committed 0c965df

Spiff up some types a bit.

Comments (0)

Files changed (2)

src/Network/Riak/Types/Internal.hs

     , Tagged(..)
     ) where
 
-import Control.Exception
-import Data.Typeable (Typeable)
+import Control.Exception (Exception, throw)
 import Data.ByteString.Lazy (ByteString)
 import Data.Digest.Pure.MD5 (md5)
 import Data.IORef (IORef)
+import Data.Typeable (Typeable)
 import Data.Word (Word32)
 import Network.Socket (HostName, ServiceName, Socket)
 import Text.ProtocolBuffers (ReflectDescriptor, Wire)
     , prefix :: ByteString
     , mapReducePrefix :: ByteString
     , clientID :: ClientID
-    } deriving (Eq, Show)
+    } deriving (Eq, Show, Typeable)
 
 data Connection = Connection {
       connSock :: Socket
       excModule :: String
     , excFunction :: String
     , excMessage :: String
-    } deriving (Typeable)
+    } deriving (Eq, Typeable)
 
 showRiakException :: RiakException -> String
 showRiakException exc@NetException{..} =
 
 data Job = JSON ByteString
          | Erlang ByteString
-           deriving (Eq, Show)
+           deriving (Eq, Show, Typeable)
 
 data MessageTag = ErrorResponse
                 | PingRequest
                 | SetBucketResponse
                 | MapReduceRequest
                 | MapReduceResponse
-                  deriving (Eq, Show, Enum)
+                  deriving (Eq, Show, Enum, Typeable)
 
 class Tagged msg where
     messageTag :: msg -> MessageTag
 
 newtype VClock = VClock {
       fromVClock :: ByteString
-    } deriving (Eq)
+    } deriving (Eq, Typeable)
 
 instance Show VClock where
     show (VClock s) = "VClock " ++ show (md5 s)
             | One
             | Quorum
             | All
-              deriving (Bounded, Eq, Enum, Ord, Show)
+              deriving (Bounded, Eq, Enum, Ord, Show, Typeable)
 
 type RW = Quorum
 type R  = Quorum

src/Network/Riak/Value.hs

-{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
+{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, RecordWildCards #-}
 
 module Network.Riak.Value
     (
     ) where
 
 import Data.Attoparsec.Lazy (maybeResult, parse)
+import Data.Typeable (Typeable)
 import Data.Foldable (toList)
 import Network.Riak.Connection.Internal
 import Network.Riak.Protocol.Content (Content(..))
 
 newtype JSON a = J {
       plain :: a
-    } deriving (Eq, Ord, Show, Read, Bounded)
+    } deriving (Eq, Ord, Show, Read, Bounded, Typeable)
 
 json :: (Aeson.FromJSON a, Aeson.ToJSON a) => a -> JSON a
 json = J