diff options
author | Ćukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-21 19:44:33 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-08-21 18:22:31 +0100 |
commit | aec90be7b95b2116e3c436b91b7c35aec026f6cc (patch) | |
tree | 5ee4874ffe750fb8f55c73c65304840f28ea3afc /haddock-api/src/Haddock/Backends/Xhtml | |
parent | 1700278e2d5978d098f2acb610442df2bc0ae02a (diff) |
Make type renamer first try single-letter names as alternatives.
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs | 10 |
1 files changed, 9 insertions, 1 deletions
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 |