@@ -11,6 +11,7 @@ module Ormolu.Diff
1111where
1212
1313import BasicTypes (SourceText)
14+import Data.ByteString (ByteString)
1415import Data.Generics
1516import GHC
1617import Ormolu.Imports (sortImports)
@@ -51,6 +52,12 @@ matchIgnoringSrcSpans = genericQuery
5152 where
5253 genericQuery :: GenericQ (GenericQ Diff)
5354 genericQuery x y
55+ -- NOTE 'ByteString' implement 'Data' instance manually and does not
56+ -- implement 'toConstr', so we have to deal with it in a special way.
57+ | Just x' <- cast x, Just y' <- cast y =
58+ if x' == (y' :: ByteString)
59+ then Same
60+ else Different []
5461 | typeOf x == typeOf y, toConstr x == toConstr y =
5562 mconcat $ gzipWithQ
5663 (genericQuery