Skip to content

Instantly share code, notes, and snippets.

@yuga yuga/numbase62.hs
Created May 26, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.