From 40b1d2030b7162edc91db06e13510d0898f5f9fb Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 18 May 2018 13:19:24 -0400 Subject: [PATCH] Prettier output for machine-generated names. --- src/Data/Abstract/Name.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Data/Abstract/Name.hs b/src/Data/Abstract/Name.hs index 352284bf9..9fb330301 100644 --- a/src/Data/Abstract/Name.hs +++ b/src/Data/Abstract/Name.hs @@ -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