From a546ce0334f7e4a083fd38a3ed18511f1447e17e Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 11 Feb 2020 16:44:31 +0000 Subject: [PATCH] Fix order of nodes in client --- src/Forest/Node.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Forest/Node.hs b/src/Forest/Node.hs index 5c76fce..ce72b1e 100644 --- a/src/Forest/Node.hs +++ b/src/Forest/Node.hs @@ -60,7 +60,10 @@ newNode flags text children = delete = 'd' `elem` flags reply = 'r' `elem` flags act = 'a' `elem` flags - pairedChildren = zip (map (T.pack . show) [(0::Integer)..]) children + digits = length $ show $ length children + formatId :: Integer -> T.Text + formatId = T.justifyRight digits '0' . T.pack . show + pairedChildren = zip (map formatId [0..]) children in Node text edit delete reply act $ Map.fromList pairedChildren emptyNode :: String -> T.Text -> Node