From 2ef3e66b4899ecd541a6cff204e896663eef85f5 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sat, 11 Apr 2015 20:28:37 +0200 Subject: [PATCH] Fix wrong newline --- src/Json.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Json.hs b/src/Json.hs index fab4612..0083867 100644 --- a/src/Json.hs +++ b/src/Json.hs @@ -24,12 +24,13 @@ repr obj = repr' obj 0 where repr' val lev = case val of Array x -> intercalate ", " $ mapl (\i -> repr' i lev) x - Object x -> drop 1 $ concat $ map (dump x lev) $ H.keys x + Object x -> newline lev $ concat $ map (dump x lev) $ H.keys x String x -> unpack x Number x -> show x Bool x -> show x Null -> "null" - mapl f v = V.toList $ V.map f v + mapl f v = V.toList (V.map f v) + newline n = if n == 1 then id else drop 1 indent l = '\n' : (concat . replicate l) " " dump o l k = concat [indent l, unpack k, ": ", repr' (o |. k) (l+1)]