Skip to content

Commit

Permalink
futhark fmt: no linebreak before parens.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Nov 3, 2024
1 parent 9db8668 commit 86cf19a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Futhark/Fmt/Printer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ instance Format UncheckedExp where
fmt (Var name _ loc) = addComments loc $ fmtQualName name
fmt (Hole _ loc) = addComments loc "???"
fmt (Parens e loc) =
addComments loc $ "(" <> stdNest (fmt e) <:/> ")"
addComments loc $ "(" <> stdNest (fmt e) <> ")"
fmt (QualParens (v, _qLoc) e loc) =
addComments loc $
fmtQualName v <> "." <> "(" <> align (fmt e) <:/> ")"
fmtQualName v <> "." <> "(" <> align (fmt e) <> ")"
fmt (Ascript e t loc) = addComments loc $ fmt e <> ":" <+> fmt t
fmt (Coerce e t _ loc) = addComments loc $ fmt e <+> ":>" <+> fmt t
fmt (Literal _v loc) = addComments loc $ fmtCopyLoc constantStyle loc
Expand Down Expand Up @@ -482,7 +482,7 @@ typeWiths mte = (mte, [])
instance Format UncheckedModTypeExp where
fmt (ModTypeVar v _ loc) = addComments loc $ fmtPretty v
fmt (ModTypeParens mte loc) =
addComments loc $ "(" <> align (fmt mte) <:/> ")"
addComments loc $ "(" <> align (fmt mte) <> ")"
fmt (ModTypeSpecs sbs loc) =
addComments loc $ "{" <:/> stdIndent (sepDecs fmt sbs) <:/> "}"
fmt (ModTypeWith mte tr loc) =
Expand Down Expand Up @@ -547,7 +547,7 @@ instance Format UncheckedModBind where
instance Format UncheckedModExp where
fmt (ModVar v loc) = addComments loc $ fmtQualName v
fmt (ModParens f loc) =
addComments loc $ "(" <:/> stdIndent (fmt f) <:/> ")"
addComments loc $ "(" <:/> stdIndent (fmt f) <> ")"
fmt (ModImport path _f loc) =
addComments loc $ "import" <+> "\"" <> fmtPretty path <> "\""
fmt (ModDecs decs loc) =
Expand Down
4 changes: 2 additions & 2 deletions tests_fmt/expected/lambda.fut
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def f =
\x ->
x + 2
(\x ->
x + 2)

def r =
{ x =
Expand Down
4 changes: 2 additions & 2 deletions tests_fmt/lambda.fut
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def f =
\x ->
x + 2
(\x ->
x + 2)

def r =
{ x =
Expand Down

0 comments on commit 86cf19a

Please sign in to comment.