diff --git a/CHANGELOG.md b/CHANGELOG.md index d98239e9bf..b75dfdc6a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * `futhark fmt`: do not throw away doc comments for `local` definitions. +* `futhark fmt`: improve formatting of value specs. + ## [0.25.25] ### Added diff --git a/src/Futhark/Fmt/Printer.hs b/src/Futhark/Fmt/Printer.hs index 32fc3dfd76..8be7b96495 100644 --- a/src/Futhark/Fmt/Printer.hs +++ b/src/Futhark/Fmt/Printer.hs @@ -511,7 +511,7 @@ instance Format UncheckedSpec where where sub | null ps = fmtName bindingStyle name - | otherwise = fmtName bindingStyle name <+> align (sep line $ map fmt ps) + | otherwise = fmtName bindingStyle name <+> align (sep space $ map fmt ps) fmt (ModSpec name mte doc loc) = addComments loc $ fmt doc <> "module" <+> fmtName bindingStyle name <> ":" <+> fmt mte fmt (IncludeSpec mte loc) = addComments loc $ "include" <+> fmt mte diff --git a/tests_fmt/expected/modules.fut b/tests_fmt/expected/modules.fut index 80a090d291..7bc242bf3b 100644 --- a/tests_fmt/expected/modules.fut +++ b/tests_fmt/expected/modules.fut @@ -34,6 +34,13 @@ module type mt4 = { val g [n] : [n]i32 -> [n]i32 + + val block [m1] [m2] [n1] [n2] : + (A: [m1][n1]i32) + -> (B: [m1][n2]i32) + -> (C: [m2][n1]i32) + -> (D: [m2][n2]i32) + -> [m1 + m2][n1 + n2]i32 } module pm1 (P: {}) : {} = { diff --git a/tests_fmt/modules.fut b/tests_fmt/modules.fut index dfce8e67cb..b93701b457 100644 --- a/tests_fmt/modules.fut +++ b/tests_fmt/modules.fut @@ -30,6 +30,9 @@ module type mt4 = { -> [n]i32 + val block [m1] [m2] [n1] [n2] : + (A: [m1][n1]i32) -> (B: [m1][n2]i32) -> (C: [m2][n1]i32) -> (D: [m2][n2]i32) + -> [m1 + m2][n1 + n2]i32 } module pm1 (P: {}) : {} = {