1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +03:00

Prettier output for machine-generated names.

This commit is contained in:
Rob Rix 2018-05-18 13:19:24 -04:00
parent f49ba195cf
commit 40b1d2030b

View File

@ -26,7 +26,9 @@ nameI = I
-- | Extract a human-readable 'ByteString' from a 'Name'.
unName :: Name -> ByteString
unName (Name name) = name
unName (I i) = BC.pack (show i)
unName (I i) = BC.pack $ '_' : (alphabet !! a) : replicate n 'ʹ'
where alphabet = ['a'..'z']
(n, a) = i `divMod` length alphabet
instance IsString Name where
fromString = Name . BC.pack