From 33ee15d56facfc5204b5c4dbade95b44e428bc8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Buckwalter?= Date: Sat, 17 Sep 2011 00:43:16 +0800 Subject: [PATCH] Shorter more readable toChar. --- yesod-core/Yesod/Internal/Request.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/yesod-core/Yesod/Internal/Request.hs b/yesod-core/Yesod/Internal/Request.hs index 6470e3f9..d447b5ba 100644 --- a/yesod-core/Yesod/Internal/Request.hs +++ b/yesod-core/Yesod/Internal/Request.hs @@ -81,10 +81,7 @@ parseWaiRequest' env session' key' gen = Request gets'' cookies' env langs''' no randomString :: RandomGen g => Int -> g -> String randomString len = take len . map toChar . randomRs (0, 61) where - toChar i - | i < 26 = toEnum $ i + fromEnum 'A' - | i < 52 = toEnum $ i + fromEnum 'a' - 26 - | otherwise = toEnum $ i + fromEnum '0' - 52 + toChar i = (['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9']) !! i -- | A tuple containing both the POST parameters and submitted files. type RequestBodyContents =