on master help sign in
Fix rendering of type equalities

Please see the comment in the diff.

commit8c275495329ba620c375c03cfdcc867812f57676 authormrkkrp <mark.karpov@tweag.io> dateFri 28 Jun 2019, 23:37 (7 years ago) parent057977d
3 files changed+13−3
data/examples/declaration/value/function/equality-constraints-out.hs+2 data/examples/declaration/value/function/equality-constraints.hs+2 src/Ormolu/Printer/Meat/Common.hs+9−3
data/examples/declaration/value/function/equality-constraints-out.hsnew file+2
@@ -0,0 +1,2 @@
1+foo :: (a ~ b) => a -> b -> Int
2+foo = undefined
data/examples/declaration/value/function/equality-constraints.hsnew file+2
@@ -0,0 +1,2 @@
1+foo :: (a ~ b) => a -> b -> Int
2+foo = undefined
src/Ormolu/Printer/Meat/Common.hs+9−3
@@ -17,7 +17,6 @@ where
1717import Control.Monad
1818import Data.List (isPrefixOf)
1919import GHC hiding (GhcPs, IE)
20−import Module (Module (..))
2120import Name (nameStableString)
2221import OccName (OccName (..))
2322import Ormolu.Printer.Combinators
@@ -65,8 +64,15 @@ p_rdrName l@(L spn _) = located l $ \x -> do
6564 (atom occName, False)
6665 Qual mname occName ->
6766 (p_qualName mname occName, False)
68− Orig (Module _ mname) occName ->
69− (p_qualName mname occName, False)
67+ Orig _ occName ->
68+ -- NOTE This is used when GHC generates code that will be fed
69+ -- into the renamer (e.g. from deriving clauses), but where we
70+ -- want to say that something comes from given module which is
71+ -- not specified in the source code, e.g. @Prelude.map@.
72+ --
73+ -- My current understanding is that the provided module name
74+ -- serves no purpose for us and can be safely ignored.
75+ (atom occName, False)
7076 Exact name ->
7177 -- NOTE I'm not sure this "stable string" is stable enough, but
7278 -- it looks like this is the most robust way to tell if we're