From 274366e5c7386e4996edcb10f71428bc7e33c10a Mon Sep 17 00:00:00 2001
From: Agata Murawska <agatamurawska@google.com>
Date: Thu, 27 Sep 2012 12:58:12 +0200
Subject: [PATCH] Realign instances of typeclasses

As per Iustin's suggestion, this patch aligns parts of typeclass
instance on "=".

Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 htools/Ganeti/BasicTypes.hs | 12 +++++------
 htools/Ganeti/Rpc.hs        | 41 +++++++++++++++++++------------------
 2 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/htools/Ganeti/BasicTypes.hs b/htools/Ganeti/BasicTypes.hs
index f4bb9a6fc..d688a9caa 100644
--- a/htools/Ganeti/BasicTypes.hs
+++ b/htools/Ganeti/BasicTypes.hs
@@ -84,12 +84,12 @@ newtype ResultT m a = ResultT {runResultT :: m (Result a)}
 
 instance (Monad m) => Monad (ResultT m) where
   fail err = ResultT (return $ Bad err)
-  return = lift . return
-  x >>= f = ResultT $ do
-              a <- runResultT x
-              case a of
-                Ok val -> runResultT $ f val
-                Bad err -> return $ Bad err
+  return   = lift . return
+  x >>= f  = ResultT $ do
+               a <- runResultT x
+               case a of
+                 Ok val -> runResultT $ f val
+                 Bad err -> return $ Bad err
 
 instance MonadTrans ResultT where
   lift x = ResultT (liftM Ok x)
diff --git a/htools/Ganeti/Rpc.hs b/htools/Ganeti/Rpc.hs
index c3d2c73ae..9b8feef2c 100644
--- a/htools/Ganeti/Rpc.hs
+++ b/htools/Ganeti/Rpc.hs
@@ -259,10 +259,10 @@ $(buildObject "RpcResultInstanceInfo" "rpcResInstInfo"
   [ optionalField $ simpleField "inst_info" [t| InstanceInfo |]])
 
 instance RpcCall RpcCallInstanceInfo where
-  rpcCallName _ = "instance_info"
-  rpcCallTimeout _ = rpcTimeoutToRaw Urgent
+  rpcCallName _          = "instance_info"
+  rpcCallTimeout _       = rpcTimeoutToRaw Urgent
   rpcCallAcceptOffline _ = False
-  rpcCallData _ call = J.encode
+  rpcCallData _ call     = J.encode
     ( rpcCallInstInfoInstance call
     , rpcCallInstInfoHname call
     )
@@ -289,10 +289,10 @@ $(buildObject "RpcResultAllInstancesInfo" "rpcResAllInstInfo"
   [ simpleField "instances" [t| [(String, InstanceInfo)] |] ])
 
 instance RpcCall RpcCallAllInstancesInfo where
-  rpcCallName _ = "all_instances_info"
-  rpcCallTimeout _ = rpcTimeoutToRaw Urgent
+  rpcCallName _          = "all_instances_info"
+  rpcCallTimeout _       = rpcTimeoutToRaw Urgent
   rpcCallAcceptOffline _ = False
-  rpcCallData _ call = J.encode [rpcCallAllInstInfoHypervisors call]
+  rpcCallData _ call     = J.encode [rpcCallAllInstInfoHypervisors call]
 
 instance Rpc RpcCallAllInstancesInfo RpcResultAllInstancesInfo where
   -- FIXME: Is there a simpler way to do it?
@@ -316,10 +316,10 @@ $(buildObject "RpcResultInstanceList" "rpcResInstList"
   [ simpleField "instances" [t| [String] |] ])
 
 instance RpcCall RpcCallInstanceList where
-  rpcCallName _ = "instance_list"
-  rpcCallTimeout _ = rpcTimeoutToRaw Urgent
+  rpcCallName _          = "instance_list"
+  rpcCallTimeout _       = rpcTimeoutToRaw Urgent
   rpcCallAcceptOffline _ = False
-  rpcCallData _ call = J.encode [rpcCallInstListHypervisors call]
+  rpcCallData _ call     = J.encode [rpcCallInstListHypervisors call]
 
 
 instance Rpc RpcCallInstanceList RpcResultInstanceList where
@@ -358,12 +358,13 @@ $(buildObject "RpcResultNodeInfo" "rpcResNodeInfo"
   ])
 
 instance RpcCall RpcCallNodeInfo where
-  rpcCallName _ = "node_info"
-  rpcCallTimeout _ = rpcTimeoutToRaw Urgent
+  rpcCallName _          = "node_info"
+  rpcCallTimeout _       = rpcTimeoutToRaw Urgent
   rpcCallAcceptOffline _ = False
-  rpcCallData _ call = J.encode ( rpcCallNodeInfoVolumeGroups call
-                                , rpcCallNodeInfoHypervisors call
-                                )
+  rpcCallData _ call     = J.encode
+    ( rpcCallNodeInfoVolumeGroups call
+    , rpcCallNodeInfoHypervisors call
+    )
 
 instance Rpc RpcCallNodeInfo RpcResultNodeInfo where
   rpcResultFill _ res =
@@ -388,10 +389,10 @@ $(buildObject "RpcResultVersion" "rpcResultVersion"
   ])
 
 instance RpcCall RpcCallVersion where
-  rpcCallName _ = "version"
-  rpcCallTimeout _ = rpcTimeoutToRaw Urgent
+  rpcCallName _          = "version"
+  rpcCallTimeout _       = rpcTimeoutToRaw Urgent
   rpcCallAcceptOffline _ = True
-  rpcCallData call _ = J.encode [call]
+  rpcCallData call _     = J.encode [call]
 
 instance Rpc RpcCallVersion RpcResultVersion where
   rpcResultFill _ res =
@@ -432,10 +433,10 @@ $(buildObject "RpcResultStorageList" "rpcResStorageList"
   [ simpleField "storage" [t| [[(StorageField, J.JSValue)]] |] ])
 
 instance RpcCall RpcCallStorageList where
-  rpcCallName _ = "storage_list"
-  rpcCallTimeout _ = rpcTimeoutToRaw Normal
+  rpcCallName _          = "storage_list"
+  rpcCallTimeout _       = rpcTimeoutToRaw Normal
   rpcCallAcceptOffline _ = False
-  rpcCallData _ call = J.encode
+  rpcCallData _ call     = J.encode
     ( rpcCallStorageListSuName call
     , rpcCallStorageListSuArgs call
     , rpcCallStorageListName call
-- 
GitLab