Shorter more readable toChar.
This commit is contained in:
parent
4ed740724e
commit
33ee15d56f
@ -81,10 +81,7 @@ parseWaiRequest' env session' key' gen = Request gets'' cookies' env langs''' no
|
|||||||
randomString :: RandomGen g => Int -> g -> String
|
randomString :: RandomGen g => Int -> g -> String
|
||||||
randomString len = take len . map toChar . randomRs (0, 61)
|
randomString len = take len . map toChar . randomRs (0, 61)
|
||||||
where
|
where
|
||||||
toChar i
|
toChar i = (['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9']) !! i
|
||||||
| i < 26 = toEnum $ i + fromEnum 'A'
|
|
||||||
| i < 52 = toEnum $ i + fromEnum 'a' - 26
|
|
||||||
| otherwise = toEnum $ i + fromEnum '0' - 52
|
|
||||||
|
|
||||||
-- | A tuple containing both the POST parameters and submitted files.
|
-- | A tuple containing both the POST parameters and submitted files.
|
||||||
type RequestBodyContents =
|
type RequestBodyContents =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user