From 07ac4aaf665062beed5abc82af788ff620c3a69d Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Sat, 1 Dec 2012 08:43:32 +0100 Subject: [PATCH] Fix variable names in Loader.assignIndices This function can be applied to any type of class "Element" but its internal variables used to refer to a list of tuples containing these elements and their names as "nodes". Moreover it built a list of name to indices tuples referring to it as "na" (which is not very clear). Thus nodes becomes name_element, and na name_idx. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- htools/Ganeti/HTools/Loader.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htools/Ganeti/HTools/Loader.hs b/htools/Ganeti/HTools/Loader.hs index 95cad79d7..6be17c1ef 100644 --- a/htools/Ganeti/HTools/Loader.hs +++ b/htools/Ganeti/HTools/Loader.hs @@ -117,11 +117,11 @@ lookupGroup ktg nname gname = assignIndices :: (Element a) => [(String, a)] -> (NameAssoc, Container.Container a) -assignIndices nodes = - let (na, idx_node) = +assignIndices name_element = + let (name_idx, idx_element) = unzip . map (\ (idx, (k, v)) -> ((k, idx), (idx, setIdx v idx))) - . zip [0..] $ nodes - in (M.fromList na, Container.fromList idx_node) + . zip [0..] $ name_element + in (M.fromList name_idx, Container.fromList idx_element) -- | For each instance, add its index to its primary and secondary nodes. fixNodes :: Node.List -- GitLab