From 656d0369d436c3a1d62c0f91c305bef58011d2a1 Mon Sep 17 00:00:00 2001 From: mrkkrp Date: Mon, 10 Jun 2019 21:29:48 +0200 Subject: [PATCH] Output multiple specialize pragmas in a row nicer We should not insert newlines between them. --- data/examples/declaration/signature/specialize/specialize-out.hs | 1 + data/examples/declaration/signature/specialize/specialize.hs | 1 + src/Ormolu/Printer/Meat/Module.hs | 1 + 3 files changed, 3 insertions(+) diff --git a/data/examples/declaration/signature/specialize/specialize-out.hs b/data/examples/declaration/signature/specialize/specialize-out.hs index 56d5f36..46505fd 100644 --- a/data/examples/declaration/signature/specialize/specialize-out.hs +++ b/data/examples/declaration/signature/specialize/specialize-out.hs @@ -1,6 +1,7 @@ foo :: Num a => a -> a foo = id {-# SPECIALIZE foo :: Int -> Int #-} +{-# SPECIALIZE foo :: Float -> Float #-} {-# SPECIALIZE [2] bar :: Int -> Int #-} bar :: Num a => a -> a diff --git a/data/examples/declaration/signature/specialize/specialize.hs b/data/examples/declaration/signature/specialize/specialize.hs index 99df269..87d6ffa 100644 --- a/data/examples/declaration/signature/specialize/specialize.hs +++ b/data/examples/declaration/signature/specialize/specialize.hs @@ -2,6 +2,7 @@ foo :: Num a => a -> a foo = id {-# SPECIALIZE foo :: Int -> Int #-} +{-# SPECIALIZE foo :: Float -> Float #-} {-# SPECIALIZE [2] bar :: Int -> Int #-} diff --git a/src/Ormolu/Printer/Meat/Module.hs b/src/Ormolu/Printer/Meat/Module.hs index 0732a5a..6611930 100644 --- a/src/Ormolu/Printer/Meat/Module.hs +++ b/src/Ormolu/Printer/Meat/Module.hs @@ -70,6 +70,7 @@ separatedDecls (FunctionBody n) (InlinePragma n') = n /= n' separatedDecls (InlinePragma n) (TypeSignature n') = n /= n' separatedDecls (FunctionBody n) (SpecializePragma n') = n /= n' separatedDecls (SpecializePragma n) (TypeSignature n') = n /= n' +separatedDecls (SpecializePragma n) (SpecializePragma n') = n /= n' separatedDecls _ _ = True pattern TypeSignature