diff --git a/data/examples/declaration/value/function/equality-constraints-out.hs b/data/examples/declaration/value/function/equality-constraints-out.hs new file mode 100644 index 0000000..188f2c5 --- /dev/null +++ b/data/examples/declaration/value/function/equality-constraints-out.hs @@ -0,0 +1,2 @@ +foo :: (a ~ b) => a -> b -> Int +foo = undefined diff --git a/data/examples/declaration/value/function/equality-constraints.hs b/data/examples/declaration/value/function/equality-constraints.hs new file mode 100644 index 0000000..188f2c5 --- /dev/null +++ b/data/examples/declaration/value/function/equality-constraints.hs @@ -0,0 +1,2 @@ +foo :: (a ~ b) => a -> b -> Int +foo = undefined diff --git a/src/Ormolu/Printer/Meat/Common.hs b/src/Ormolu/Printer/Meat/Common.hs index 932f84f..63fb871 100644 --- a/src/Ormolu/Printer/Meat/Common.hs +++ b/src/Ormolu/Printer/Meat/Common.hs @@ -17,7 +17,6 @@ where import Control.Monad import Data.List (isPrefixOf) import GHC hiding (GhcPs, IE) -import Module (Module (..)) import Name (nameStableString) import OccName (OccName (..)) import Ormolu.Printer.Combinators @@ -65,8 +64,15 @@ p_rdrName l@(L spn _) = located l $ \x -> do (atom occName, False) Qual mname occName -> (p_qualName mname occName, False) - Orig (Module _ mname) occName -> - (p_qualName mname occName, False) + Orig _ occName -> + -- NOTE This is used when GHC generates code that will be fed + -- into the renamer (e.g. from deriving clauses), but where we + -- want to say that something comes from given module which is + -- not specified in the source code, e.g. @Prelude.map@. + -- + -- My current understanding is that the provided module name + -- serves no purpose for us and can be safely ignored. + (atom occName, False) Exact name -> -- NOTE I'm not sure this "stable string" is stable enough, but -- it looks like this is the most robust way to tell if we're