diff --git a/data/examples/declaration/value/function/unboxed-string-lit-out.hs b/data/examples/declaration/value/function/unboxed-string-lit-out.hs new file mode 100644 index 0000000..36ebb7c --- /dev/null +++ b/data/examples/declaration/value/function/unboxed-string-lit-out.hs @@ -0,0 +1,3 @@ +{-# LANGUAGE MagicHash #-} + +main = new "p"# diff --git a/data/examples/declaration/value/function/unboxed-string-lit.hs b/data/examples/declaration/value/function/unboxed-string-lit.hs new file mode 100644 index 0000000..36ebb7c --- /dev/null +++ b/data/examples/declaration/value/function/unboxed-string-lit.hs @@ -0,0 +1,3 @@ +{-# LANGUAGE MagicHash #-} + +main = new "p"# diff --git a/ormolu.cabal b/ormolu.cabal index 90ddeb5..feee5ac 100644 --- a/ormolu.cabal +++ b/ormolu.cabal @@ -38,6 +38,7 @@ flag dev library hs-source-dirs: src build-depends: base >= 4.12 && < 5.0 + , bytestring >= 0.2 && < 0.11 , containers >= 0.5 && < 0.7 , dlist >= 0.8 && < 0.9 , exceptions >= 0.6 && < 0.11 diff --git a/src/Ormolu/Diff.hs b/src/Ormolu/Diff.hs index 46b39ba..1281c4c 100644 --- a/src/Ormolu/Diff.hs +++ b/src/Ormolu/Diff.hs @@ -11,6 +11,7 @@ module Ormolu.Diff where import BasicTypes (SourceText) +import Data.ByteString (ByteString) import Data.Generics import GHC import Ormolu.Imports (sortImports) @@ -51,6 +52,12 @@ matchIgnoringSrcSpans = genericQuery where genericQuery :: GenericQ (GenericQ Diff) genericQuery x y + -- NOTE 'ByteString' implement 'Data' instance manually and does not + -- implement 'toConstr', so we have to deal with it in a special way. + | Just x' <- cast x, Just y' <- cast y = + if x' == (y' :: ByteString) + then Same + else Different [] | typeOf x == typeOf y, toConstr x == toConstr y = mconcat $ gzipWithQ (genericQuery