Fix wrong newline

This commit is contained in:
rnhmjoj 2015-04-11 20:28:37 +02:00
parent 8811c7a217
commit 2ef3e66b48

View File

@ -24,12 +24,13 @@ repr obj = repr' obj 0 where
repr' val lev = repr' val lev =
case val of case val of
Array x -> intercalate ", " $ mapl (\i -> repr' i lev) x 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 String x -> unpack x
Number x -> show x Number x -> show x
Bool x -> show x Bool x -> show x
Null -> "null" 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) " " indent l = '\n' : (concat . replicate l) " "
dump o l k = concat [indent l, unpack k, ": ", repr' (o |. k) (l+1)] dump o l k = concat [indent l, unpack k, ": ", repr' (o |. k) (l+1)]