feat: use ascii type variables in prettify (#1195)

This commit is contained in:
Veit Heller 2021-04-06 11:38:07 +02:00 committed by GitHub
parent 1f8c8765d3
commit 4ec166a6fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -495,10 +495,11 @@ beautifyTy mappings = f
bmappings = beautification mappings
beautification :: TypeMappings -> Map.Map String String
beautification m =
Map.fromList $ zip (map (\(VarTy name) -> name) tys) ((: []) <$> ['a' ..])
Map.fromList $ zip (map (\(VarTy name) -> name) tys) beautList
where
tys = nub $ concat $ typeVariablesInOrderOfAppearance <$> tys'
tys' = snd <$> Map.assocs m
beautList = [c : s | s <- "" : beautList, c <- ['a' .. 'z']]
typeVariablesInOrderOfAppearance :: Ty -> [Ty]
typeVariablesInOrderOfAppearance (FuncTy argTys retTy ltTy) =