@@ -18,7 +18,7 @@ where
1818import Data.Char (isSpace)
1919import Data.Data (Data)
2020import Data.Either (partitionEithers)
21−import Data.List (isPrefixOf, sortOn)
21+import Data.List (isPrefixOf, sortOn, dropWhileEnd)
2222import Data.List.NonEmpty (NonEmpty (..))
2323import Data.Maybe (mapMaybe)
2424import Data.Set (Set)
@@ -98,7 +98,7 @@ normalizePragma x =
9898-- each line.
9999
100100mkComment :: RealLocated String -> RealLocated Comment
101−mkComment (L l s) = L l . Comment $
101+mkComment (L l s) = L l . Comment . fmap dropTrailing $
102102 if "{-" `isPrefixOf` s
103103 then case NE.nonEmpty (lines s) of
104104 Nothing -> s :| []
@@ -111,6 +111,7 @@ mkComment (L l s) = L l . Comment $
111111 in x :| (drop n <$> xs)
112112 else s :| []
113113 where
114+ dropTrailing = dropWhileEnd isSpace
114115 startIndent = srcSpanStartCol l - 1
115116
116117-- | Get a 'String' from 'GHC.AnnotationComment'.