Fix compilation. Better indentation for the pretty printer

This commit is contained in:
Luca Bruno 2014-07-07 16:55:03 +02:00
parent be5c81d190
commit 8103ed8cc8
1 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ prettySetArg :: (Text, Maybe NExpr) -> Doc
prettySetArg (n, Nothing) = text (show n)
prettySetArg (n, Just v) = text (show n) <+> text "?" <+> prettyNix v
prettyFold = foldr (<+>) empty
prettyFold = foldr ($$) empty
prettyNix :: NExpr -> Doc
prettyNix (Fix expr) = go expr where
@ -23,8 +23,8 @@ prettyNix (Fix expr) = go expr where
go (NArgSet args) = lbrace <+> (prettyFold $ map prettySetArg $ toList args) <+> rbrace
go (NSet rec list) =
(if rec then text "rec" else empty)
<+> lbrace <+> (foldr (<+>) empty $ map prettyBind list) <+> rbrace
(case rec of Rec -> "rec"; otherwise -> empty)
<+> lbrace <+> (prettyFold $ map prettyBind list) <+> rbrace
go (NLet binds body) = text "let"
go (NIf cond trueBody falseBody) =
@ -38,5 +38,5 @@ prettyNix (Fix expr) = go expr where
go (NVar e) = prettyNix e
go (NApp fun arg) = prettyNix fun <+> prettyNix arg
go (NAbs args body) = prettyNix args <> colon <+> prettyNix body
go (NAbs args body) = (prettyNix args <> colon) $$ prettyNix body