Skip to content

Instantly share code, notes, and snippets.

@yuga
Created May 26, 2015 01:15
Show Gist options
  • Save yuga/8c0e4ae9e8b7700f3aa5 to your computer and use it in GitHub Desktop.
Save yuga/8c0e4ae9e8b7700f3aa5 to your computer and use it in GitHub Desktop.
import Data.Char (chr)
import Numeric (showIntAtBase)
repr :: Int -> Chr
repr n
| n < 10 = chr (48 + n)
| n < 36 = chr (65 + n - 10)
| n < 62 = chr (97 + n - 36)
numbase62 :: (Integral a, Show a) => a -> String
numbase62 n = showIntAtBase 62 repr n ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment