From aec90be7b95b2116e3c436b91b7c35aec026f6cc Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Tue, 21 Jul 2015 19:44:33 +0200 Subject: Make type renamer first try single-letter names as alternatives. --- haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'haddock-api/src/Haddock/Backends') diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs index 3b3d95b9..c127ebbd 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs @@ -241,7 +241,15 @@ findFreshName taken = alternativeNames :: OccName -> [OccName] -alternativeNames name = +alternativeNames name + | [_] <- occNameString name = letterNames ++ alternativeNames' name + where + letterNames = map (mkVarOcc . pure) ['a'..'z'] +alternativeNames name = alternativeNames' name + + +alternativeNames' :: OccName -> [OccName] +alternativeNames' name = [ mkVarOcc $ str ++ show i | i :: Int <- [0..] ] where str = occNameString name -- cgit v1.2.3